HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Alright, why won't these triggers fire?

10-12-2004, 04:45 AM#1
a thing
I have two triggers that have time events but they never fire. I tried making them display text and nothing happened. The triggers are:




Code:
Spawn the spawns

    Events

        Time - Every 45.00 seconds of game time

    Conditions

    Actions

        -------- north --------

        -------- horde --------

        If (All Conditions are True) then do (Then Actions) else do (Else Actions)

            If - Conditions

                (Barracks 0012 <gen> is alive) Equal to True

            Then - Actions

                Unit - Create 3 Grunt for Player 11 (Dark Green) at (Center of north melee horde <gen>) facing 90.00 degrees

                Unit - Create 1 Tauren for Player 11 (Dark Green) at (Center of north melee horde <gen>) facing 90.00 degrees

            Else - Actions

        If (All Conditions are True) then do (Then Actions) else do (Else Actions)

            If - Conditions

                (Spirit Lodge 0013 <gen> is alive) Equal to True

            Then - Actions

                Unit - Create 2 Troll Headhunter for Player 11 (Dark Green) at (Center of north melee horde <gen>) facing 90.00 degree

            Else - Actions

        -------- UD --------

        If (All Conditions are True) then do (Then Actions) else do (Else Actions)

            If - Conditions

                (Crypt 0027 <gen> is alive) Equal to True

            Then - Actions

                Unit - Create 3 Ghoul for Player 12 (Brown) at (Center of north melee UD <gen>) facing 180.00 degrees

                Unit - Create 1 Abomination for Player 12 (Brown) at (Center of north melee UD <gen>) facing 180.00 degrees

            Else - Actions

        If (All Conditions are True) then do (Then Actions) else do (Else Actions)

            If - Conditions

                (Temple of the Damned 0028 <gen> is alive) Equal to True

            Then - Actions

                Unit - Create 2 Crypt Fiend for Player 11 (Dark Green) at (Center of north fiends <gen>) facing 180.00 degrees

            Else - Actions

        -------- center --------

        -------- horde --------

        If (All Conditions are True) then do (Then Actions) else do (Else Actions)

            If - Conditions

                (Barracks 0017 <gen> is alive) Equal to True

            Then - Actions

                Unit - Create 3 Grunt for Player 11 (Dark Green) at (Center of center melee horde <gen>) facing 45.00 degrees

                Unit - Create 1 Tauren for Player 11 (Dark Green) at (Center of center melee horde <gen>) facing 45.00 degrees

            Else - Actions

        If (All Conditions are True) then do (Then Actions) else do (Else Actions)

            If - Conditions

                (Spirit Lodge 0016 <gen> is alive) Equal to True

            Then - Actions

                Unit - Create 2 Troll Headhunter for Player 11 (Dark Green) at (Center of center hh <gen>) facing 45.00 degrees

            Else - Actions

        -------- UD --------

        If (All Conditions are True) then do (Then Actions) else do (Else Actions)

            If - Conditions

                (Crypt 0030 <gen> is alive) Equal to True

            Then - Actions

                Unit - Create 3 Ghoul for Player 12 (Brown) at (Center of center melee UD <gen>) facing 225.00 degrees

                Unit - Create 1 Abomination for Player 12 (Brown) at (Center of center melee UD <gen>) facing 225.00 degrees

            Else - Actions

        If (All Conditions are True) then do (Then Actions) else do (Else Actions)

            If - Conditions

                (Temple of the Damned 0029 <gen> is alive) Equal to True

            Then - Actions

                Unit - Create 2 Crypt Fiend for Player 11 (Dark Green) at (Center of center fiends <gen>) facing 225.00 degrees

            Else - Actions

        -------- south --------

        -------- horde --------

        If (All Conditions are True) then do (Then Actions) else do (Else Actions)

            If - Conditions

                (Barracks 0014 <gen> is alive) Equal to True

            Then - Actions

                Unit - Create 3 Grunt for Player 11 (Dark Green) at (Center of south melee horde <gen>) facing 0.00 degrees

                Unit - Create 1 Tauren for Player 11 (Dark Green) at (Center of south melee horde <gen>) facing 0.00 degrees

            Else - Actions

        If (All Conditions are True) then do (Then Actions) else do (Else Actions)

            If - Conditions

                (Spirit Lodge 0015 <gen> is alive) Equal to True

            Then - Actions

                Unit - Create 2 Troll Headhunter for Player 11 (Dark Green) at (Center of center hh <gen>) facing 45.00 degrees

            Else - Actions

        -------- UD --------

        If (All Conditions are True) then do (Then Actions) else do (Else Actions)

            If - Conditions

                (Crypt 0031 <gen> is alive) Equal to True

            Then - Actions

                Unit - Create 3 Ghoul for Player 12 (Brown) at (Center of center melee UD <gen>) facing 270.00 degrees

                Unit - Create 1 Abomination for Player 12 (Brown) at (Center of center melee UD <gen>) facing 270.00 degrees

            Else - Actions

        If (All Conditions are True) then do (Then Actions) else do (Else Actions)

            If - Conditions

                (Temple of the Damned 0032 <gen> is alive) Equal to True

            Then - Actions

                Unit - Create 2 Crypt Fiend for Player 11 (Dark Green) at (Center of south fiends <gen>) facing 270.00 degrees

            Else - Actions



and




Code:
function ReviveHeroActions takes nothing returns nothing

    local integer i

    loop

        exitwhen i > 5

            if GetExpiredTimer() == udg_TimeTillRevival[i] then

                call ReviveHeroLoc( udg_Hero[i], GetRectCenter(gg_rct_Team_1_hero_spawn), true )

                call PanCameraToTimedLocForPlayer( ConvertedPlayer(i), GetRectCenter(gg_rct_Team_1_hero_spawn), 0 )

            endif

        set i = i + 1

    endloop

    loop

        exitwhen i > 10

            if GetExpiredTimer() == udg_TimeTillRevival[i] then

                call ReviveHeroLoc( udg_Hero[i], GetRectCenter(gg_rct_Team_2_hero_spawn), true )

                call PanCameraToTimedLocForPlayer( ConvertedPlayer(i), GetRectCenter(gg_rct_Team_2_hero_spawn), 0 )

            endif

        set i = i + 1

    endloop

endfunction



//===========================================================================

function InitTrig_Revive_hero takes nothing returns nothing

    local integer i

    set gg_trg_Revive_hero = CreateTrigger(  )

    loop

        exitwhen i > 10

        call TriggerRegisterTimerExpireEventBJ( gg_trg_Revive_hero, udg_TimeTillRevival[i] )

        set i = i + 1

    endloop

    call TriggerAddAction( gg_trg_Revive_hero, function ReviveHeroActions )

endfunction

The only trigger that does anything with the timers is:
Code:
function Trig_Hero_die_Conditions takes nothing returns boolean

    if ( not ( IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO) == true ) ) then

        return false

    endif

    return true

endfunction



function Trig_Hero_die_Actions takes nothing returns nothing

    call DisplayTimedTextToForce(GetPlayersAll(), 30, udg_PlayerName[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))] + "has been killed by " + udg_PlayerName[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] + "and will be revived in " + R2MS(GetHeroLevel(GetDyingUnit())*2.00) + ".")

    call StartTimerBJ( udg_TimeTillRevival[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))], false, ( I2R(GetHeroLevel(GetDyingUnit())) * 2.00 ) )

    call CreateTimerDialogBJ( GetLastCreatedTimerBJ(), GetUnitName(GetDyingUnit()) )

    call AdjustPlayerStateBJ( -200, GetOwningPlayer(GetDyingUnit()), PLAYER_STATE_RESOURCE_GOLD )

    call AdjustPlayerStateBJ( 200, GetOwningPlayer(GetKillingUnitBJ()), PLAYER_STATE_RESOURCE_GOLD )

endfunction



//===========================================================================

function InitTrig_Hero_death takes nothing returns nothing

    set gg_trg_Hero_death = CreateTrigger(  )

    call TriggerRegisterAnyUnitEventBJ( gg_trg_Hero_death, EVENT_PLAYER_UNIT_DEATH )

    call TriggerAddCondition( gg_trg_Hero_death, Condition( function Trig_Hero_die_Conditions ) )

    call TriggerAddAction( gg_trg_Hero_death, function Trig_Hero_die_Actions )

endfunction

All triggers in this map are on at int and I check in the Object Manager that triggers are never turned off.
10-12-2004, 05:09 AM#2
rtm2
This belongs in the jass section just post there ok?
10-12-2004, 05:22 AM#3
Guest
Just a guess, but in your revive hero loops, interger i isnt given a value before it goes through the loop. Without a value for i before the loop checks it the loop might exit immediately. However if i = 0 by default then just ignore everything I just said ^_^ .

As for the other stuff....I'm too tired right now.
10-12-2004, 05:27 AM#4
a thing
Quote:
Originally Posted by Krug
Just a guess, but in your revive hero loops, interger i isnt given a value before it goes through the loop. Without a value for i before the loop checks it the loop might exit immediately. However if i = 0 by default then just ignore everything I just said ^_^ .

As for the other stuff....I'm too tired right now.

Damn I always mess up on little tiny things like that. That fixed all of it.
10-12-2004, 05:27 AM#5
JoSanchez55
I just have one little peice of advice for you. If the If/Then/Else action you are using only has ONE action to be preformed, Then use the If/Then/Else action, not the If/Then/Else(Multiple Functions) action! I personally find it easier to read and deal with, and i think it is better because it reduces 'loops'. But i dont know.
Code:
If (((Triggering unit) is A structure) Equal to True) then do (Do nothing) else do (Do nothing)

But then again, if you think you may add actions to the If/Then/Else later, you save time by making it the multiple functions to begin with.
10-12-2004, 05:31 AM#6
a thing
Quote:
Originally Posted by JoSanchez55
I just have one little peice of advice for you. If the If/Then/Else action you are using only has ONE action to be preformed, Then use the If/Then/Else action, not the If/Then/Else(Multiple Functions) action! I personally find it easier to read and deal with, and i think it is better because it reduces 'loops'. But i dont know.
Code:
If (((Triggering unit) is A structure) Equal to True) then do (Do nothing) else do (Do nothing)

But then again, if you think you may add actions to the If/Then/Else later, you save time by making it the multiple functions to begin with.

I always do multiple functions. It's easier to read for me and if you need to add something later it's a lot easier than if you have it all on one line.