Bobcat26 0 Posted November 7, 2007 I'm having trouble getting any of these scripts to work in my mission removedead.sqs _unit = _this select 0 ~90 deletevehicle (vehicle _unit) exit or killed.sqs _unit = _this select 0 ~0+(random 10) deleteVehicle _unit exit I made a trigger to activate this script with this on the onactivation line [] exec "removedead.sqs" But I cant get them to work any help would be greatly appreciated Or a working remove dead bodies Share this post Link to post Share on other sites
sanctuary 19 Posted November 7, 2007 Try this : In the init line of an AI soldier put <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addeventhandler [{killed} , {[this] exec {removedead.sqs}}] and the removedead.sqs <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 _unit removealleventhandlers {killed} ~90 deletevehicle _unit exit By adding the eventhandler in the init line of the AI soldier, once this AI soldier is considered as "killed" by the game, it will launch the script that will remove its body 90 seconds after that (and will remove the eventhandler given to it, to avoid some possible script conflicts). Share this post Link to post Share on other sites
Bobcat26 0 Posted November 7, 2007 Thanks Sanctuary I added that into the init line of the unit But it only seems to work for a single unit I tried it with five enemy units only one of them would vanish ... same thing as a group I was hoping to find a script that would delete all the dead guys from the map after they were killed I have been using the old fashion method using a trigger with the deletevehicle x1;deletevehicle x2 but thats a pain and quite messy I've seen this method working in the DAC and some other mission along the way with all these removedead scripts that were hard to find why don't they function in this way I'm baffled I spent a couple days and searched for two hours today and found more then enough posts of people asking the same question over and over only to be told ...do a search ......its already been answered but where..."?" why not just answer the questions and save time and space but I thank you Sanctuary for your fast reply thanks again anymore Ideas :-) Share this post Link to post Share on other sites
ProfTournesol 956 Posted November 7, 2007 Mmmh i see, you haven't launched the script on all units. just put a trigger covering the whole map, activated once by anybody, and type this in the "on activation" line : <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 {removedead.sqs}}]" foreach thislist Share this post Link to post Share on other sites
sanctuary 19 Posted November 7, 2007 Thanks SanctuaryI added that into the init line of the unit But it only seems to work for a single unit I tried it with five enemy units only one of them would vanish ... same thing as a group In my explanation, i thought it was clear that the deletion was valid only for the soldier that has the init line. So if you wanted more soldiers to be deleted, you just had to add <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addeventhandler [{killed} , {[this] exec {removedead.sqs}}] in the init line of every soldiers you want to disappear once killed. Or just use the global trigger from ProfTournesol that automatically add this init line to every soldier covered by it, but in that case be carefull so none of the soldiers you want to keep on the field is affected by the trigger. Share this post Link to post Share on other sites
Bobcat26 0 Posted November 7, 2007 thanks very much guys Sanctuary I did put that code in each guys init line as a group and then individually but only one unit would be deleted the others with the same code never dissapeared ? thanks again I will give it another go Share this post Link to post Share on other sites
Bobcat26 0 Posted November 7, 2007 Wow thanks so much Protouenesol Worked like a charm I can't tell ya how long I've tried to get this easy little trick to work Share this post Link to post Share on other sites
ProfTournesol 956 Posted November 8, 2007 Quote[/b] ]I can't tell ya how long I've tried to get this easy little trick to work Yep, that's the way we all learnt how that nice little game is working... Share this post Link to post Share on other sites
felingard 10 Posted December 11, 2020 Can't find where to delete my reply. Please ADM delete this reply. Share this post Link to post Share on other sites