Home   Help Search Login Register  

Author Topic: Weapon fired  (Read 715 times)

0 Members and 1 Guest are viewing this topic.

TC

  • Guest
Weapon fired
« on: 31 Jul 2005, 23:42:37 »
How would i do a check to see if any weapon has been fired?

I need to get guys to randomly shout whilst firing thier weapons. The rest of the script has been done, just not the bit that determins when exactly they are firing their guns! Also how about detecting when any weapon is picked up or when a secondary weapon is selected for use?

Cheers

Offline Ding

  • Contributing Member
  • **
  • Jurassic Park
Re:Weapon fired
« Reply #1 on: 01 Aug 2005, 00:10:11 »
unit addeventhandler ["Fired" {Command}]

can be anything that is a command where it says command e.g.
unit addeventhandler ["Fired" {unit setdammage 1}]
unit addeventhandler ["Fired" {unit say "Sound01"}]
"If I remain lost and die on a cross, atleast I wasn't born in a manger"

Dane

  • Guest
Re:Weapon fired
« Reply #2 on: 01 Aug 2005, 00:10:30 »
I think you need the eventHandler for that one, loon addEventhandler ["fired", {_this exec "yourScript.sqs"}]

Edit. Yep! Just like Ding Wrote ::)

Edit2. 2: look in the comref for the hasWeapon command.
« Last Edit: 01 Aug 2005, 00:18:14 by Dane »

DBR_ONIX

  • Guest
Re:Weapon fired
« Reply #3 on: 01 Aug 2005, 00:43:38 »
this addeventhandler ["fired",{code or run a script in here}]
- Ben

Dane

  • Guest
Re:Weapon fired
« Reply #4 on: 01 Aug 2005, 01:16:29 »
unit addeventhandler ["Fired", {_this setdammage 1}]
unit addeventhandler ["Fired", {_this say "Sound01"}]

Ok. I think it's safe to say he defenantly should use an eventhandler for this ;D ;D

TC

  • Guest
Re:Weapon fired
« Reply #5 on: 01 Aug 2005, 12:54:25 »
Nice one, cheers guys

TC

  • Guest
Re:Weapon fired
« Reply #6 on: 01 Aug 2005, 14:58:09 »
iS IT POSSIBLE TO USE THE "HASWEAPON" COMMAND to detect if Any weapon has been picked up?

EG Player hasweapon ""

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Weapon fired
« Reply #7 on: 01 Aug 2005, 23:06:49 »
well i think what you would need is the command primaryweapon unit

?(primaryweapon unit) != "":hint "unit has a primary weapon"

or perhaps the weapons commad to get all weapons:
?(weapons unit) != []:hint "unit has some weapon"