OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: laggy on 07 Aug 2009, 20:24:57

Title: nearestObject "weapon" possible?
Post by: laggy on 07 Aug 2009, 20:24:57
Hello all,

In a mission I want a trigger to recognize when a weapon (dropped by player) is near a unit.
So far I haven't succeeded.
Does anyone know if it is possible?
Is a weapon model even recognized as an object?
This is what I have, and it doesn't work.

Condition: nearestObject [myUnit, "m16a4"] distance myUnit <= 3

If I do: nearestObject [myUnit, "weaponholder"] distance myUnit <= 3

The trigger fires as soon as you open gear menu, which is not OK for my idea.

Thanks in advance my fellow colleagues,

Laggy
Title: Re: nearestObject "weapon" possible?
Post by: Planck on 07 Aug 2009, 20:27:35
Try "Weaponholder", not sure if it will work though, worth a try.


Planck
Title: Re: nearestObject "weapon" possible?
Post by: laggy on 07 Aug 2009, 20:28:51
Tried that while you answered, no luck  :no:

Well it works, but not as I want to, see first post.
Title: Re: nearestObject "weapon" possible?
Post by: jones on 08 Aug 2009, 01:49:19
I don't think what you want to do is possible. I tested it in a loop and had to use weaponholder to detect the weapon and the model comes back as "dummyweapon".

Code I used
Code: [Select]
while {true} do{
_mypos = position player;
_weapons = _mypos nearObjects ["weaponholder", 10];
_HMMWV = _mypos nearObjects ["HMMWV", 10];
_weapondis = _mypos distance _weaponpos;
Hintsilent format ["Mypos %1\n Rifles %2\n HMMWV %3", _mypos, _weapons,_HMMWV];

};
Title: Re: nearestObject "weapon" possible?
Post by: laggy on 08 Aug 2009, 09:11:49
Thanks jones,

Yeah, it seems like nearestObject doesn't recognize weapon models, too bad.
I have found a workaround, but the solution I wanted, would have been better.

Laggy
Title: Re: nearestObject "weapon" possible?
Post by: nominesine on 11 Aug 2009, 14:09:34
the model comes back as "dummyweapon".

I'm not sure what you're trying to do here laggy, but if the aforementioned script returns "dummyweapon", wouldn't it then be possible to check the distance between the unit and the nearest "dummyweapon"?!?

 :dunno: