Home   Help Search Login Register  

Author Topic: Active Weapon?  (Read 567 times)

0 Members and 1 Guest are viewing this topic.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Active Weapon?
« on: 27 Nov 2004, 08:24:41 »
Can I detect which weapon a guy is holding ready to fire?

primaryWeapon does not work.  That just tells me which one he has, but the result is the same if he has it on his back or if he has it in his hands.

Specifically I want to know:
- does he have a primary weapon in hand (say "m16")
- does he have a secondary weapon in hand (handgun)
- or does he have nohing in hand.

I have looked through comRef but I may have missed something.
« Last Edit: 25 Sep 2005, 18:03:40 by THobson »

Offline Blanco

  • Former Staff
  • ****
Re:Active Weapon?
« Reply #1 on: 27 Nov 2004, 09:38:23 »
I don't think you can.

I think the only way is via an EventHandler "fired" , but you will have to wait untill the unit fires his weapon.


Search or search or search before you ask.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Active Weapon?
« Reply #2 on: 27 Nov 2004, 10:07:24 »
Thanks.  I don't want him to fire.  It is the player and I want to know what weapon he has ready when a cut scene starts.  I am currently using primaryWeapon but it looks stupid if he his holding his handgun with an M16 on his back.  This is quite likely in the circumstances, he may have just picked up the M16

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Active Weapon?
« Reply #3 on: 27 Nov 2004, 11:58:39 »
If you want him to be holding the primary weapon then give him a setBehaviour aware command at the start of the cutscene.
Plenty of reviewed ArmA missions for you to play

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Active Weapon?
« Reply #4 on: 27 Nov 2004, 18:30:22 »
Good thought.  I will have a look at that.  

Currently I have him doing one set of actions in the scene if he has a primary weapon and a different set of actions if he only has his hand gun.  (That is all he starts with).  He has an opportunity to pick up a primary weapon just before the cut scene, but if you pick up a primary weapon while holding a handgun the primary weapon goes on your back.  If he enters the cutscene with a primary weapon on is back it looks stupid so I am reliant on the player selecting this as his weapon before moving a few feet to the next room

Bottom line I could get him to  do a combatToStand off camera whatever he is holding, but that would look lazy - even though it isn't!

Offline Fire-Fox

  • Members
  • *
  • Violence is just a friend walking on the right way
Re:Active Weapon?
« Reply #5 on: 28 Nov 2004, 03:39:05 »
Do I understand it correctly that you want the player to hold the secondary weapon if he has only that, but the primary weapon if he has picked one up? If so, I would propose this:

1) Detect if the player has a primaryweapon or not (probably primaryweapon player != null might work, otherwise let the script detect if the player has one of the primary weapons he could get his hands on up to that point of the mission).
2) Start the cutscene with a blackout/blackin combination that blackens the screen long enough to force the player to change to his primary weapon if the detection was positive.
3) Use the selectweapon command to force the player to change to his primary weapon, then fade in.


I hope this is of any helpful use for you ;)

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Active Weapon?
« Reply #6 on: 28 Nov 2004, 12:05:10 »
Actually I don't want to force him to do anything.  It is the player and he will know what he is holding when he enters the cutscene.  

All I want are his actions in the scene to be compatible with the weapon he is holding at the start.  I currently have different actions depending on whether he has a primary weapon or not.  This is fine if he is actually holding the primary weapon, but nof he isn't.  As I can't detect whether he is holding it or not I will just have something boring in the scene instead.

Well actually, I may just have a look at selectWeapon.  Thanks for the idea.