Jump to content
Sign in to follow this  
bob1787

deleting bodies

Recommended Posts

i have got a script that spawns in new people at spawn locations then i use a place holder group leader with "dostop this" in his init line so that he can't get killed

the problem is that i use this event handler

<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

with the delete script that accompanies it

<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

i got this from This post

it works fine without them respawning but when they do it just leaves them there, any suggestions on how to delete the bodies?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_GroupsArray = _this select 0

_SpawnArray = _this select 1

_NGRPS = count _groupsarray

_NSPWN = count _spawnarray

_GY = 1

_GX = 1

_O4 = 0

_GSI = 0

_OPFOR = ["WYW_Civ_LSE2HD","WYW_Civ_SSE2HD","WYW_Civ_LSEM2HD"]

_OPFOR = _OPFOR + ["WYW_Civ_SSEM2HD","WYW_Mix_LSEM2HD","WYW_Mix_SSEM2HD","WYW_Urban_LSE2HD"]

#fillgroup

? _GX >= _NGRPS : _GX = 0

? _GSI == _NSPWN : _GSI = 0

? _GY = 12 : _GY = 0

? _O4 == 7 : _O4 = 0

_OPFOR select _O4 createunit [(getpos (_spawnarray select _GSI)), (_GroupsArray select _GX)]

~1

;hintC format ["%1 - %2 - %3", _spawnarray select _GSI, _GroupsArray select _GX, _OPFOR select _O4]

player sidechat format ["%1 - %2 - %3", _O4, _GSI, _GX]

_GY = _GY + 1

_GX = _GX + 1

_O4 = _O4 + 1

_GSI = _GSI + 1

;hintC format ["%1 - %2 - %3 - %4 - %5", _GX, _GY, _spawnarray select random _NSPWN, _groupsarray select _GX, _OPFOR select random 6]

goto "fillgroup"

Share this post


Link to post
Share on other sites

Are you adding the eventhandlers to the newly created units? If not then it will not be activated. Have you tried:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_OPFOR select _O4 createunit [(getpos (_spawnarray select _GSI)), (_GroupsArray select _GX)]

_LastMan = (count (_GroupsArray select _GX)) - 1

_LastMan addEventHandler ["Killed", {_this exec "delunit.sqs"}]

Why is that script constantly looping? Why not trigger unit creation from your body remover script?

Looking at your script, the _OPFOR + _OPFOR is not needed, why not use:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_OPFOR = ["WYW_Civ_LSE2HD","WYW_Civ_SSE2HD","WYW_Civ_LSEM2HD","WYW_Civ_SSEM2HD","WYW_Mix_LSEM2HD","WYW_Mix_SSEM2HD","WYW_Urban_LSE2HD"]

RED

Share this post


Link to post
Share on other sites

There is a script called AI on demand, it will allow you to use your killed eventhandler with units that get spawned.

You can check the thread i made when i had the same problem and got my answer here

Hope this helps unclesam.gif

Share this post


Link to post
Share on other sites

could i create new leaders and set there waypoints in scripts to simplify the event handlers?

Share this post


Link to post
Share on other sites

With AI on demand you can set as many squads you want with whatever waypoints you want on the battlefield and then when the mission starts it removes them and places them in limbo waiting to be called back to the field.

You can take a look at my work in progress mission "Charlie Mike" in the user missions section to see how i implemented it. Just make sure you have the depbo tool first.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×