Fog of War Glitch

MasterOfRa

New Member
Reaction score
10
I am trying to add to my map, a event that on death, will give the player visibility. but also, when i use the restart command, remove it. I looked at the BJs, and did what i thought made sense, but it didnt work. is it not possible to store a fogmodifier to a variable? or should i just use a dummy unit or something?

JASS:

globals
    fogmodifier array Fog
    constant real MAP_SIZE    = 23 * 128 - 100
endglobals

JASS:
library MagiDies initializer Init uses UnitProperties
//===========================================================================
private function Actions takes nothing returns nothing
    local unit killee = GetDyingUnit()
    local unit killer = GetKillingUnit()
    local player owner = GetOwningPlayer(killee)
    local MagiProperties data   = GetUnitIndex(killee)
    local properties prop = properties(GetUnitId(data.owner))
    set data.owner = null
    if GetUnitAbilityLevel(killer,AID_DEVOUR) == 0 then
        if GetLocalPlayer() == owner then
            call DisplayTextToPlayer(GetLocalPlayer(), 0.52, -1.00,"You have been Killed!")
        else
            call DisplayTextToPlayer(GetLocalPlayer(), 0.52, -1.00,GetPlayerName(owner)+" has been Killed!")
        endif
    endif
    call prop.destroy()
    call data.destroy()
    call TriggerSleepAction(4.0)
    call FogModifierStart(Fog[GetPlayerId(owner)])
    set killee = null
    set killer = null
endfunction
//===========================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger()
    
    
    
    call TriggerRegisterPlayerUnitEvent(trig,Player(0),EVENT_PLAYER_UNIT_DEATH,null)
    call TriggerRegisterPlayerUnitEvent(trig,Player(1),EVENT_PLAYER_UNIT_DEATH,null)
    call TriggerRegisterPlayerUnitEvent(trig,Player(2),EVENT_PLAYER_UNIT_DEATH,null)
    call TriggerRegisterPlayerUnitEvent(trig,Player(3),EVENT_PLAYER_UNIT_DEATH,null)
    call TriggerRegisterPlayerUnitEvent(trig,Player(4),EVENT_PLAYER_UNIT_DEATH,null)
    call TriggerRegisterPlayerUnitEvent(trig,Player(5),EVENT_PLAYER_UNIT_DEATH,null)
    call TriggerRegisterPlayerUnitEvent(trig,Player(6),EVENT_PLAYER_UNIT_DEATH,null)
    call TriggerRegisterPlayerUnitEvent(trig,Player(7),EVENT_PLAYER_UNIT_DEATH,null)
    call TriggerAddAction(trig,function Actions)
    
endfunction

endlibrary

JASS:
library Init initializer Init uses Globals, Waves
globals
    private real AngleDelta
endglobals
private function CreateStuff takes nothing returns nothing
    local MagiProperties prop
    local integer count = 0
    local unit u
    local real x
    local real y
    local real angle = 0
    set Magi = 0
    set AngleDelta = 360/CountPlayers()
    call TriggerSleepAction(001)
    loop
        if GetPlayerSlotState(Player(count)) == PLAYER_SLOT_STATE_PLAYING then
            call SetPlayerState(Player(count),PLAYER_STATE_RESOURCE_GOLD,0)
            set x = GetStartLocationX(GetPlayerStartLocation(Player(count)))
            set y = GetStartLocationY(GetPlayerStartLocation(Player(count)))
            set u = CreateUnit(Player(count),UID_MAGI,x+300*CosBJ(angle),y+300*SinBJ(angle),angle-200)
            set magi[count] = u
            call CreateUnitProperties(u)
            call UnitSetMaxLife    (u,100)
            call UnitSetMaxMana    (u,1000)
            call UnitSetMoveSpeed  (u,300)
            set prop = GetUnitIndex(u)
            set prop.owner   = u
            set prop.manaGen = 35
            set prop.lifeGen = 0.7
            set MagiProperties<u>    = prop
            set angle = angle + AngleDelta
            set Magi = Magi + 1
        endif
        set count = count + 1
        exitwhen count &gt;= MAX_MAGI
    endloop
endfunction
function Restart takes nothing returns nothing
    local properties prop
    local MagiProperties data
    local group g = NewGroup()
    local unit u
    local integer count = 0
    call Waves_Restart()
    loop
        call FogModifierStop(Fog[count])
        if magi[count] != null then
            set prop = GetUnitId(magi[count])
            set data = GetUnitIndex(magi[count])
            set data.owner = null
            call prop.destroy()
            call data.destroy()
            call RemoveUnit(magi[count])
            set Magi = Magi - 1
        endif
        set count = count + 1
        exitwhen count &gt;= MAX_MAGI 
    endloop
    call GroupEnumUnitsInRange(g,0,0,6000,Filter_Alive())
    loop 
        set u = FirstOfGroup(g)
        exitwhen u == null
        call GroupRemoveUnit(g,u)
        call RemoveUnit(u)
    endloop
    call CreateStuff()
endfunction
private function Init takes nothing returns nothing
    local trigger trig = NewTrigger()
    local integer count = 0
    local integer x = 0
    local integer y
    call TriggerRegisterPlayerChatEvent( trig , Player(0), &quot;-game.restart&quot; , true )
    call TriggerAddAction( trig , function Restart)
    set trig = null
    loop
        set magi[count] = null
        set count = count + 1
        set Fog[count] = CreateFogModifierRadius(Player(count),FOG_OF_WAR_VISIBLE,0,0,MAP_SIZE,true,false)
        exitwhen count &gt;= MAX_MAGI 
    endloop
    call CreateStuff()
endfunction
endlibrary</u>
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top