biohaz 0 Posted October 16, 2003 I have looked everywhere, I need a script that deletes dead bodies after __ seconds. This goes on a map that is basically a 4v4 war there are a TON of bodies on the ground. These are player bodies. I need a script to delete the bodies and the equitment that was on them when they died. I have searched here and ofpec.com, but alas found nothing. ofpec had a script that said it deleted bodies but it didnt work. Dose anybody know where to find a script that dose this? Thank you. Share this post Link to post Share on other sites
RED 0 Posted October 16, 2003 Add a killed eventhanlder to each unit on the map, you might want to use something like this in a trigger (max size, anyone present): <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"_x addEventHandler [""Killed"", {_this exec {delunit.sqs}}]" forEach thislist Then use a script something like: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _unit = _this select 0 ~10 deleteVehicle _unit exit RED Share this post Link to post Share on other sites
biohaz 0 Posted October 17, 2003 that didnt work, player bodies still did not get deleted I made a trigger activated by anyone radius 1000x1000 on act. "_x addEventHandler [""Killed"", {_this exec {delunit.sqs}}]" forEach thislist and i put these in there inti lines <- was this right also shopuld the respawn be more or less that 10 seconds.. (~10 delay) Share this post Link to post Share on other sites
killswitch 19 Posted October 17, 2003 that didnt work, player bodies still did not get deletedI made a trigger activated by anyone radius 1000x1000 on act. "_x addEventHandler [""Killed"", {_this exec {delunit.sqs}}]" forEach thislist Correct Quote[/b] ]and i put these in there inti lines <- was this right You put what where? Answer with sentence(s) containing punctuation. Quote[/b] ]also shopuld the respawn be more or less that 10 seconds.. (~10 delay) The "~10 delay" has nothing to do with the respawn delay you set for your mission. The delay in the script snippet above determines how long a body remains before getting removed. PS. Now, you did put RED's script example into a script named "delunit.sqs", right? Share this post Link to post Share on other sites
biohaz 0 Posted October 17, 2003 I added this to each unit. "_x addEventHandler [""Killed"", {_this exec {delunit.sqs}}]" forEach thislist * I think this dosnt matter/work - its the trigger The script worked, it deleted the AI bodies and the AI from the game, it also deleted the dead vehicals. But player bodies stayed. i know the ~10 is for the script delay but the respawn being more/less than 10 sec dosnt do anything Share this post Link to post Share on other sites
killswitch 19 Posted October 17, 2003 I added this to each unit. "_x addEventHandler [""Killed"", {_this exec {delunit.sqs}}]" forEach thislist * I think this dosnt matter/work - its the trigger Aha! You only need to put that line into the "On activation" field of the trigger. (It makes no sense to put that particular line into a unit's init line) Quote[/b] ]The script worked, it deleted the AI bodies and the AI from the game, it also deleted the dead vehicals. But player bodies stayed. Ok, got it. Two problems here and two easy solutions. First, in order to only have soldiers and not vehicles deleted you need to change the trigger line above to <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> {if ( "Man" countType [_x] == 1) then {_x addEventHandler ["killed",{_this exec "delunit.sqs"}] } } forEach thislist Also, when players respawn, the EH:s they had when the mission started (thanks to the trigger above) will be lost, so we need to add new EH:s to the newly respawned soldiers. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ; ; respawnmonitor.sqs ; ; Description: adds a "killed" event handler named "delunit.sqs" to certain respawned units ; ; Usage: ["unitname"] exec "respawnmonitor.sqs" ; ; How *not* to use it: [unitname] exec ... ; Also, dont do this: unitname exec... ; ; Example: ; You have a 4 vs 4 MP game. Name all west units "w1", "w2" and so on ; and the east units in a similar way can be named "e1", "e2",... ; ; In init.sqs, have the following: ; ; _wdudes = ["w1","w2","w3","w4"] ; _edudes = ["e1","e2","e3","e4"] ; _dudes = _wdudes + _edudes ; ; {[_x] exec "respawnmonitor.sqs"} forEach _dudes ; ; ; Notes: Script inspired by toadlife's "Universal Weapons Respawn script" ; (Can be found on OFPEC, http://www.ofpec.com/ ) ; _name = _this select 0 #checklocal _unit = call format ["%1",_name] ?local _unit:goto "respawnloop" ~(1 + (random 3)) goto "checklocal" #respawnloop // Just wait 'til its dead @!alive _unit #waitforlife @alive call format ["%1",_name] _unit = call format ["%1",_name] // Re-attach a killed EH to the newly respawned _unit addEventHandler ["killed",{_this exec "delunit.sqs"}] goto "respawnloop" As you can see, I included instructions on how to use and employ this script in the code itself. Too tired to repeat it here... Quote[/b] ]i know the ~10 is for the script delay but the respawn being more/less than 10 sec dosnt do anything Exactly Share this post Link to post Share on other sites
biohaz 0 Posted October 18, 2003 thanks dude it worked! I thank you very much! Share this post Link to post Share on other sites