Jump to content
Sign in to follow this  
kittycat

Removing dead units

Recommended Posts

I want to remove every dead unit on the field when a triggre is fired? (v1.46)

Share this post


Link to post
Share on other sites
I want to remove every dead unit on the field when a triggre is fired? (v1.46)

you'll need two scripts, one trigger, one variable, groups and abit of patients.

we start with the trigger

set it to the values you want

then in the onactivation: yourtriggervariable=true

then the groups

in the initline of each of the officers

groupX=group this;[groupX] exec "placedead.sqs"

do this for all groups in the game, replace x with an number(postfix?)

placedead.sqs:

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

?!(local Server): exit

_group = _this select 0

;;for the loop below, to see how many times it will iterate over the array(group)

_count = count units _group

_x1=0

#Loop

[(units _group select _x1)] exec "removedead.sqs"

~0.2

_x1 = _x1 + 1

?(_x1 < _count): goto "Loop"

exit

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

;;wait here until someone entered the trigger

@yourtriggervariable

;;oly if the unit is dead

@!(alive _unit)

;;move it, as OFP doesn't allways respond to the command below(deleteVehicle), in this way we get rid of it anyway as it doesn't need to be rendered.

_unit setPos [0,0,0]

;;wait one second

~1

;;delete it

deleteVehicle _unit

exit

hope this helps-

[ edit]

perhaps this will work as well,

keep your "delete dead" trigger from above.

and keep your "removedead.sqs" script.

place another trigger,

x: 1000 y: 1000

(so it covers all the combatarea)

activation:anybody

min: 1,

(so it waits one second)

condition: this

onActivation: [thislist] exec "whatever.sqs"

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

_trigger = _this select 0

_list = list _trigger

_count = count _list

_x1=0

#Loop

[(_list select _x1)] exec "removedead.sqs"

~0.2

_x1 = _x1 + 1

?(_x1 < _count): goto "Loop"

this should work I hope, hasn't tried it.

however, it has one limitation, it will only work once, not if you respawn groups again, then you'll need the example above

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  

×