Page MenuHomeFeedback Tracker

Init event doesn't fire after createVehicle
Closed, ResolvedPublic

Description

The init event doesn't fire when using the createVehicle script command.
Wiki entry of the event: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Init

I attached a sample mission.
It's a VR mission with one soldier added and the soldier init field has:
this addEventHandler["Init", {systemChat "init fired"}]
There is a trigger that can be activated using Radio Alpha.

The trigger runs the following piece of code:
_box = "Box_NATO_Ammo_F" createVehicle getPos player;

Upon triggering the trigger, the ammo box is created but the Init trigger won't fire.

{F24558}

Details

Legacy ID
2097940756
Severity
None
Resolution
No Bug
Reproducibility
Always
Category
Scripting
Steps To Reproduce
  1. Download the mission
  2. Extract it into Documents\Arma 3\ProfileNameHere\missions
  3. Run the game
  4. Open the mission called initTest in the VR world
  5. Preview mission
  6. Trigger radio alpha

Event Timeline

Xendance edited Steps To Reproduce. (Show Details)Aug 8 2014, 5:51 PM
Xendance edited Additional Information. (Show Details)
Xendance set Category to Scripting.
Xendance set Reproducibility to Always.
Xendance set Severity to None.
Xendance set Resolution to No Bug.
Xendance set Legacy ID to 2097940756.May 7 2016, 7:11 PM

So you are trying to add init handler from init hander?

Yeah, what KK said.

I've never really understood whether I've understood how the init event handler works. I understand how it works from mission.sqm, but how do you add it to an object that hasn't been created yet? :P

Well I suppose that is part of the problem :D
Examples would be nice.

In my understanding, you cannot add init event handler with script only with class config. It is like with ui event handler onLoad. You can add it to display in config, but when you actually have display opened so you can add it with displayAddEventHandler it is pointless.

Xeno added a subscriber: Xeno.May 7 2016, 7:11 PM
Xeno added a comment.Aug 9 2014, 12:12 AM

Xendance... think about it again.

You add a "Init" eventhandler to an already created object (with createVehicle), thus init most likely was already triggered before addEventhandler ["init" gets executed.

someobject addEventHandler ["init"... is pretty much the most useless addEventHandler event in the series and the init event is only usable in configs.

The only thing which would make at least some sense would be something like "someclassname" addEventHandler ["init"... which could be added before an object gets created.

I was just confused whether the init was supposed to be a global event handler that gets fired every time a vehicle is created. If it's not, just ignore this issue then.