• 🏆 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!

FogModifiers (How do they work?)

Status
Not open for further replies.
Level 13
Joined
Jul 26, 2008
Messages
1,009
Alright so I have a fog modifier set up to allow the player to see the entire map:

JASS:
    set DM_Fog[id] = CreateFogModifierRect( GetEnumPlayer(), FOG_OF_WAR_VISIBLE, GetWorldBounds(), true, false )
    call FogModifierStart(DM_Fog[id])

Now, I want to make it so the player can no longer see the entire map. But I don't seem to be able to do that:

JASS:
    call FogModifierStop(DM_Fog[id])
    call DestroyFogModifier(DM_Fog[id])
    set DM_Fog[id] = CreateFogModifierRect(pl, FOG_OF_WAR_MASKED, GetWorldBounds(), true, false)
    call FogModifierStart(DM_Fog[id])

But this does not make the entire map masked for the player. Instead the player still sees everything.

How do I make it so the player is bound to the fog of war again?
 
Level 13
Joined
Jul 26, 2008
Messages
1,009
Did, checked it using BJDebug and it returned the right id (Player Ids + 1)

And I only see a DestroyFogMOdifier command no DestroyVisibilityMOdifier command.

I'm pretty sure I'm destroying the right Fog Modifier though in the second one and re-creating the fog that impedes vision. I know if I just destroy the Fog Modifier it doesn't stop the player from seeing the whole map.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
First of all, I have to make sure that everything is OK.

Test this, Create a trigger named "Reveal Map" then paste this and press ESCAPE when you test.

JASS:
function Trig_Reveal_Map_Actions takes nothing returns nothing
    local rect r = GetWorldBounds()
    call DisableTrigger( GetTriggeringTrigger() )
    set udg_VM = CreateFogModifierRect(Player(0), FOG_OF_WAR_VISIBLE, r, true, false)
    call FogModifierStart(udg_VM)
    call TriggerSleepAction( 5.00 )
    call FogModifierStop(udg_VM)
    call DestroyFogModifier( udg_VM )
    set udg_VM = CreateFogModifierRect(Player(0), FOG_OF_WAR_MASKED, r, true, false)
    call FogModifierStart(udg_VM)
endfunction

//===========================================================================
function InitTrig_Reveal_Map takes nothing returns nothing
    set gg_trg_Reveal_Map = CreateTrigger(  )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Reveal_Map, Player(0) )
    call TriggerAddAction( gg_trg_Reveal_Map, function Trig_Reveal_Map_Actions )
endfunction

if it worked then you have something wrong with the variables in your trigger.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
Nope. Hitting esc didn't work to make the trigger do what it was suppose to do (Show Map, Hide Map)

But I dont' think the trigger is firing either. I put in a BJDebug message that never appeared.

Its important that you create the trigger with the name I mentioned.

"Reveal Map" not "RevealMap"

if it didn't work then there is a problem that I don't know of because when I tested it in my map it worked pretty fine.
 
Status
Not open for further replies.
Top