OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Aglon on 04 Jul 2007, 23:57:52

Title: Delevehicle in Array except the leader?
Post by: Aglon on 04 Jul 2007, 23:57:52
Hello All.
I'm not new to Ofpec but i forgot my old password :whistle: and my old email is gone too.
Now that i finally got a pc cabable of running ArmA back i'm in mission making :D

I got a little problem with deleting units in a group, i want all units deleted exept the groupleader but this little script doesn't work ???

_lead = _this select 0
_grp = group _lead
_units = units group _lead
_units = _units - [leader _grp]

#loop
? leader _grp distance player > 900 : goto "next"
~5
goto "loop"

#next
"deleteVehicle _x" foreach _units

I keep getting an error saying something with a string where code is expected ???

Is something changed since Ofp or have i overlooked something here halv drunk and tired? :D

Title: Re: Delevehicle in Array except the leader?
Post by: Mandoble on 05 Jul 2007, 00:20:43
it is not ending in .SQF right?
Title: Re: Delevehicle in Array except the leader?
Post by: Aglon on 05 Jul 2007, 00:28:59
Nope .sqs, sqf is functions right? which is way to advanced for me :)
Title: Re: Delevehicle in Array except the leader?
Post by: Mandoble on 05 Jul 2007, 00:59:47
Not really, SQF now is script too.

Change " by { and } in the foreach

{deleteVehicle _x} foreach _units
Title: Re: Delevehicle in Array except the leader?
Post by: Aglon on 05 Jul 2007, 01:08:56
Heh thanks alot, that did it :D