View Full Version : "init" event handler
Feb 16 2003, 14:50
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.
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)
Add this to your cpp file in the cfgvehicles section:
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
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
Feb 17 2003, 11:53
I see. It will be loaded when the vehicle is created.
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)
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.