Home   Help Search Login Register  

Author Topic: add eventhandlers to spawned units  (Read 1187 times)

0 Members and 1 Guest are viewing this topic.

SgtBaker1112

  • Guest
add eventhandlers to spawned units
« on: 27 Sep 2006, 02:24:44 »
Can someone help me out here.. i am trying to add an eventhandler to spawned unit
"z_priest" createunit [getpos die1,ja,"BOBs=this"]

how would i go about adding an eventhandler killed, then exec "isdead.sqs"

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: add eventhandlers to spawned units
« Reply #1 on: 27 Sep 2006, 03:18:42 »
Three possibilities in order they should be executed next time...
1) Search the forums
2) Read the CreateUnit tutorial
3) Ask Mr.Peanut
Code: [Select]
"xxxx" createUnit [_pos,_grp,{BOBs=this ; this addEventHandler ["killed",{_this exec "enemykill.sqs"}]},0.5,"PRIVATE"]
If the script "enemykill.sqs" or "isdead.sqs" or whatever you call it
Code: [Select]
_this select 0 will be the dead unit.
« Last Edit: 27 Sep 2006, 15:57:44 by Mr.Peanut »
urp!

SgtBaker1112

  • Guest
Re: add eventhandlers to spawned units
« Reply #2 on: 27 Sep 2006, 04:28:09 »
1. i have searched.. i even looked some more after your reply, but i still couldn't find what i was looking for
2. I have found no createunit tutorial.. can i have a link?
3. i appreciate you trying to help me. but the code sample has given me an error Missing )
 :banghead:

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: add eventhandlers to spawned units
« Reply #3 on: 27 Sep 2006, 05:46:45 »
Here is the CreateUnit Tutorial.


Planck
I know a little about a lot, and a lot about a little.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: add eventhandlers to spawned units
« Reply #4 on: 27 Sep 2006, 15:58:59 »
I just took a look at my code above and saw an extra double quote. I have removed it from post above. Try again.
urp!

SgtBaker1112

  • Guest
Re: add eventhandlers to spawned units
« Reply #5 on: 28 Sep 2006, 00:27:47 »
thank you mr.peanut.. i now see you as a scripting god.
it worked!!!!!1
 :clap:

 :clap:
 :laugh:
 :blink:
 :)

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: add eventhandlers to spawned units
« Reply #6 on: 28 Sep 2006, 15:02:12 »
!Supplicate Before the Mighty Nut!
               

actually, i am not a god, i am just good at searching the forums  ;)
urp!