Home   Help Search Login Register  

Author Topic: Shot fired = Alarm?  (Read 818 times)

0 Members and 1 Guest are viewing this topic.

MPKING

  • Guest
Shot fired = Alarm?
« on: 19 Jul 2003, 10:00:39 »
How can i make a trigger go if a shot have been fired from an m16 inside trigger area? :P

max_killer_payne

  • Guest
Re:Shot fired = Alarm?
« Reply #1 on: 19 Jul 2003, 13:22:40 »
You can type in a trigger in the condition field

nameofmanwhofires AddEventHandler ["Fired"{exec "alarm.sqs"}]        

or in the {} whateva u want 2 happen when the alarm goes off.

O Neil

  • Guest
Re:Shot fired = Alarm?
« Reply #2 on: 19 Jul 2003, 13:32:57 »
...so. say I made a trigger to make some men run over to you when a shots fired, I could just put in:

nameofmanwhofires AddEventHandler

And do tthe rest by trigger? (You know ;) )

O'Neil

MPKING

  • Guest
Re:Shot fired = Alarm?
« Reply #3 on: 19 Jul 2003, 14:54:04 »
Thanks guys, i'm not sure if i understand it right but will play around with it.
But lets say i have a trigger multiple activated by west so when they enter trigger area they can't fire without alerting enemy, then i should put the eventhandler in da trigger activation field.. right?
How would the right syntax be for this?
nameofmanwhofires AddEventHandler ["Fired"{"M16"}] ?
And instead of adding eventhandlers for every unit could it no be added once for whole group?

Sorry about this, but i haven't messed around with eventhandlers before. ::)    

MPKING

  • Guest
Re:Shot fired = Alarm?
« Reply #4 on: 19 Jul 2003, 15:27:49 »
SOLVED! well almost, it was easyer than i thought. I just made trigger and typed in condition field RedAlert ==1, then made another trigger and typed in activationfield nameofshooter AddEventHandler ["Fired",{ReDAlert = 1}]
Now if anybody can tell me how to (if possible) add the eventhandler to a group instead of every unit, that would be sweet! :P :-*

I've tried the "group this" command and nameofgroup AddEventHandler, but that doesn't work. I just get an error message.
« Last Edit: 19 Jul 2003, 15:31:06 by MPKING »

deaddog

  • Guest
Re:Shot fired = Alarm?
« Reply #5 on: 19 Jul 2003, 18:17:32 »
You can only add eventhandlers to units, not groups.

Would a "west detected by east" trigger work?

You can add the eventhandler to every member of the group like this:

{_x addeventhandler .......} foreach units groupname
« Last Edit: 19 Jul 2003, 18:19:50 by deaddog »

Offline Blanco

  • Former Staff
  • ****
Re:Shot fired = Alarm?
« Reply #6 on: 19 Jul 2003, 18:35:08 »
Ok, other Q related to this subject... :)

I have

W1 AddEventHandler ["Fired",{Shot1 = True}]
and
W2 AddEventHandler ["Fired",{Shot2 = True}]
and
W3 AddEventHandler ["Fired",{Shot3 = True}]

But when I place a trigger

cond. : Shot1 or shot2 or shot3

onact : [] exec "alarm.sqs"


Why does this not work, the alarm script nerver start?!

Search or search or search before you ask.

deaddog

  • Guest
Re:Shot fired = Alarm?
« Reply #7 on: 19 Jul 2003, 19:56:41 »
@blanco

I just tried that in the editor.  I placed:

this addEventHandler ["fired",{shot1=true}]

in my player's init line and a trigger:

cond: shot1
on act: hint "shot fired"

it worked just fine but when I added a second soldier with "shot2" it wouldn't work.

I fixed it by initializing the "shot" variables first.  Put this in your init.sqs file or an init line of any unit:

shot1=false;shot2=false;shot3=false

That should work.

MPKING

  • Guest
Re:Shot fired = Alarm?
« Reply #8 on: 20 Jul 2003, 02:20:12 »
You can only add eventhandlers to units, not groups.

Would a "west detected by east" trigger work?

You can add the eventhandler to every member of the group like this:

{_x addeventhandler .......} foreach units groupname

Thanks alot, that did the trick