{"name":"openMap","title":"openMap","type":"command","url":"https://community.bistudio.com/wiki/openMap","revid":349654,"updated":"2023-11-18T17:02:30Z","groups":["Map","Interaction"],"status":"ok","games":{"arma2":"1.03","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma2 1.03","arma3_since":"0.50","locality":{"effect":"local"},"description":"Opens or closes in-game map.\n\n> [!WARNING]\n> If `forced` param is set to true and map is set to open, when the map is opened it cannot be closed manually and the user can get stuck requiring the game restart.\n>\n> Make sure you provide scripted mechanics to resolve this, should you need to force the map.\n>\n> Useful when you wish to keep user for example on respawn screen, where they could still interact with the map but cannot enter the game until the time is up.","syntaxes":[{"syntax":"openMap show","params":[{"name":"show","type":"Boolean","description":"if true opens map, if false closes map, provided it is not *forced*","type_expr":"Boolean"}],"returns":{"type":"Boolean","type_expr":"Boolean","description":"equivalent of visibleMap"},"form":"unary","right":{"text":"show"}},{"syntax":"openMap [show, forced]","params":[{"name":"show","type":"Boolean","description":"if true opens map, if false closes map, provided it is not *forced*.","type_expr":"Boolean"},{"name":"forced","type":"Boolean","description":"if true keeps map from closing when map is open. Arma 3 v2.06 if false, forces map to stay closed if *show* is false (see Example 1)","type_expr":"Boolean"}],"returns":{"type":"Boolean","type_expr":"Boolean","description":"equivalent of visibleMap"},"form":"unary","right":{"text":"[show, forced]"}}],"examples":[{"text":"```sqf\nopenMap [true, false];    // opens map normally\nopenMap [false, false];    // closes an opened map normally\nopenMap [true, true];    // force opens map and keeps it open (the user cannot close it on their own)\nopenMap [false, true];    // since Arma 3 2.06: prevents map from opening, closes open map and forces it to stay close (the user cannot open it on their own)\n```","code":["openMap [true, false];\t// opens map normally\nopenMap [false, false];\t// closes an opened map normally\nopenMap [true, true];\t// force opens map and keeps it open (the user cannot close it on their own)\nopenMap [false, true];\t// since Arma 3 2.06: prevents map from opening, closes open map and forces it to stay close (the user cannot open it on their own)"]}],"see_also":["forceMap","forcedMap","visibleMap","showMap","shownMap"],"notes":[{"user":"Fraali","date":"2021-12-08T11:00:58Z","text":"(**As of Arma 3 ver.2.06.148470**)\nTrying to close a map using `openMap false` inside of a map event handler like\n\n```sqf\naddMissionEventHandler [\"Map\", { openMap false }];\n```\n\nwill cause the game to crash.\nTo fix this, please use it inside of a spawned script.\n\n```sqf\naddMissionEventHandler [\"Map\", { 0 spawn { openMap false }; }];\n```\n\nThis should stop any issue of crashing when you close the map."}]}