OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started 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
_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
_array1 = [_xx,_yy,0] nearObjects ["Vehicle", (100 + _seek)]
{_x setDammage 1} forEach (crew _array1);
I just get this error '{_x setdamage 1} foreach (|#|(crew _array1);' error crew: Type Array, expected Object
Any Ideas?
Thx Odin
-
_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!).
_array1 = [_xx,_yy,0] nearObjects ["AllVehicles", (100 + _seek)]
{ { _x setDammage 1} forEach (crew _x) } forEach _array1;
-
Thanx again Spooner, that works great :good:
Cheers
Odin