scifer 10 Posted June 4, 2011 I'm implementing an excitability system to my script MoodJukebox and this is an excerpt: player setVariable ["stress", 0]; player addEventHandler ["firedNear", { player setVariable ["stress", (player getVariable "stress") + 1]; hintSilent format ["%1", player getVariable "stress"]; } ]; So each time the player shoots an increasing number is displayed. The problem is that it only works while on foot and as soon as I board any vehicle it doesn't work anymore :( What do I do? Share this post Link to post Share on other sites
demonized 20 Posted June 4, 2011 (edited) maybe because firedNear eventhandler does not register that player is in vehicle, maybe check if player is in vehicle and add eventhandler to vehicle then remove it once player exits vehicle.. if you get where im going... Edit: player setVariable ["stress", 0]; player addEventHandler ["firedNear", { player setVariable ["stress", (player getVariable "stress") + 1]; hintSilent format ["%1", player getVariable "stress"]; }]; while {true} do { waitUntil {(vehicle player) != player}; _veh = (vehicle player); _idx = _veh addEventHandler ["firedNear", { player setVariable ["stress", (player getVariable "stress") + 1]; hintSilent format ["%1", player getVariable "stress"]; }]; waitUntil {(vehicle player) != _veh}; _veh removeEventHandler ["firedNear", _idx]; }; edit2: ah you got it working. Edited June 4, 2011 by Demonized Share this post Link to post Share on other sites
scifer 10 Posted June 4, 2011 maybe because firedNear eventhandler does not register that player is in vehicle, maybe check if player is in vehicle and add eventhandler to vehicle then remove it once player exits vehicle.. Thanx a lot. It worked :) Share this post Link to post Share on other sites