1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[JASS] Terrain kill trig not working

Discussion in 'Triggers & Scripts' started by nooblet, Aug 15, 2009.

  1. nooblet

    nooblet

    Joined:
    Jun 26, 2007
    Messages:
    14
    Resources:
    0
    Resources:
    0
    Code (vJASS):
    function Trig_Snow_Actions takes nothing returns nothing
        local unit u=GetEnumUnit()
        local real x=GetUnitX(u)
        local real y=GetUnitY(u)
        local integer t=GetTerrainType(x,y)
        if(t==udg_TerrainKill)then
            if ( GetUnitTypeId(u) == 'Edem' ) then
                call AddSpecialEffectTargetUnitBJ( "origin", u, "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl" )
                call KillUnit(u)
            endif
        endif
        set u=null
    endfunction

    function InitTrig_Snow takes nothing returns nothing
        set gg_trg_Snow = CreateTrigger(  )
        call TriggerRegisterTimerEvent(gg_trg_Snow, 0.01, true)
        call TriggerAddAction( gg_trg_Snow, function Trig_Snow_Actions )
    endfunction
     


    udg_TerrainKill is set to the tile Ywmb in a seperate trigger.

    I just cant find anything wrong, maybe one of you can?
     
  2. EpixBelongToMe

    EpixBelongToMe

    Joined:
    Aug 19, 2006
    Messages:
    188
    Resources:
    1
    Maps:
    1
    Resources:
    1
    you have a trigger that runs every 0.01 seconds but he can't really do anything because the actions don't fit the Init functions. because you need to register an unitevent so he can refer to your unit and run the actions.

    so you need another initfunction for the trigger but i never did something like that and don't know the right functions actually
     
  3. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    26,199
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    local unit u=GetEnumUnit()

    is the same as

    local unit u=null

    Thus it works perfectly with exception for there being actually no unit involved.