odyseus 19 Posted December 28, 2012 Hello guys, I guess the title says it all. I need a way to prevent players from going prone and standing up, while a script is being performed. I was thinking that maybe disabling temporarily the Z and C keys, would it do it? What do you guys think? Is there a better way? If so what would it be? If not how would I go about disabling those keys? Thank you! :D Share this post Link to post Share on other sites
roguetrooper 2 Posted December 28, 2012 You need a functions module on the map and you need to look up the proper animation name. disableuserinput true; [objNull, player, rSWITCHMOVE, "InsertYourAnimationHere"] call RE; ~60 (endurance of your cutscene) disableuserinput false; Not tested. Be sure to get the userinput enabled again. Otherwise you need to close the game completely. Maybe with a timed trigger that is independend from the script. Share this post Link to post Share on other sites
odyseus 19 Posted December 28, 2012 Thank you Trooper! I will tested ASAP, but wouldn't the disableuserinput disable most of the keys, including the ESC key? Another key, could i remove the line ~60 (endurance of your cutscene) and just set it to false when it needed for example by a trigger? Share this post Link to post Share on other sites
tryteyker 27 Posted December 28, 2012 User input will stay disabled until you use disableuserinput false, you just have to make sure you use that. It shouldn't matter much how you execute disableuserinput false, just that you execute it. Share this post Link to post Share on other sites
odyseus 19 Posted December 28, 2012 That sounds good but does it disable all inputs like mouse and all keys on keyboard? I m only asking these because for what i m trying to do i will need some of the keys to be available like mouse action and maybe some keys on the keyboard. Thank you Share this post Link to post Share on other sites
tryteyker 27 Posted December 28, 2012 "Disable and enable the keyboard and mouse input, usually used during cutscenes. Be careful with the usage of this command, always remember to enable the user input again, as once the user input is disabled, you can only shut down OFP but not exit the mission with escape." From the BIKI, so yes, it disables everything. Share this post Link to post Share on other sites
iceman77 14 Posted December 28, 2012 I don't think there's a way for players to run around without being able to use crouch/prone Share this post Link to post Share on other sites
odyseus 19 Posted December 28, 2012 So disable input is defensibility not it! Is there another work around this? Remenber for me would be enough just to disable a couple of keys (Z,X,C). Thank you Tryteyker and roguetrooper. :D Share this post Link to post Share on other sites
iceman77 14 Posted December 28, 2012 Don't use the keys then! LOL. Tell your friends not to use prone/crouch. i seriously doubt there's a way to disable certain keys. Share this post Link to post Share on other sites
odyseus 19 Posted December 29, 2012 Hahahahah! I know my friends they will not listen to me! :D Well fine someone find a possible solution please let me know. ;D Thank you! ---------- Post added 12-29-2012 at 12:23 AM ---------- Previous post was 12-28-2012 at 11:03 PM ---------- I just had an idea! What about replacing the key the key action to another action? Maybe the ESC action! Is this doable ? Share this post Link to post Share on other sites
iceman77 14 Posted December 29, 2012 how about detecting if a unit is either prone or crouched and force them to stand up somehow. I know setunitPos "up" is for ai only... maybe another way, such as an animation of some sort. Share this post Link to post Share on other sites
roguetrooper 2 Posted December 29, 2012 How can you be sure that everybody that plays the map, uses certain keys for certain actions/movements? When it is a cutscene, why should you want anybody to do anything meanwhile? I'd prefer disableuserinput with a trigger/timer that certainly enables the input again independendly from the cutscene code (in case anything goes wrong executing it). One strange thing about disableuserinput however is, that the camera movement goes on (at least some time ago, don't know if it has been fixed meanwhile). Might be fixable with camera stuff a hundredth second before the scene starts. Share this post Link to post Share on other sites
f2k sel 145 Posted December 29, 2012 (edited) I have come across a way to disable the keys/actions so it should apply to everyone even if they change the keys. However there are a few issues the main problem is that I don't have a clue how it works. I copied it from here, http://forums.bistudio.com/showthread.php?142857-Disable-commanding-mode-script&p=2258935&viewfull=1#post2258935 It didn't actually work and had a lot of other stuff that wasn't relevant however I have managed to get it working. We could really do with this making into a nice script where you could just pass the actions you want to prevent rather than having to code it every time. I'm also not sure how it will work in MP. call with null=[] execvm "disable.sqf"; If you start standing the only option is to crouch after that you won't be able to go prone or stand. // null=[] execvm "disable.sqf"; if (isNull player) exitwith {} ; CMbindings = []; keybindings = []; keybindings1 =[]; CTF_disableCommandMode=true ; updateKeyBindings = { while {true} do { //DBG [time,"keys"] ; if (CTF_disableCommandMode) then { CMbindings = actionKeys "ForceCommandingMode"; } ; keybindings = actionKeys "Prone"; keybindings1 = actionKeys "Stand"; sleep 2; }; }; //fireButtonDown=false; dokeyDown={ private ["_r"] ; _r = false ; if ((_this select 1) in CMbindings) then { hint "Command mode disabled" ; _r=true; }; if ((_this select 1) in keybindings or (_this select 1) in keybindings1) then { // removed code _r=true; }; _r; } ; dokeyUp={ private ["_r"] ; _r = false ; if ((_this select 1) in keybindings or (_this select 1) in keybindings1) then { // removed code _r = true; }; _r ; } ; // //I don't know why a delay is necessary :-( sleep 0.5; (FindDisplay 46) DisplaySetEventHandler [ "keydown", "_this call dokeyDown" ]; (FindDisplay 46) DisplaySetEventHandler [ "keyup", "_this call dokeyUp" ]; //(FindDisplay 46) DisplaySetEventHandler ["mousebuttondown","fireButtonDown=true;"] ; //(FindDisplay 46) DisplaySetEventHandler ["mousebuttonup","fireButtonDown=false;"] ; [] call updateKeyBindings ; ---------- Post added at 06:17 PM ---------- Previous post was at 04:39 PM ---------- After doing some more testing I've refined it a little and now have a little understanding of what it does. It seems that it detects what key has been pressed and then forces the reverse of the key so it appears to have disabled the key but it hasn't, the effect is that it looks like the key hasn't been pressed though. // list of keys you can use //http://community.bistudio.com/wiki/ArmA_2:_CfgDefaultKeysMapping // // Example the folowing keys should now not work // null=[["Prone","Stand","reloadMagazine","getOver"]] execvm "disable.sqf"; // if (isNull player) exitwith {} ; _boundkeys = _this select 0; keybindings = []; { keybindings = keybindings + [(actionKeys _x) select 0] } foreach _boundkeys; dokeyDown={ private ["_r"] ; _r = false ; if ((_this select 1) in keybindings) then { // removed code hint "down"; _r=true; }; _r; } ; dokeyUp={ private ["_r"] ; _r = false ; if ((_this select 1) in keybindings) then { // removed code hint "up"; _r = true; }; _r ; } ; //I don't know why a delay is necessary :-( sleep 0.5; (FindDisplay 46) DisplaySetEventHandler [ "keydown", "_this call dokeyDown" ]; (FindDisplay 46) DisplaySetEventHandler [ "keyup", "_this call dokeyUp" ]; Edited December 29, 2012 by F2k Sel Share this post Link to post Share on other sites
Kempco 10 Posted December 30, 2012 Ran into this with my HALO script. disableUserInput can be risky, also I ran into issues with its dependability since there is no way to check the Input status of a player. Also, if the player happens to be moving the mouse at the moment the disableUserInput is executed, he will get stuck spinning in circles unttill Input is restored. Instead try using the following _unit enablesimulation false. Status can be verified using simulationEnabled _unit. The players avatar will not be allowed to play any animations, i.e. turn, walk,prone, blink, ect, but he will still be able to use things like the mouse wheel esc key ect. Keep in mind, the player will not be able to move at all untill simulation is restored. Share this post Link to post Share on other sites
odyseus 19 Posted December 30, 2012 hey f2k i will try to implement it into the script. Thank you! @Kempco can you still fire and reload while in enablesimulation? Share this post Link to post Share on other sites
Kempco 10 Posted December 31, 2012 hey f2k i will try to implement it into the script. Thank you! @Kempco can you still fire and reload while in enablesimulation? No. the unit essentially gets "frozen" in its most recent animation. I have noticed that light sources created by logics (post init) have no effect on units while in this state. Share this post Link to post Share on other sites