Home   Help Search Login Register  

Author Topic: Fired eventhandler  (Read 625 times)

0 Members and 1 Guest are viewing this topic.

Offline DarkAngel

  • Members
  • *
  • The night is my friend.
    • DarkAngels Missions
Fired eventhandler
« on: 31 Dec 2003, 19:14:17 »
Hi guys,

Igor Drukov's tutorial on eventhandler's has been really helpful but I'm still a little bit stuck. I'm trying to devise a script in which a chopper will come into an LZ once the player fires a flare. I'm using the SEB flaregun for this purpose. I'm calling it using p AddEventHandler ["fired",{_this exec "flarefire.sqs"}]. As you'll see, at the moment I'm just trying to detect whether the player has just fired a flare or something else.

; flarefire.sqs

_ammo = _this select 4

hint "Event handler set, wait two seconds"

~2

?_ammo = "sebflarered":goto "yes"

hint "Flare not launched"

exit

#yes
 hint "Flare was launched"
exit

I'm sure I'm doing something really obvious wrong, I just don't now what it is!  ??? Any help would be much appreciated.

DarkOut.
"Moondark" in Beta Testing

deaddog

  • Guest
Re:Fired eventhandler
« Reply #1 on: 31 Dec 2003, 20:50:24 »
Code: [Select]
?_ammo = "sebflarered":goto "yes"
Use == to check equality.

Offline DarkAngel

  • Members
  • *
  • The night is my friend.
    • DarkAngels Missions
Re:Fired eventhandler
« Reply #2 on: 01 Jan 2004, 14:04:51 »
Code: [Select]
?_ammo = "sebflarered":goto "yes"
Use == to check equality.


Thanks again deaddog!  :)

Yep, it was really simple, wasn't it. D'oh!  :P
"Moondark" in Beta Testing

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Fired eventhandler
« Reply #3 on: 02 Jan 2004, 12:43:11 »
When a flare is fired a script file called onFlare.sqs is called automatically.     You can put what you need in a file of that name in your mission folder and do everthing you need in there - you don't need an eventhandler at all.
Plenty of reviewed ArmA missions for you to play

Offline Blanco

  • Former Staff
  • ****
Re:Fired eventhandler
« Reply #4 on: 02 Jan 2004, 16:56:15 »
When a flare is fired a script file called onFlare.sqs is called automatically.     You can put what you need in a file of that name in your mission folder and do everthing you need in there - you don't need an eventhandler at all.

Interesting,... Are there other in-built scripts like that?

I know about :

Onplayerkilled.sqs
Camera.sqs
Intro.sqs
...



« Last Edit: 02 Jan 2004, 16:56:40 by Blanco »
Search or search or search before you ask.

deaddog

  • Guest
Re:Fired eventhandler
« Reply #5 on: 02 Jan 2004, 18:24:46 »
onflare.sqs is nice because it allows you to extract the color of the flare you launched.  But I guess you could do that with the fired eventhandler by checking the ammo type used.

Here is a couple of more event base scripts:

initIntro.sqs - launched when intro is started (since 1.50)
    - no arguments

exit.sqs - launched when mission is finished (before debriefing screen, since 1.50)
    - argument: end # - number of game end