Turn off map

Status
Not open for further replies.
Level 2
Joined
May 18, 2022
Messages
9
Hello Guys&Ladies
Is it possible to turn off minimap via trigger ?
I need to turn of minimap for triggering player for example 10 seconds and then bring the map back. Should somone help ?
Thanks Wormskayy
 

Uncle

Warcraft Moderator
Level 69
Joined
Aug 10, 2018
Messages
7,175
Everything related to ui:

I've got it working like so. Create a new custom script file in the Trigger Editor (Control + U) and add this code to it:
vJASS:
function HideMinimapForPlayer takes player p returns nothing
if GetLocalPlayer() == p then
    call BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0), false)
endif
endfunction

function ShowMinimapForPlayer takes player p returns nothing
if GetLocalPlayer() == p then
    call BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0), true)
endif
endfunction
Make sure JassHelper is enabled (look at the top window of the Trigger Editor and you'll see a menu for it).

Then you can run these functions in your triggers:
  • Actions
    • Set Variable MinimapPlayer = (some player)
    • Custom script: call HideMinimapForPlayer(udg_MinimapPlayer)
    • Wait 10.00 game-time seconds
    • Set Variable MinimapPlayer = (some player)
    • Custom script: call ShowMinimapForPlayer(udg_MinimapPlayer)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,241
Provided trigger uses JASS. If you are using Lua you will need to port it to Lua first.

Also requires newer versions of Warcraft III with UI native support. Legacy versions might be lacking those natives.

Traditionally (long long ago) the way to kind of do what you want was to import a blank minimap image and then dynamically set map camera bounds so that the minimap showed no useful information. There might have been more or less polished variants of that approach but that was likely the only sensible way before UI natives were added.
 
Level 24
Joined
Jun 26, 2020
Messages
1,884
Everything related to ui:

I've got it working like so. Create a new custom script file in the Trigger Editor (Control + U) and add this code to it:
vJASS:
function HideMinimapForPlayer takes player p returns nothing
if GetLocalPlayer() == p then
    call BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0), false)
endif
endfunction

function ShowMinimapForPlayer takes player p returns nothing
if GetLocalPlayer() == p then
    call BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0), true)
endif
endfunction
Make sure JassHelper is enabled (look at the top window of the Trigger Editor and you'll see a menu for it).

Then you can run these functions in your triggers:
  • Actions
    • Set Variable MinimapPlayer = (some player)
    • Custom script: call HideMinimapForPlayer(udg_MinimapPlayer)
    • Wait 10.00 game-time seconds
    • Set Variable MinimapPlayer = (some player)
    • Custom script: call ShowMinimapForPlayer(udg_MinimapPlayer)
I have understood that calling BlzGetOriginFrame() for the first time in a GetLocalPlayer() block may cause a desync, so for safety reasons it would be better do something like this:
vJASS:
globals
    framehandle Minimap = null
endglobals

function HideMinimapForPlayer takes player p returns nothing
    if Minimap == null then
        set Minimap = BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0)
    endif
    if GetLocalPlayer() == p then
        call BlzFrameSetVisible(Minimap, false)
    endif
endfunction

function ShowMinimapForPlayer takes player p returns nothing
    if Minimap == null then
        set Minimap = BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0)
    endif
    if GetLocalPlayer() == p then
        call BlzFrameSetVisible(Minimap, true)
    endif
endfunction
 
Level 2
Joined
May 18, 2022
Messages
9
Thanks guys. I will try it when i will be home. I need to check jass also. I think i have older version of WE. But thanks a lot
 
Status
Not open for further replies.
Top