Reeveli 4 Posted December 22, 2018 So I'm working on a mission in which I would like the players to use the MicroDAGR and the Ctab tablet. Both of these devices count as (gps) terminals which enable both the side panels (I managed to find a solution to this) and the map (even when there is none in the inventory). I am not good with eventhandlers which I assume would be the prime candidates for this. Does anyone have ideas for a simple script that either prevents the player from opening the map itself or closing the map screen as soon as its opened? Share this post Link to post Share on other sites
HazJ 1289 Posted December 22, 2018 A few ways of doing this. Remove map upon opening - Map EH: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler Create overlay that blacks out map: Override map key - keyDown EH 1 Share this post Link to post Share on other sites
Reeveli 4 Posted December 23, 2018 I'm sorry but as I said I have no idea how to use the eventhandlers. What would the code be like e.g. in initPlayerLocal.sqf since this would be for all players? Share this post Link to post Share on other sites
HazJ 1289 Posted December 23, 2018 Sorry for late reply. (findDisplay 46) displayAddEventHandler ["KeyDown", { params ["_display", "_key", "_shift", "_ctrl", "_alt"]; if (_key in actionKeys "showMap" && "ItemGPS" in assignedItems player) then { hintSilent "You have a GPS"; true; } else { hintSilent "You don't have a GPS"; }; }]; This will prevent map opening if you have GPS in assigned slot. 2 Share this post Link to post Share on other sites
Reeveli 4 Posted January 20, 2019 I am sorry but as far as I can tell your code is supposed to give a hint when the map is opened while having a GPS in inventory. And on my tests it doesn't work. So I will need a another solution to this. Tried the following: addMissionEventHandler ["Map", { params ["_mapIsOpened", "_mapIsForced"]; if (_mapIsOpened) then {openMap false;} }]; But it doesn't work either. I tested this event handler with hints and it does fire when the map is opened, but the openMap false -command seems not to work. Could use some moore help with this if anyone has any ideas. Share this post Link to post Share on other sites
HazJ 1289 Posted January 20, 2019 Your code is completely different? I gave you working code above. EDIT: Here is an example mission. I slightly tweaked the code so the hint doesn't show if you aren't pressing the map key. https://hazjohnson.com/ArmA/DisableMapIfNoGPS.VR.zip (findDisplay 46) displayAddEventHandler ["KeyDown", { params ["_display", "_key", "_shift", "_ctrl", "_alt"]; if (_key in actionKeys "showMap") then { if ("ItemGPS" in assignedItems player) then { hintSilent "You have a GPS"; true; } else { hintSilent "You don't have a GPS"; }; }; }]; Preview mission, open map, you will be able to, it'll say "You don't have a GPS", close map, open inventory and move your GPS into the slot, try to open the map, you won't be able to, you'll see "You have a GPS". I made it so the GPS has to be assigned in the slot. If you just want it anywhere, change assignedItems to items instead. If you just want to always force map off then: (findDisplay 46) displayAddEventHandler ["KeyDown", { params ["_display", "_key", "_shift", "_ctrl", "_alt"]; if (_key in actionKeys "showMap") then { hintSilent "You have a GPS"; true; }; }]; 2 Share this post Link to post Share on other sites
pierremgi 4907 Posted January 20, 2019 showMap false; addMissionEventHandler ["Map", { params ["_mapIsOpened", "_mapIsForced"]; if (_mapIsOpened) then { hintSilent "Use your tablet"; showGPS false; } else { showGPS true }; }]; 1 1 Share this post Link to post Share on other sites
HazJ 1289 Posted January 20, 2019 I think he wants to disable map opening at all if you don't have a GPS??? Or at least according to the thread title: Quote Disabling map screen while having GPS @Reeveli - Please clarify what you want exactly. Share this post Link to post Share on other sites
Reeveli 4 Posted February 5, 2019 On 1/20/2019 at 10:23 PM, HazJ said: I think he wants to disable map opening at all if you don't have a GPS??? Or at least according to the thread title: @Reeveli - Please clarify what you want exactly. The aim is to disable the map screen entirely, thus forcing the players to use other tools (like Ctab). The newer code you provided seems to work on my tests. waitUntil {!isNull (findDisplay 46)}; (findDisplay 46) displayAddEventHandler ["KeyDown", { params ["_display", "_key", "_shift", "_ctrl", "_alt"]; if (_key in actionKeys "showMap") then { true; }; }]; As I said this is sufficient, but I after getting this to work I have been thinking about other features. Is it possible to add this kind of eventhandlers to the mission after the mission has already started? I was thinking about allowing the map during the briefing so the players would have the option of actually reading the briefing in-game and trying to memorize the terrain before combat. In any case this thanks for your help so far. Share this post Link to post Share on other sites
HazJ 1289 Posted February 5, 2019 Should work fine in briefing already. Did you download the example mission? Share this post Link to post Share on other sites
Reeveli 4 Posted February 5, 2019 2 minutes ago, HazJ said: Should work fine in briefing already. Did you download the example mission? Ah, interesting, poor choice of words on my part. I was thinking about allowing the players to access the map while getting their gear and organizing squads back the base after the mission had already stared and activating the eventhandler after they deployed into a combat area. But you are correct, seeing the map (and thus being able to read the briefing) is still allowed during the pre-mission briefing screen which is just fine for my application. Thanks. Share this post Link to post Share on other sites
HazJ 1289 Posted February 5, 2019 Change: if (_key in actionKeys "showMap") then To: if (_key in actionKeys "showMap" && missionStarted) then You will need to define the variable, maybe in init.sqf like so: if (isNil "missionStarted") then {missionStarted = FALSE;}; And you will need to set it to TRUE somewhere, you'll have to decide when to do that. missionStarted = TRUE; publicVariablr "missionStarted"; All un-tested. Share this post Link to post Share on other sites
BULLWAR 1 Posted February 6, 2023 On 1/20/2019 at 4:09 PM, pierremgi said: showMap false; addMissionEventHandler ["Map", { params ["_mapIsOpened", "_mapIsForced"]; if (_mapIsOpened) then { hintSilent "Use your tablet"; showGPS false; } else { showGPS true }; }]; hi master, this works fine, how active the map if i use a trigger ? i tried but i cant do Share this post Link to post Share on other sites
pierremgi 4907 Posted February 6, 2023 2 hours ago, BULLWAR said: hi master, this works fine, how active the map if i use a trigger ? i tried but i cant do Using a trigger means a condition set to true.... you can add this condition to the code above: if (_mapIsOpened && yourConditionHere) then... you can use also: triggerActivated yourTriggerHere as condition... 1 Share this post Link to post Share on other sites
BULLWAR 1 Posted February 6, 2023 10 minutes ago, pierremgi said: Using a trigger means a condition set to true.... you can add this condition to the code above: if (_mapIsOpened && yourConditionHere) then... you can use also: triggerActivated yourTriggerHere as condition... in trigger activation I put your script: showMap false; addMissionEventHandler["Map", { params["_mapIsOpened", "_mapIsForced"]; if (_mapIsOpened) then { hintSilent "Use your tablet"; showGPS false; } else { showGPS true }; }]; now I am trying to make a non-GPS zone of something like 500 meters activated by trigger, I put that code and well, what I am looking for is when leaving the trigger the map is activated again Share this post Link to post Share on other sites
pierremgi 4907 Posted February 7, 2023 multiplayer or single player? Share this post Link to post Share on other sites