Jump to content
Sign in to follow this  
Pierrot

"init" event handler

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

I see. It will be loaded when the vehicle is created.

Thanks all.

Share this post


Link to post
Share on other sites
Guest BratZ

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)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×