raptor2x 10 Posted April 7, 2016 Hello, So basically I'm trying to do something when a player fires with a mortar. This is a simple code I made to check if it's working when the player fires with a MK18, and it's working good: player addEventHandler ["Fired",{ if (_this select 1 == "srifle_EBR_F") then { do something here };}];So now I'm trying to adapt the code for the mortar, this is what I tried :player addEventHandler ["Fired",{ if (_this select 1 == "mortar_82mm") then { do something here };}];It's not working and I probably know why "This EH will not trigger if a unit fires out of a vehicle. For those cases an EH has to be attached to that particular vehicle.", the mortar is a vehicle. So from what I understand I need to attach the Event Handler to the vehicle and not to the player itself. Can you explain me how can I do that ? Thank you ! Share this post Link to post Share on other sites
sarogahtyp 1108 Posted April 7, 2016 (edited) depending of ur scipt this could be a solution: (vehicle player) addEventHandler ["Fired",{ if (_this select 1 == "mortar_82mm") then { do something here };}]; but this is only helpful if the player is inside the mortar at the time the EH is added. EDIT another thing could be to give ur mortar a global variable name in editor or at the time u spawn it. mortar1 = "mortar_classname" createVehicle mortar_position; then u could use that variable to add the EH: mortar1 addEventHandler ["Fired",{ if (_this select 1 == "mortar_82mm") then { do something here };}]; or u try jshocks solution in next post... Edited April 7, 2016 by sarogahtyp Share this post Link to post Share on other sites
jshock 513 Posted April 7, 2016 Not sure if this will work, but put a WeaponAssembled EH on the player, check to see if the assembled weapon is a mortar, if it is, add the fired EH to the mortar (weapon = (_this select 1), in the EH): https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#WeaponAssembled Share this post Link to post Share on other sites