HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger not doing anything

06-04-2004, 11:41 PM#1
-={tWiStÄr}=-
My trigger does nothing..... its supposed to do something.. but i did some test and found out it isnt even being started. i tried another one with exact same condition and event and it worked fine.. so whats up?
Code:
function Trig_FleeON_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A004'
endfunction

function Trig_FleeON_Func0001 takes nothing returns boolean
    local player pl = GetOwningPlayer(GetSpellAbilityUnit())
    return pl == Player(0) or pl == Player(2) or pl == Player(4) or pl == Player(6) or pl == Player(8)
endfunction

function Trig_FleeON_Actions takes nothing returns nothing
    local real life
    local integer skilllevel = ( GetUnitAbilityLevelSwapped('A004', GetSpellAbilityUnit()) + 10 )
    local integer i
    local location heroloc = GetUnitLoc(GetSpellAbilityUnit())
    if ( Trig_FleeON_Func0001() ) then
        set udg_i = 5
    else
        set udg_i = 6
    endif
    set udg_transformhero[i] = GetSpellAbilityUnit()
    call CreateNUnitsAtLoc( 1, udg_Transformunittype[skilllevel], GetOwningPlayer(GetSpellAbilityUnit()), heroloc, bj_UNIT_FACING )
    set udg_TransformGameUnit[i] = GetLastCreatedUnit()    
    set life = GetUnitLifePercent(udg_transformhero[i])
    call SetUnitLifePercentBJ(udg_TransformGameUnit[i], life)
    call SetUnitOwner( udg_transformhero[i], Player(bj_PLAYER_NEUTRAL_EXTRA), true )
    call SetUnitPositionLoc( udg_transformhero[i], GetRectCenter(gg_rct_Heromove) )
    call IssueImmediateOrderBJ( udg_TransformGameUnit[i], "stop" )
    call SelectUnitAddForPlayer( udg_TransformGameUnit[i], GetOwningPlayer(udg_TransformGameUnit[i]) )
    call StartTimerBJ( udg_fleetimer[i], false, I2R(( ( ( udg_skilllevel - 10 ) * 5 ) + 10 )) )
    call DisplayTimedTextToPlayer(Player(0), 0, 0, 10.00, "it worked")
endfunction

//===========================================================================
function InitTrig_FleeON takes nothing returns nothing
    set gg_trg_FleeON = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_FleeON, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_FleeON, Condition( function Trig_FleeON_Conditions ) )
    call TriggerAddAction( gg_trg_FleeON, function Trig_FleeON_Actions )
endfunction
I'm sure it's something simple.. but im getting bored of this stuff.
06-05-2004, 01:40 PM#2
AIAndy
i has not been initialised when you use it in
set udg_transformhero[i] = GetSpellAbilityUnit()
06-05-2004, 04:35 PM#3
-={tWiStÄr}=-
DOH! man it was late when i made that... thx :D