Hi all
I'm using the nearestobject command to allow a gang of civilians to roam the countryside hunting down soldiers and killing them. Should be a fun map but I'm having a bit of a problem with setting the nearestobject command to recognise a west soldier.
Here's the idea in rough code:
------------------------------------------------
_client = this select 0
#hunt
~0.5
_clientpos = getpos _client
_target = nearestobject [_client,"wsoldier"]
_targetpos = getpos _target
_client move _targetpos
#move
~0.5
_targetdis = _client distance _target
?!(alive _target):goto "hunt"
?(_targetdis <20):goto "kill"
goto "move"
#kill
~0.5
_client dofire _target
?!(alive _target):goto "hunt"
goto "kill"
--------------------------------------
It's probably not completely correct above but you get the idea.
so in the line:
_target = nearestobject [_client,"wsoldier"]
I understand that you should place the object class that you wish to search for. Is that right?
"wsoldier" is apparently a valid object yet when I check to see the value returned it only tells me that it couldn't find anything. Even though I have 5 of the bastards in my map.
They do find "civilian2" though and "civilian".
Any Ideas would be really good.
Oh and also is there a way to make the nearestobject command search through an array of object classes rather than just one?
Thanks
aaz