Home   Help Search Login Register  

Author Topic: nearestObject "weapon" possible?  (Read 2882 times)

0 Members and 1 Guest are viewing this topic.

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
nearestObject "weapon" possible?
« 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
« Last Edit: 07 Aug 2009, 20:30:23 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: nearestObject "weapon" possible?
« Reply #1 on: 07 Aug 2009, 20:27:35 »
Try "Weaponholder", not sure if it will work though, worth a try.


Planck
I know a little about a lot, and a lot about a little.

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: nearestObject "weapon" possible?
« Reply #2 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.
« Last Edit: 07 Aug 2009, 20:47:31 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline jones

  • Members
  • *
Re: nearestObject "weapon" possible?
« Reply #3 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];

};

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: nearestObject "weapon" possible?
« Reply #4 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
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re: nearestObject "weapon" possible?
« Reply #5 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:
OFPEC | Intel Depot
RETARDED Ooops... Retired!