-
Notifications
You must be signed in to change notification settings - Fork 6
Event Handlers
You can subscribe to an event handler using BIS_fnc_addScriptedEventHandler , it'll execute to given code every time an event is raised by the GPS.
This event triggers when the functions of the gps has finished to compile.
You can just use the basic functions here.
None
[missionNameSpace,"gps_functions_compiled",{hint "Functions finished to compile"}] call bis_fnc_addScriptedEventHandler;
This event triggers when the route computation is done.
You can call any function from the gps after that.
None
[missionNamespace,"gps_loaded",{
[
"Navigate to marker_1",
{
["marker_1"] spawn gps_fnc_main;
}
] call gps_menu_fnc_addQuickNavOption;
}] call bis_fnc_addScriptedEventHandler;
Triggers BEFORE any menu (quicknav,gps main menu,gps nav menu,gps options menu) is opened.
You can override if the menu can be opened by returning true or false in the EH code.
(STRING) _this select 0 : name of the current menu.
/*
Here we authorize opening all the menu elements if player has a GPS item on him.
And we always authorize the quick nav menu.
*/
[missionNamespace,"gps_menu_opening",{
params ["_menuType"];
_return = switch(_menuType) do {
case "menu_main" : {
"ItemGPS" in assignedItems player
};
case "menu_nav": {
"ItemGPS" in assignedItems player
};
case "menu_options": {
"ItemGPS" in assignedItems player
};
case "menu_controls": {
"ItemGPS" in assignedItems player
};
case "quick_nav" : {
true
};
};
_return;
}] call bis_fnc_addScriptedEventHandler;
Same as above but you can't override anything and the created display is passed as argument AFTER the menu is created.
(DISPLAY) _this select 0 : opened menu.
None
Triggers when the main gps function (fn_main.sqf) is launched
You can override if the function can start by returning true or false in the EH code.
(OBJECT) _this select 0 : Start road.
(OBJECT) _this select 1 : Goal road.
None