canadian1337 17 Posted May 26, 2018 Soo I wanted to create a NV system that is built into the helicopter (Vietnam War era) by creating an event handler that adds and assigns the NVG when someone is entering the pilot seat and removing when exiting the vehicle. I've come up with the code below but sadly it doesn't work. The event handler is placed in the init field of the helicopter. this addEventHandler ["GetIn", { _unit = _this select 0; _unit additem "NVGoggles";_unit assignitem "NVGoggles";}]; Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted May 26, 2018 2 minutes ago, canadian1337 said: Soo I wanted to create a NV system that is built into the helicopter (Vietnam War era) by creating an event handler that adds and assigns the NVG when someone is entering the pilot seat and removing when exiting the vehicle. I've come up with the code below but sadly it doesn't work. The event handler is placed in the init field of the helicopter. this addEventHandler ["GetIn", { _unit = _this select 0; _unit additem "NVGoggles";_unit assignitem "NVGoggles";}]; https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#GetIn params ["_vehicle", "_role", "_unit", "_turret"]; Always check if you're using the correct parameters first. Cheers 1 Share this post Link to post Share on other sites
canadian1337 17 Posted May 26, 2018 Yeah, I did check the parameters but they were a lil bit unclear to me (probably because I'd rather see examples than pure documentation). So it would go like (?): this addEventHandler ["GetIn", {_unit = _this select 0,"driver",heli_name}]; I'm kind of not used to the topic of event handlers so I'm not sure where to put in the: _unit additem "NVGoggles";_unit assignitem "NVGoggles"; Share this post Link to post Share on other sites
gokitty1199 225 Posted May 26, 2018 5 hours ago, canadian1337 said: Yeah, I did check the parameters but they were a lil bit unclear to me (probably because I'd rather see examples than pure documentation). So it would go like (?): this addEventHandler ["GetIn", {_unit = _this select 0,"driver",heli_name}]; I'm kind of not used to the topic of event handlers so I'm not sure where to put in the: _unit additem "NVGoggles";_unit assignitem "NVGoggles"; watch this, it covers event handlers and the select command if you look at the parameters that Grumpy Old Man posted, you would see thats in in this order like this params ["_vehicle", "_role", "_unit", "_turret"]; and if you look in your script, you have _unit = _this select 0 your setting _unit to be equal to _vehicle. with eventHandlers their in order starting from 0, so 0 is the vehicle, 1 is the role, 2 is the _unit(what you want) and 3 is the turret. so instead of setting unit to 0 you would want to set unit to 2 so its equal to the unit like this. anything inside of the {} is where you can put whatever scripts you want to run when the event handler runs. this addEventHandler ["GetIn", { _unit = _this select 2; _unit additem "NVGoggles"; _unit assignitem "NVGoggles"; }]; Share this post Link to post Share on other sites
canadian1337 17 Posted May 29, 2018 @gokitty1199 sorry for the late reply. Really appreciate your help, that explained a lot to me. Share this post Link to post Share on other sites