SilentSpike 84 Posted May 25, 2014 Here's what I have: _unit addMPEventHandler ["MPKilled", { _unit = (_this select 0); sleep 120; hideBody _unit; sleep 5; deleteVehicle _unit; _unit removeMPEventHandler ["MPKilled", 0]; }]; It's intended to wait 2 minutes after a unit is killed and then hide the body before deleting it. Oh and I should note that _unit is declared before the event handler. Unfortunately this is giving me an error and I have a suspicion that it's because the killed unit argument is not actually the same unit as the dead body. This is the error I'm getting: "Error generic error in expression". It's marking it right before the 5th line (sleep 5). Here's the Biki entry on the event handler, any ideas on how to achieve what I'm looking for? ---------- Post added at 20:46 ---------- Previous post was at 20:42 ---------- Sure enough I find a solution I hadn't thought of right after posting this. I believe if I simply set corpseRemovalMaxTime to 2 minutes then it should give me what I'm looking for. Doh. :p Share this post Link to post Share on other sites
champ-1 40 Posted May 25, 2014 You can't make eventhandlers sleep or wait. You have to spawn your code: _unit addMPEventHandler ["MPKilled", { _unit = (_this select 0); [_unit] spawn { _unit = _this select 0; sleep 120; hideBody _unit; sleep 5; deleteVehicle _unit; _unit removeMPEventHandler ["MPKilled", 0]; }; }]; ---------- Post added at 20:55 ---------- Previous post was at 20:51 ---------- More info here: http://killzonekid.com/arma-scripting-tutorials-code-performance/ Share this post Link to post Share on other sites
SilentSpike 84 Posted May 25, 2014 Ah, that's good to know for future use, thanks :) Share this post Link to post Share on other sites
Tankbuster 1747 Posted May 25, 2014 Or this.. https://community.bistudio.com/wiki/BIS_fnc_runLater Share this post Link to post Share on other sites
barbolani 198 Posted May 26, 2014 Or calling an external script with the EH params, with sleeps, deletevehicle and all the stuff... Share this post Link to post Share on other sites
cuel 25 Posted May 26, 2014 You can add this in the description.ext //Corpse limit before which ( <= ) corpseRemovalMaxTime applies and after which ( > ) corpseRemovalMinTime applies (see below). corpseLimit = 1; //Default value: 15 //Maximum time a corpse can remain on the ground if total number of corpses is equal or under corpseLimit. corpseRemovalMaxTime = 1200; //seconds //Default value: 3600 //Remove all bodies that have been dead longer than corpseRemovalMinTime when corpseLimit is breached. corpseRemovalMinTime = 60; //seconds //Default value: 10 ---------- Post added at 10:54 AM ---------- Previous post was at 10:53 AM ---------- Oh you want it to hide. Don't know if that happens when using the above. Share this post Link to post Share on other sites