Home   Help Search Login Register  

Author Topic: Addevnethandler issue.. FAST!  (Read 1499 times)

0 Members and 1 Guest are viewing this topic.

Offline Flauta

  • Members
  • *
  • There is no knownledge, that is no power
    • Chek mi FLog
Addevnethandler issue.. FAST!
« on: 14 Aug 2006, 20:26:47 »
Hey Folks!!!

I was wondering if there is a way to script the idea of these
Code: [Select]
{_x addeventhandler ["fired",{_x setcaptive false}]} foreach thislist  comand...
Despisting the "Addeventhandler" sintax.. the problme is that it desnot work... Ivé tried whit this setcaptive false instead of _x setcaptive false, but i sitll cant put it to work... any ideas??

I need Fast Answers!!!

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re: Addevnethandler issue.. FAST!
« Reply #1 on: 14 Aug 2006, 20:35:37 »

Code: [Select]
{_x addeventhandler ["fired",{_x setcaptive false}]} foreach thislistI need Fast Answers!!!

This is as fast as I am these days. Your code should read
Code: [Select]
{_x addeventhandler ["fired",{this setcaptive false}]} foreach thislist since the eventHandler is actually added to a unit, and then this makes sense to the game engine wich _x forEach thislist doesn't. If Im wrong it's due to lack of time ;)

EDIT: Sorry, i just noticed you last remark. I will look at it again, but i wont be so fast.

EDIT2: From where do you get thislist? Try forEach units groupName

EDIT3 (for clarity):
Code: [Select]
{_x addeventhandler ["fired",{this setcaptive false}]} foreach units groupName
« Last Edit: 14 Aug 2006, 20:48:25 by nominesine »
OFPEC | Intel Depot
RETARDED Ooops... Retired!

Offline Flauta

  • Members
  • *
  • There is no knownledge, that is no power
    • Chek mi FLog
Re: Addevnethandler issue.. FAST!
« Reply #2 on: 14 Aug 2006, 20:48:21 »
it is a trigger... nevermind about that.. because the trigger put all of them to setcaptive true.. and it wotks.. but when te EH execs, it givesa error whit "this" and it dosnt do anything whit _X

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re: Addevnethandler issue.. FAST!
« Reply #3 on: 14 Aug 2006, 20:59:49 »
Try

{_x addeventhandler ["fired",{(_this select 0) setcaptive false}]} foreach thislist

This is a guess as I cannot access the link to GB's list at the following location at the moment.

http://www.ofpec.com/COMREF/index.php?action=list&letter=a#addEventHandler
« Last Edit: 14 Aug 2006, 21:04:55 by THobson »

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re: Addevnethandler issue.. FAST!
« Reply #4 on: 14 Aug 2006, 21:08:18 »
I was going to suggest that you use _this, but Thobson is usually correct so try his advice first. The reason Im guessing is that I cannot access OFP and test anything right now.
OFPEC | Intel Depot
RETARDED Ooops... Retired!

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re: Addevnethandler issue.. FAST!
« Reply #5 on: 14 Aug 2006, 21:16:04 »
In the context of an EH _this is an array.  I am guessing (because I can't get to GB's additional Info at the moment) that the first element of the array for a "fired" EH will be the unit that did the firing.  Seems like a reasonable guess

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re: Addevnethandler issue.. FAST!
« Reply #6 on: 14 Aug 2006, 21:22:48 »
...and you can't setCaptive an array. That makes sense. I stand corrected.
OFPEC | Intel Depot
RETARDED Ooops... Retired!

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re: Addevnethandler issue.. FAST!
« Reply #7 on: 14 Aug 2006, 21:35:13 »
Thanks to bedges the broken link is now fixed.  Here is an extract:

For a "fired" Event Handler:
_this select 0 : who fired
_this select 1 : with what weapon
_this select 2 : with what muzzle
_this select 3 : mode (either single, or burst, or auto)
_this select 4 : the type of ammo used

Offline Flauta

  • Members
  • *
  • There is no knownledge, that is no power
    • Chek mi FLog
Re: Addevnethandler issue.. FAST!
« Reply #8 on: 14 Aug 2006, 22:01:30 »
Thanks!!

Fast answers needed, Fast Ansewers found!!

Thanks to all!