OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Odin on 20 Jul 2008, 14:46:06

Title: Kill Crew not Vehicle
Post by: Odin on 20 Jul 2008, 14:46:06
 :dunno: G'day I just cant seem to get this to work for me. I can kill a men using this
Code: [Select]
_seek = random 100
_xx = (getMarkerPos "gas" select 0)
_yy = (getMarkerPos "gas" select 1)

_veharray = [_xx,_yy,0] nearObjects ["Man", (25 + _seek)]
{_x setdammage ((getdammage _x) + 1)} forEach _veharray

But when I try to kill crew members of  Vehicles using this
Code: [Select]
_array1 = [_xx,_yy,0] nearObjects ["Vehicle", (100 + _seek)]
{_x setDammage 1} forEach (crew _array1);

I just get this error
Quote
'{_x setdamage 1} foreach (|#|(crew _array1);' error crew: Type Array, expected Object

Any Ideas?

Thx Odin
Title: Re: Kill Crew not Vehicle
Post by: Spooner on 20 Jul 2008, 15:06:18
_array1 is a list of vehicles, not a vehicle itself. Thus, you need to iterate through it, then iterate through the crew using two separate forEach loops.
There isn't a class called "vehicle", instead use "AllVehicles" (which includes infantry). Remember also that men on foot have a single crewman (that is, themselves!).
Code: (kill all men, on foot or in vehicles) [Select]
_array1 = [_xx,_yy,0] nearObjects ["AllVehicles", (100 + _seek)]
{ { _x setDammage 1} forEach (crew _x) } forEach _array1;
Title: Re: Kill Crew not Vehicle
Post by: Odin on 21 Jul 2008, 13:13:22
Thanx again Spooner, that works great  :good:

Cheers
Odin