Wc3C.net

Wc3C.net (http://www.wc3c.net/forums.php)
-   Triggers & Scripts (http://www.wc3c.net/forumdisplay.php?f=8)
-   -   Totally stumped (http://www.wc3c.net/showthread.php?t=96446)

Dil999 08-29-2007 11:40 PM

Totally stumped
 
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

TaintedReality 08-30-2007 12:07 AM

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 :).

Dil999 08-30-2007 12:11 AM

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

Dil999 08-30-2007 10:34 PM

*bumb because I edited the above post*

Pyrogasm 08-31-2007 12:30 AM

Nothing at all happens? Is the player's gold subtracted? Does the debug message show?

Dil999 08-31-2007 01:02 AM

The debug message plays and the player's gold is subtracted. After that it does nothing.

Ammorth 08-31-2007 01:22 AM

put an "=" between i and its value when you declare it.

Dil999 08-31-2007 01:29 AM

Jesus... I have no idea why vJass syntax checker isnt correcting that, either.

NightBreeze 08-31-2007 01:29 AM

What happened to syntax checking? ^^


All times are GMT. The time now is 02:37 AM.

Powered by vBulletin (Copyright ©2000 - 2020, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services