OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: DeadActionMan on 13 Jan 2009, 12:24:38
-
Is there a better way to stop the player from performing actions while a script is running?
I've attached a repair script/demo mission which grants any unit the ability to repair suitable vehicles in range, but the trouble is, while you're performing the repair, you can still "Place Satchel Charge", "Get In As..." and all the other actions that normally appear.
Doing so doesn't stop the repair script from finishing, it just looks dumb if you get your Bins out or Get In the vehicle... while you're still repairing it. :banghead:
What I'm after, is a way to stop the player from doing anything else while the script is running. I've tried locking the vehicle at the start of repairs and then returning it to whatever state it was in previously and that's fixed part of the issue (you can't get in untill repairs are complete), but it doesn't help with the "other" actions that are availble during the repair cycle.
DisableUserInput seems too extreme, and I'm not sure what the implications are using it in MP.
Any help, comments, or feedback would be appreciated. :good:
-
You can open a dialog. But this is the same extreme as DisableUserInput.
-
I've actually made a quite similar repair script, and in that I used the medic heal animation to freeze "some" user input for a while.
I've attached it so you can have a look at it.
edit: nevermind, I saw that you actually did the same in your script, silly me :whistle:
-
You can open a dialog. But this is the same extreme as DisableUserInput.
Actually, it's not -that- extreme, and could in fact work quite well. Simply create a dialog which, for instance, shows the % of repair progress (or something), and which gives the instruction "press ESC to cancel" - pressing ESC, and thus escaping the dialogue, will also cancel the repairs then.
I don't really know of any other terribly clever ways of removing or temporarily disabling all other actions. Hm hm. :(
Wolfrug out.
-
I'm developing a universal graph script to show like a progress indicator. It doesn't prevent user movement but i could easily add it as an option.I'll try and finish it up today and post it in the beta boards.
-
You could also use a camera to block the controls:
_cam = "camera" camCreate position player;
_cam cameraEffect ["internal", "back"];
titleText ["Repairing, wait a moment...", "PLAIN"];
waitUntil {RepairsDone};
camDestroy _cam;
-
Trouble with a camera is that if he's attacked he's gonna get wasted. Wolfrug's idea to have a dialogue bar with a cancel option seems to be the way to go.
-
Thanks guys. I followed i0n0s' recommendation and used a dialog box. I've also modified the repair loop to abort if the dialog is closed, so it's nowhere near as "extreme" as I thought it was gonna be.
@hoz, I managed to get a fake progress bar working myself, but the only way I could update it was by repeatedly closing and opening the dialog with a new value. This made detecting the "abort" rather difficult. I gave up in the end cause I'm not too familiar with dialogs. If you know of a better way, I'd appreciate a heads up.
Thanks for all your help :good:
(I've attached the latest version if anyone is interested)
-
Trouble with a camera is that if he's attacked he's gonna get wasted. Wolfrug's idea to have a dialogue bar with a cancel option seems to be the way to go.
That's right, even though this could be avoided, but the overall effort is not worth it.
Dialog is definitely a way to go, mine was more of a reply towards blocking the controls in general :)
-
For the dialog:
Give him an IDD. Give an IDC to the 'progressbar'. Set OnShow to:
_display = findDisplay IDD;
_ctrl = _display displayCtrl IDC;
DAM_WaitDlg_Script = _ctrl spawn {
_pos = ctrlPosition _this;
_min = 0.3;
_max = 0.4;
_pos set [2, 0];
_this ctrlSetPosition _pos;
_this ctrlCommit 0.0;
_current = 0;
while {true} do {
_current = _current + 0.025;
if (_current > _max + 0.1) then {
_current = 0;
_pos set [0, _min];
_pos set [2, 0];
_this ctrlSetPosition _pos;
_this ctrlCommit 0.0;
} else {
_left = _current - 0.1;
if (_left < 0) then {
_left = 0;
};
_width = _current - _left;
if (_left + _width > _max) then {
_width = _max - _left;
};
_pos set [0, _min + _left];
_pos set [2, _width];
_this ctrlSetPosition _pos;
_this ctrlCommit 0.125;
};
sleep 0.125;
};
};and onClose to:
terminate DAM_WaitDlg_Script
Please note that you have to play with min and max since they are values I used for my control.
-
Thanks i0n0s, I'll have a play with this and see if I can integrate it into the repair script.
Edit: Thanks for your help i0n0s. Using your idea with the IDC values, I've now got a working progress bar! :good: