openMap: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "Category:Scripting Commands ArmA2" to "Category:Scripting Commands Arma 2")
m (Text replacement - "// since Arma 3" to "// since {{arma3}}")
 
(49 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| arma2 |Game name=
|game1= arma2
|version1= 1.03


|1.03|Game version=
|game2= arma2oa
|version2= 1.50


|eff= local|Multiplayer Effects=
|game3= tkoh
____________________________________________________________________________________________
|version3= 1.00


| Opens or closes in-game map.<br><br>
|game4= arma3
{{Warning | If <tt>forced</tt> param is set to [[true]], when map is opened it cannot be closed manually and the user can get stuck requiring the game restart. Make sure you provide scripted mechanics to resolve this, should you need to force the map.}} |DESCRIPTION=
|version4= 0.50
____________________________________________________________________________________________


| [[openMap]] show |SYNTAX=
|eff= local


|p1= show: [[Boolean]] - if [[true]] opens map, if [[false]] closes map, provided it is not ''forced'' |PARAMETER1=
|gr1= Map


| [[Boolean]] - equivalent of [[visibleMap]] |RETURNVALUE=
|gr2= Interaction
____________________________________________________________________________________________


|s2= [[openMap]] [show, forced] |SYNTAX2=
|descr= Opens or closes in-game map.
{{Feature|warning|
If {{hl|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.
Make sure you provide scripted mechanics to resolve this, should you need to force the map.
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.
}}


|p21= show: [[Boolean]] - if [[true]] opens map, if [[false]] closes map, provided it is not ''forced''. |PARAMETER21=
|s1= [[openMap]] show


|p22= forced: [[Boolean]] - if [[true]] keeps map from closing when map is open. |Parameter22=
|p1= show: [[Boolean]] - if [[true]] opens map, if [[false]] closes map, provided it is not ''forced''


|r2= [[Boolean]] - equivalent of [[visibleMap]]|RETURNVALUE2=
|r1= [[Boolean]] - equivalent of [[visibleMap]]
____________________________________________________________________________________________


|x1= <code>[[openMap]] [[true]];</code> |EXAMPLE1=
|s2= [[openMap]] [show, forced]


|x2= <code>[[openMap]] <nowiki>[</nowiki>[[true]], [[true]]];</code> |EXAMPLE2=
|p21= show: [[Boolean]] - if [[true]] opens map, if [[false]] closes map, provided it is not ''forced''.


____________________________________________________________________________________________
|p22= forced: [[Boolean]] - if [[true]] keeps map from closing when map is open. {{GVI|arma3|2.06|size= 0.75}} if [[false]], forces map to stay closed if ''show'' is [[false]] (see {{Link|#Example 1}})


| [[forceMap]], [[forcedMap]], [[visibleMap]], [[showMap]], [[shownMap]] |SEEALSO=
|r2= [[Boolean]] - equivalent of [[visibleMap]]
}}


<h3 style='display:none'>Notes</h3>
|x1= <sqf>
<dl class='command_description'>
openMap [true, false]; // opens map normally
<!-- Note Section BEGIN -->
openMap [false, false]; // closes an opened map normally
openMap [true, true]; // force opens map and keeps it open (the user cannot close it on their own)
openMap [false, true]; // since {{arma3}} 2.06: prevents map from opening, closes open map and forces it to stay close (the user cannot open it on their own)
</sqf>


<!-- Note Section END -->
|seealso= [[forceMap]] [[forcedMap]] [[visibleMap]] [[showMap]] [[shownMap]]
</dl>
}}


<h3 style='display:none'>Bottom Section</h3>
{{Note
 
|user= Fraali
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
|timestamp= 20211208110058
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
|text= ('''As of Arma 3 ver.2.06.148470''') <br>
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
Trying to close a map using <sqf inline>openMap false</sqf> inside of a map event handler like
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
<sqf>addMissionEventHandler ["Map", { openMap false }];</sqf>
will cause the game to crash.<br>
To fix this, please use it inside of a spawned script.
<sqf>addMissionEventHandler ["Map", { 0 spawn { openMap false }; }];</sqf>
<br>
This should stop any issue of crashing when you close the map.
}}

Latest revision as of 18:02, 18 November 2023

Hover & click on the images for description

Description

Description:
Opens or closes in-game map.
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.

Make sure you provide scripted mechanics to resolve this, should you need to force the map.

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.
Groups:
MapInteraction

Syntax

Syntax:
openMap show
Parameters:
show: Boolean - if true opens map, if false closes map, provided it is not forced
Return Value:
Boolean - equivalent of visibleMap

Alternative Syntax

Syntax:
openMap [show, forced]
Parameters:
show: Boolean - if true opens map, if false closes map, provided it is not forced.
forced: Boolean - if true keeps map from closing when map is open. Arma 3 logo black.png2.06 if false, forces map to stay closed if show is false (see Example 1)
Return Value:
Boolean - equivalent of visibleMap

Examples

Example 1:
openMap [true, false]; // opens map normally openMap [false, false]; // closes an opened map normally openMap [true, true]; // force opens map and keeps it open (the user cannot close it on their own) openMap [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)

Additional Information

See also:
forceMap forcedMap visibleMap showMap shownMap

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Fraali - c
Posted on Dec 08, 2021 - 11:00 (UTC)
(As of Arma 3 ver.2.06.148470)
Trying to close a map using openMap false inside of a map event handler like
addMissionEventHandler ["Map", { openMap false }];
will cause the game to crash.
To fix this, please use it inside of a spawned script.
addMissionEventHandler ["Map", { 0 spawn { openMap false }; }];

This should stop any issue of crashing when you close the map.