Home   Help Search Login Register  

Author Topic: Eventhandlers and FlareTrap  (Read 498 times)

0 Members and 3 Guests are viewing this topic.

Offline rhysduk

  • Former Staff
  • ****
Eventhandlers and FlareTrap
« on: 15 Feb 2004, 17:14:49 »
Hi All,

Im having a spot of bother with eventhandlers. :( I understand the basics of them but not much more

I want a flare to be fired by a flaretrap (trigger executing a flare script) but the flare has smoke tails effects...

I can get the flare to have the smoke tail effects when me, hte player, fires a flare from a flare gun but not when it is not fired from the trigger/script...

I get the smoketail affect by putting this in the players INIT feild:-

Code: [Select]
this AddEventHandler ["fired",{_this exec "flareFX.sqs"}]
and this script :-

Code: [Select]
_man = _this select 0
_projectile = _this select 4

?_projectile != "flare" : exit
_object=nearestobject [_man,"flare"]

_pos=getpos _object
_life =30
_delay = 0.01
_lifeTicks = _life / _delay
_life = _lifeTicks


;;yeah... I added a flare sound
~1.4
;;playsound "flare"

#Begin
_pos=getpos _object

_shade = 0.65 +random 0.3
_smoke=drop["cl_basic","","Billboard",1,5,_pos,[0,0,0],0,1,1,0,[0.5,3],[[_shade,_shade,_shade,0.9],[0.8,0.8,0.8,.1]],[0,1],2.8,1,"","",""]  

~0.0001*_delay
_life = _life - 1
?_life > 0 : goto "Begin"
exit

This works perfectly when i fire the flare myself... but what i want to do is to get this effect when a flare is fired from a script (cam created)..

I take it the event handler wont work on this??

Rhys

« Last Edit: 15 Feb 2004, 17:28:49 by rhysduk »
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)

Offline Blanco

  • Former Staff
  • ****
Re:Eventhandlers and FlareTrap
« Reply #1 on: 15 Feb 2004, 18:48:05 »
eh, that script looks familiar :)


you don't need the eventhandler when the flare's camcreated. Eventhandler "fired" is only used to activate a script or code when a unit fires his weapon, in your case the the flare's created with camcreate

Just run the flareFX script when the flare's created.
Run the variable as first and only param

In your flare trapscript there should something like that:

_flare = "flare" camcreate <position> ;

<position> is probably a marker or gamelogic.

add this line after the flare's created

[_flare] exec "flarefx.sqs"

 
but flareFX.sqs is a bit different

Code: [Select]
_object = _this select 0

_pos=getpos _object
_life =30
_delay = 0.01
_lifeTicks = _life / _delay
_life = _lifeTicks


#Begin
_pos=getpos _object

_shade = 0.65 +random 0.3
_smoke=drop["cl_basic","","Billboard",1,5,_pos,[0,0,0],0,1,1,0,[0.5,3],[[_shade,_shade,_shade,0.9],[0.8,0.8,0.8,.1]],[0,1],2.8,1,"","",""]  

~0.0001*_delay
_life = _life - 1
?_life > 0 : goto "Begin"
exit

not tested, tho
but I have to say the effect is better with the flare sound :)

Search or search or search before you ask.

Offline rhysduk

  • Former Staff
  • ****
Re:Eventhandlers and FlareTrap
« Reply #2 on: 15 Feb 2004, 18:55:23 »
Thanks a bunch mate - ur a genius  :-*

Rhys

Topic Locked!
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)