• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Turn off map

Level 2
Joined
May 18, 2022
Messages
8
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 64
Joined
Aug 10, 2018
Messages
6,555
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,201
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,852
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
8
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
 
Top