OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started 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
-
Try "Weaponholder", not sure if it will work though, worth a try.
Planck
-
Tried that while you answered, no luck :no:
Well it works, but not as I want to, see first post.
-
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
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];
};
-
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
-
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: