PDA

View Full Version : "init" event handler



Pierrot
Feb 16 2003, 14:50
Hi all,

When I read readme.txt in patch 1.90, I found "Init" event handler.

"Init" No arguments

It seems that it receives no argument. Do you know what "Init" is and how you can use this event handler.

bn880
Feb 16 2003, 15:29
I don't know so much about addons, but I assume you install it like any other handler in your addon (ie: hit), it will be run during the initisalization of the unit. (whenever it's created)

AXE
Feb 16 2003, 15:56
Add this to your cpp file in the cfgvehicles section:
class EventHandlers
{
Init = "(this select 0) do whatever";
}

Whatever is in the init eventhandler will be executed when
the unit is loaded. What they meant by 'no arguments' is
that it returns only one variable, which is the unit using
the eventhandler. Eventhandlers with multiple arguments
have many returned variables - for example "fired" handler
has:
this select 0 = unit firing
this select 1 = unit's weapon being fired
this select 2 = muzzle of the weapon being fired
this select 3 = fire mode of fired weapon (like burst/full auto)
this select 4 = the ammo being fired from the weapon

and the init eventhandler has:
this select 0 = unit using the init handler

Pierrot
Feb 17 2003, 11:53
I see. It will be loaded when the vehicle is created.
Thanks all.

BratZ
Feb 17 2003, 17:26
Ya it runs at mission startup,but realize that it doesn't run on all computers in a mp game.

Good for checking startup routines or such (I use to fix my start flying gear down problem)