d3nn16 3 Posted October 26, 2007 Hi the problem : rearm.sqf: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ... removeAllWeapons player; ... ... case 2: { player switchMove "AmovPercMstpSrasWrflDnon"; for "_i" from 1 to 9 do {player AddMagazine "30Rnd_556x45_Stanag";}; player AddWeapon "M16A4"; player SelectWeapon "M16A4"; exit; }; ... the trigger: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ?alive player OnAct: nul = [WeaponLevel] execVM "rearm.sqf"; OnDeact: A player that (nervously) presses the kneel action key at respawn seems to interrupt the switchMove command that gives its avatar the body stance corresponding to the weapon he gets at respawn (rifle or pistol). So instead of starting with the M16A4 in his hands and kneeling with it (desired action) it performs an animation from "up with pistol in hands" stance to "knelt with pistol in hands" stance and with an invisible pistol and M16A4 on shoulder (undesired action). Solution idea : use the disableUserInput command. Unfortunately disableUserInput apparently doesn't work. rearm.sqf: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ... removeAllWeapons player; ... ... case 2: { player switchMove "AmovPercMstpSrasWrflDnon"; for "_i" from 1 to 9 do {player AddMagazine "30Rnd_556x45_Stanag";}; player AddWeapon "M16A4"; player SelectWeapon "M16A4"; exit; }; ... ... disableUserInput false; exit; the trigger: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ?alive player OnAct: nul = [WeaponLevel] execVM "rearm.sqf"; OnDeact: disableUserInput true; Anyone has some explanation for this ? Anyway I found an alternative : I create an invisible dialog (with movingEnable=false this one doesn't work either true or false player can't move) and close it (the mouse cursor is showed on the screen). Is there a solution that doesn't show the cursor ? Share this post Link to post Share on other sites
Master85 1 Posted October 27, 2007 userDisableInput => disableUserInput Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted October 27, 2007 Yeah, helps to make sure that you're actually using a command that exists. Don't feel bad though, I'm sure we've all made a similar mistake several times. hmmm.... is it player removeAllWeapons or removeAllWeapons player... Share this post Link to post Share on other sites
d3nn16 3 Posted October 27, 2007 I didn't write the command name well in the post, it was past midnight but in the scripts it was written correctly (I know it because at a moment I put only DisableUserInput true and it worked had to ALT+F4) Share this post Link to post Share on other sites
celery 8 Posted October 27, 2007 First of all, have you had the pistol crouching yourself? Because if you have only seen it online by other players, you should know that the switchmove command is always transmitted as playmove over the net, making some clever-meant things look pretty silly. That would also mean that there is no real problem if they automatically switch to rifle after kneeling. I know this first hand because in some of my switchmove using maps the other players seem to take forever grabbing their weapon but in reality they are fully capable of firing their guns because on their screen they had it ready as they spawned. Share this post Link to post Share on other sites
d3nn16 3 Posted October 27, 2007 I reproduced the same animation I observed for the other players. When respawn countdown is near 1 I press crouch several times and the result is crouched with invisible pistol in hands and rifle on shoulder. When I press fire mouse button the finger moves in the air and the rifle on shoulder fires toward the sky. What intrigues me most is why isn't disableUserInput working when used in a trigger and in a script. When I delete the disableUserInput command in the trigger it works in the script (when put to true), but I didn't test all combinations (needs to restart game several times). Does the disableUserInput work for you when used in multiple scripts and triggers ? Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted October 28, 2007 You know what? it would probably be easier to treat the symptom by forcing the player into a neutral animation state after respawn. Try using switchmove to make them standing with no weapon drawn or something . Share this post Link to post Share on other sites
d3nn16 3 Posted October 28, 2007 I don't trust switchMove or playMove being sent over the net to other players, this could give some unexpected results. Instead I'm looking for a way to block the player's input for a short time that goes from just before he respawns to after the rearm script has executed addWeapon, selectWeapon, switchMove commands. I tried putting disableUserInput at both ends of rearm.sqf but I can still reproduce the crouching with pistol animation. Share this post Link to post Share on other sites
sbsmac 0 Posted October 28, 2007 I've tried using the disableUserInput command triggered by an onPlayerKilled event. It works fine (I'd suggest you try placing it in the rearm script rather than the trigger deactivation). However, I eventually moved away from this because disableuserInput can still pick up some 'legacy' input. Eg, I often found that if the user was moving the cursor quickly at the time they were killed, the players cursor would be drifting when they respawned. Here's an edited version of the code I used ... rearmOnSpawn = { disableUserInput true ; waituntil {alive player} ; call rearm ; sleep 10 ; disableUserInput false ; } ; player addEventHandler ["KILLED",{[] spawn {call rearmOnSpawn}}]; Share this post Link to post Share on other sites
d3nn16 3 Posted November 1, 2007 I tried your solution sbsmac respawnOnRearm.sqf : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">waitUntil {alive player}; call compile preprocessFile "rearm\rearm.sqf"; exit; init.sqf : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player addEventHandler ["KILLED",{execVM "rearm\rearmOnSpawn.sqf"}]; This seems to work even without the disableUserInput (I couldn't reproduce the crouching with pistol anymore). In the wiki it is said that a function interrupts the script/function which called it and it is excuted very fast. Does this mean that the user input is taken into account only before or after the function execution period ? Or does it execute so fast that it is done between two user inputs easily ? Share this post Link to post Share on other sites