Ivanoff.N 61 Posted January 19, 2017 I am trying to make an addon that will make a small hud appear as soon as you enter particular vehicle. I have made the hud itself via script using rsctext. I only need the code for the init.sqf so that: 1) playable unit enters mortar as gunner (only mortar no other vehicle) - script starts 2) playable unit exits mortar - script stops I need this to work with all mortars placed on the map for all playable units, without any naming etc. (of course each player must see the hud individually). Please advise if it is possible to do and the code to do it if possible. Thank you, Share this post Link to post Share on other sites
theend3r 83 Posted January 19, 2017 The wiki has it all, surprisingly : https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#GetInMan https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#GetOutMan mortars = ["mortar_class_1","mortar_class_2","mortar_class_3"...]; player addEventHandler ["GetInMan", {if (_this select 2 in mortars) then {[_this select 0] execVM "script.sqf"}}]; Share this post Link to post Share on other sites
Ivanoff.N 61 Posted January 20, 2017 On 1/19/2017 at 2:00 PM, theend3r said: The wiki has it all, surprisingly : https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#GetInMan https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#GetOutMan mortars = ["mortar_class_1","mortar_class_2","mortar_class_3"...]; player addEventHandler ["GetInMan", {if (_this select 2 in mortars) then {[_this select 0] execVM "script.sqf"}}]; Yes, the problem is that to understand what the wiki sais you need to have quite a bit of knowledge. For example this: mortars = ["mortar_class_1","mortar_class_2","mortar_class_3"...]; <- are these the names of the classes of units I want to trigger the script ? Would this be the correct syntax if I want to use vanilla mortars ? mortars = ["B_G_Mortar_01_F ","B_Mortar_01_F"]; Also I know that all new variables are marked with _ (example: _variable = something) why is it not so in this case ? Share this post Link to post Share on other sites
theend3r 83 Posted January 20, 2017 1 hour ago, Ivanoff.N said: Yes, the problem is that to understand what the wiki sais you need to have quite a bit of knowledge. For example this: mortars = ["mortar_class_1","mortar_class_2","mortar_class_3"...]; <- are these the names of the classes of units I want to trigger the script ? Would this be the correct syntax if I want to use vanilla mortars ? mortars = ["B_G_Mortar_01_F ","B_Mortar_01_F"]; Also I know that all new variables are marked with _ (example: _variable = something) why is it not so in this case ? Yes, that's correct. _something means it's local and that wouldn't work here Also, I made a mistake there, it needs typeOf to work player addEventHandler ["GetInMan", {if (typeOf (_this select 2) in mortars) then {[_this select 0] execVM "script.sqf"}}]; Share this post Link to post Share on other sites
Ivanoff.N 61 Posted February 3, 2017 On 1/20/2017 at 6:09 PM, theend3r said: Yes, that's correct. _something means it's local and that wouldn't work here Also, I made a mistake there, it needs typeOf to work player addEventHandler ["GetInMan", {if (typeOf (_this select 2) in mortars) then {[_this select 0] execVM "script.sqf"}}]; This has to go in the init .sqf and start at the beginning of the mission right ? Share this post Link to post Share on other sites