HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Totally stumped

08-29-2007, 11:40 PM#1
Dil999
This trigger should do damage every .10 seconds to every unit in lava. I tried everything to get it to work, and when I but debug messages in I realized, the actions arent even running! Can anyone tell why?
Collapse JASS:
function FirePit_Filter takes nothing returns boolean
    return GetTerrainType(GetUnitX(GetFilterUnit()),GetUnitY(GetFilterUnit())) == 'Dlav' 
endfunction

function FirePit takes nothing returns nothing
    local group g = CreateGroup()
    local unit u
    local PlayerData pd = PlayerData(GetHandleInt(GetOwningPlayer(u),"pd"))
    call BJDebugMsg("running")
    
    call GroupEnumUnitsInRect(g,GetPlayableMapRect(),Filter(function FirePit_Filter))
    
        loop
            set u = FirstOfGroup(g)
            exitwhen u == null
                if not (pd.isfireimmune) and not (pd.isinvuln) then
                    call SetUnitState(u,UNIT_STATE_LIFE,GetUnitState(u,UNIT_STATE_LIFE) - 10.0)
                endif
            call GroupRemoveUnit(g,u)
        endloop
     
    call DestroyGroup(g)
    set u = null
endfunction

function InitTrig_FirePit takes nothing returns nothing
    set gg_trg_FirePit = CreateTrigger()
    call TriggerAddAction(gg_trg_FirePit,function FirePit)
    call TriggerRegisterTimerEvent(gg_trg_FirePit,0.05,true)
endfunction
08-30-2007, 12:07 AM#2
TaintedReality
You use the u variable when it's null.

Collapse JASS:
    local unit u
    local PlayerData pd = PlayerData(GetHandleInt(GetOwningPlayer(-->u<--),"pd"))

That runs before your debug message so that's why you never see it.

Oh and btw, you say it should damage every 0.1 seconds but the trigger seems to be running every 0.05 :).
08-30-2007, 12:11 AM#3
Dil999
Heres one more thing I cant figure out. This trigger should be changing some global variables and reviving the hero 5 seconds later. It does nothing. I tested and know the trigger is running and the struct is ok.
Collapse JASS:
function Death_Actions takes nothing returns nothing
    local unit u = GetDyingUnit()
    local player p = GetOwningPlayer(u)
    local PlayerData pd = PlayerData(GetHandleInt(p,"pd"))
    local player p2 = pd.killer
    local integer i GetPlayerId(p)
    local integer i2 = GetPlayerId(p2)
    local integer i3 = 0
    
    local real angle = GetRandomReal(0.0,360.0)
    local real distance = GetRandomReal(600.0,2000.0)
    local real x = GetRectCenterX(gg_rct_FirePit) + distance * Cos(angle * bj_DEGTORAD)
    local real y = GetRectCenterY(gg_rct_FirePit) + distance * Sin(angle * bj_DEGTORAD)
    
    call BJDebugMsg(GetPlayerName(p2))
    
    
    call SetPlayerState(p2,PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(p2,PLAYER_STATE_RESOURCE_GOLD) - 7)
    
    if i != i2 then
        set udg_Kills[i2] = udg_Kills[i2] + 1
        call DisplayTextToForce(GetPlayersAll(),GetPlayerName(p)+ "has died!")
    else
        set udg_Kills[i2] = udg_Kills[i2] - 1
        call DisplayTextToForce(GetPlayersAll(),GetPlayerName(p)+ "has killed himself!")
    endif
    
    
    call LeaderboardSetItemValue(GetLastCreatedLeaderboard(),i2,udg_Kills[i2])
    
    
        if udg_Kills[i2] >= 10 then
            loop
                call CustomDefeatBJ(Player(i3),GetPlayerName(p2)+ "has won!")
                set i3 = i3 + 1
                exitwhen i3 >= 11
            endloop
        endif
    
    call PolledWait(5.0)
    
    call ReviveHero(u,x,y,true)
    call SelectUnitForPlayerSingle(u,GetOwningPlayer(u))
    call PanCameraToForPlayer(GetOwningPlayer(u),x,y)
    
    
    set u = null
    set p = null
    set p2 = null
endfunction



function Death_Conditions takes nothing returns boolean
    return GetUnitTypeId(GetTriggerUnit()) == 'O001'
endfunction

function InitTrig_Death takes nothing returns nothing
    set gg_trg_Death = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Death, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_Death, Condition( function Death_Conditions ) )
    call TriggerAddAction( gg_trg_Death, function Death_Actions )
endfunction
08-30-2007, 10:34 PM#4
Dil999
*bumb because I edited the above post*
08-31-2007, 12:30 AM#5
Pyrogasm
Nothing at all happens? Is the player's gold subtracted? Does the debug message show?
08-31-2007, 01:02 AM#6
Dil999
The debug message plays and the player's gold is subtracted. After that it does nothing.
08-31-2007, 01:22 AM#7
Ammorth
put an "=" between i and its value when you declare it.
08-31-2007, 01:29 AM#8
Dil999
Jesus... I have no idea why vJass syntax checker isnt correcting that, either.
08-31-2007, 01:29 AM#9
NightBreeze
What happened to syntax checking? ^^