1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[JASS] Difficult Problem (this is not like the other i posted, it is the next level in J

Discussion in 'Triggers & Scripts' started by Flame_Phoenix, Aug 28, 2007.

  1. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    Purple !!! i have an urgent problem !!! My trigger... it seems that it doesn't work now !! why !!! please tell me what is wrong !!!

    Code (vJASS):
    function army_acts takes nothing returns nothing  
        local player P1 = Player(0)
        local player P6 = Player(5)
        local unit gate
        local unit m1
        local unit m2
        local unit m3
        local unit m4
        local unit m5
        local unit m6
        local unit m7
        local unit m8
        local unit r1
        local unit r2
        local unit r3
        local unit r4
        local unit r5
        local unit r6
        local unit r7
        local unit r8
        local unit h1
        local unit t = GetTrainedUnit()
        local effect ef
        local effect ef1
        local effect ef2
        local effect ef3
        local effect ef4
        local effect ef5
        local effect ef6
        local effect ef7
        local effect ef8
        local effect ef9
        local effect ef10
        local effect ef11
        local effect ef12
        local effect ef13
        local effect ef14
        call GroupAddUnit(udg_UT[0], t)
        if CountUnitsInGroup(udg_UT[0]) == 2 then
    //Shake camera        
    call CameraSetTargetNoiseEx(10, 500000, true)  
            call CameraSetSourceNoiseEx(10, 500000, true)  
    //Add effect 1        
    set ef = AddSpecialEffect("Abilities\\Spells\\Human\\FlameStrike\\FlameStrikeTarget.mdl",-6030.5, 5450.5)
            call TriggerSleepAction(1.0)  
    //create gate and set animation's spped        
    set gate = CreateUnit( P6, 'hprt', -6030.5, 5450.5, 270.0)
            call SetUnitAnimation(gate, "birth")
            call SetUnitTimeScale(gate, 80.00 * 0.01)
    //Terrain deformatin        
    call TerrainDeformationRippleBJ( 7.50, false, Location(-6030.50, 5450.50), 100.00, 800.00, -150.00, 0.35, 1.00 )
    //Now here is the set of animations, which will create trap frosts in the folowing coordinates.    However, sometimes this section is activated ... sometimes IS NOT !!! WHY !    
    set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 5335.5)
            set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 5335.5)
            call TriggerSleepAction(0.5)
            call DestroyEffect(ef1)
            call DestroyEffect(ef2)
            set ef3 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 5185.5)
            set ef4 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 5185.5)
            call TriggerSleepAction(0.5)
            call DestroyEffect(ef3)
            call DestroyEffect(ef4)
            set ef5 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 5035.5)
            set ef6 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 5035.5)
            call TriggerSleepAction(0.5)
            call DestroyEffect(ef5)
            call DestroyEffect(ef6)
            set ef7 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4885.5)
            set ef8 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4885.5)
            call TriggerSleepAction(0.5)
            call DestroyEffect(ef7)
            call DestroyEffect(ef8)
            set ef9 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4735.5)
            set ef10 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4735.5)
            call TriggerSleepAction(0.5)
            call DestroyEffect(ef9)
            call DestroyEffect(ef10)
            set ef11 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4585.5)
            set ef12 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4585.5)
            call TriggerSleepAction(0.5)
            call DestroyEffect(ef11)
            call DestroyEffect(ef12)
            set ef13 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4435.5)
            set ef14 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4435.5)
            call TriggerSleepAction(0.5)
            call DestroyEffect(ef13)
            call DestroyEffect(ef14)
    //Units and txt
    call DestroyEffect(ef)
            call DisplayTextToForce (bj_FORCE_ALL_PLAYERS, ( "The First Northrend Army arrived to aid |cffff0000" + ( GetPlayerName(P1) + "|r and his alliance !!!!! " ) ) )
            set h1 = CreateUnit(P6, 'H015', -6040.5, 5235.0, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -6040.5, 5235.0, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(h1, true)
            call SetUnitMoveSpeed( h1, ( GetUnitDefaultMoveSpeed(h1)/2))
            call IssuePointOrder(h1, "move", -6040.5, 4450.0)
            call TriggerSleepAction (0.75)
            set m1 = CreateUnit(P6, 'h00B', -6160.0, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -6161.0, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(m1, true)
            call SetUnitMoveSpeed( m1, ( GetUnitDefaultMoveSpeed(m1)/2))
            set m2 = CreateUnit(P6, 'h00B', -6065.3, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -6065.3, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(m2, true)
            call SetUnitMoveSpeed( m2, ( GetUnitDefaultMoveSpeed(m2)/2 ))
            set m3 = CreateUnit(P6, 'h00B', -5970.5, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -5973.5, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(m3, true)
            call SetUnitMoveSpeed( m3, ( GetUnitDefaultMoveSpeed(m3) /2 ))
            set m4 = CreateUnit(P6, 'h00B', -5875.5, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -5874.2, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(m4, true)
            call SetUnitMoveSpeed( m4, ( GetUnitDefaultMoveSpeed(m4) /2))
            call IssuePointOrder(m1, "move", -6160.0,4545.0)
            call IssuePointOrder(m2, "move", -6065.3,4545.0)
            call IssuePointOrder(m3, "move", -5970.5,4545.0)
            call IssuePointOrder(m4, "move", -5875.2,4545.0)
            call TriggerSleepAction(0.75)
            set m5 = CreateUnit(P6, 'h00B', -6160.0, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -6161.0, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(m5, true)
            call SetUnitMoveSpeed( m5, ( GetUnitDefaultMoveSpeed(m5)/2))
            set m6 = CreateUnit(P6, 'h00B', -6065.0, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -6065.0, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(m6, true)
            call SetUnitMoveSpeed( m6, ( GetUnitDefaultMoveSpeed(m6)/2 ))
            set m7 = CreateUnit(P6, 'h00B', -5970.5, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -5970.5, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(m7, true)
            call SetUnitMoveSpeed( m7, ( GetUnitDefaultMoveSpeed(m7) /2 ))
            set m8 = CreateUnit(P6, 'h00B', -5875.0, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -5875.0, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(m8, true)
            call SetUnitMoveSpeed( m8, ( GetUnitDefaultMoveSpeed(m8) /2))
            call IssuePointOrder(m5, "move", -6161.0,4635.0)
            call IssuePointOrder(m6, "move", -6065.3,4635.0)
            call IssuePointOrder(m7, "move", -5973.5,4635.0)
            call IssuePointOrder(m8, "move", -5874.2,4635.0)
            call TriggerSleepAction(0.75)
            set r1 = CreateUnit(P6, 'hrif', -6160.0, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -6160.0, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(r1, true)
            call SetUnitMoveSpeed( r1, ( GetUnitDefaultMoveSpeed(r1)/2 ))
            set r2 = CreateUnit(P6, 'hrif', -6065.0, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -6065.0, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(r2, true)
            call SetUnitMoveSpeed( r2, ( GetUnitDefaultMoveSpeed(r2)/2 ))
            set r3 = CreateUnit(P6, 'hrif', -5970.5, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -5970.5, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(r3, true)
            call SetUnitMoveSpeed( r3, ( GetUnitDefaultMoveSpeed(r3)/2 ))
            set r4 = CreateUnit(P6, 'hrif', -5875.0, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -5875.0, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(r4, true)
            call SetUnitMoveSpeed( r4, ( GetUnitDefaultMoveSpeed(r4)/2))
            call IssuePointOrder(r1, "move", -6160.0,4735.0)
            call IssuePointOrder(r2, "move", -6065.0,4735.0)
            call IssuePointOrder(r3, "move", -5970.5,4735.0)
            call IssuePointOrder(r4, "move", -5875.0,4735.0)
            call TriggerSleepAction(0.75)
            set r5 = CreateUnit(P6, 'hrif', -6160.0, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -6160.0, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(r5, true)
            call SetUnitMoveSpeed( r5, ( GetUnitDefaultMoveSpeed(r5)/2 ))
            set r6 = CreateUnit(P6, 'hrif', -6065.0, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -6065.0, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(r6, true)
            call SetUnitMoveSpeed( r6, ( GetUnitDefaultMoveSpeed(r6)/2 ))
            set r7 = CreateUnit(P6, 'hrif', -5970.5, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -5970.5, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(r7, true)
            call SetUnitMoveSpeed( r7, ( GetUnitDefaultMoveSpeed(r7)/2 ))
            set r8 = CreateUnit(P6, 'hrif', -5875.0, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -5875.0, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(r8, true)
            call SetUnitMoveSpeed( r8, ( GetUnitDefaultMoveSpeed(r8)/2))
            call IssuePointOrder(r5, "move", -6160.0,4840.0)
            call IssuePointOrder(r6, "move", -6065.0,4840.0)
            call IssuePointOrder(r7, "move", -5970.5,4840.0)
            call IssuePointOrder(r8, "move", -5875.0,4840.0)
            call TriggerSleepAction(5.00)
            call SetUnitInvulnerable(h1, false)
            call SetUnitInvulnerable(m1, false)
            call SetUnitInvulnerable(m2, false)
            call SetUnitInvulnerable(m3, false)
            call SetUnitInvulnerable(m4, false)
            call SetUnitInvulnerable(m5, false)
            call SetUnitInvulnerable(m6, false)
            call SetUnitInvulnerable(m7, false)
            call SetUnitInvulnerable(m8, false)
            call SetUnitInvulnerable(r1, false)
            call SetUnitInvulnerable(r2, false)
            call SetUnitInvulnerable(r3, false)
            call SetUnitInvulnerable(r4, false)
            call SetUnitInvulnerable(r5, false)
            call SetUnitInvulnerable(r6, false)
            call SetUnitInvulnerable(r7, false)
            call SetUnitInvulnerable(r8, false)
            call SetUnitOwner(m1, P1, true)
            call SetUnitOwner(m2, P1, true)
            call SetUnitOwner(m3, P1, true)
            call SetUnitOwner(m4, P1, true)
            call SetUnitOwner(m5, P1, true)
            call SetUnitOwner(m6, P1, true)
            call SetUnitOwner(m7, P1, true)
            call SetUnitOwner(m8, P1, true)
            call SetUnitOwner(r1, P1, true)
            call SetUnitOwner(r2, P1, true)
            call SetUnitOwner(r3, P1, true)
            call SetUnitOwner(r4, P1, true)
            call SetUnitOwner(r5, P1, true)
            call SetUnitOwner(r6, P1, true)
            call SetUnitOwner(r7, P1, true)
            call SetUnitOwner(r8, P1, true)
            call SetUnitOwner(h1, P1, true)
            call SetUnitMoveSpeed( h1, ( GetUnitDefaultMoveSpeed(h1)))
            call SetUnitMoveSpeed( m1, ( GetUnitDefaultMoveSpeed(m1) ))
            call SetUnitMoveSpeed( m2, ( GetUnitDefaultMoveSpeed(m2) ))
            call SetUnitMoveSpeed( m3, ( GetUnitDefaultMoveSpeed(m3) ))
            call SetUnitMoveSpeed( m4, ( GetUnitDefaultMoveSpeed(m4) ))
            call SetUnitMoveSpeed( m5, ( GetUnitDefaultMoveSpeed(m1) ))
            call SetUnitMoveSpeed( m6, ( GetUnitDefaultMoveSpeed(m2) ))
            call SetUnitMoveSpeed( m7, ( GetUnitDefaultMoveSpeed(m3) ))
            call SetUnitMoveSpeed( m8, ( GetUnitDefaultMoveSpeed(m4) ))
            call SetUnitMoveSpeed( r1, ( GetUnitDefaultMoveSpeed(r1) ))
            call SetUnitMoveSpeed( r2, ( GetUnitDefaultMoveSpeed(r2) ))
            call SetUnitMoveSpeed( r3, ( GetUnitDefaultMoveSpeed(r3) ))
            call SetUnitMoveSpeed( r4, ( GetUnitDefaultMoveSpeed(r4) ))
            call SetUnitMoveSpeed( r5, ( GetUnitDefaultMoveSpeed(r1) ))
            call SetUnitMoveSpeed( r6, ( GetUnitDefaultMoveSpeed(r2) ))
            call SetUnitMoveSpeed( r7, ( GetUnitDefaultMoveSpeed(r3) ))
            call SetUnitMoveSpeed( r8, ( GetUnitDefaultMoveSpeed(r4) ))
            call KillUnit(gate)
    //Now this should make the camera reset, but nothing happens !!! why !      
            call CameraClearNoiseForPlayer( P1 )
            set gate = null
            set m1 = null
            set m2 = null
            set m3 = null
            set m4 = null
            set m5 = null
            set m6 = null
            set m7 = null
            set m8 = null
            set r1 = null
            set r2 = null
            set r3 = null
            set r4 = null
            set h1 = null
            set ef = null
            set ef1 = null
            set ef2 = null
            set ef3 = null
            set ef4 = null
            set ef5 = null
            set ef6 = null
            set ef7 = null
            set ef8 = null
            set ef9 = null
            set ef10 = null
            set ef11 = null
            set ef12 = null
            set ef13 = null
            set ef14 = null
            set P1 = null
            set P6 = null
        endif
    endfunction
    //===============================================================
    function InitTrig_Army_P1 takes nothing returns nothing  
        local trigger army = CreateTrigger()  
        call TriggerRegisterPlayerUnitEvent(army, Player(0), EVENT_PLAYER_UNIT_TRAIN_FINISH, null)  
        call TriggerAddAction( army, function army_acts )  
        set army = null
    endfunction


    Please what is wrong !!! i spent all day trying to find that out ! but i just can't why !

    Also, please teach me how to sue timers ... i think they will be the soluion for my problem ...

    all i can do it's this:
    Code (vJASS):

    local timer tt = CreateTimer()
    call TimerStart(tt, 11.16, false, null)
    //good, i have the timer created and it has a value now (11.16 secs)
    //But what do i do nw !?!? how do i use the timer i just created !!!!
    //do i use GetexpiredTimer !??!?!?


    PLZ HELP !!! this trigger is NOT hard to understand ... i just need it to work !
     
  2. PurplePoot

    PurplePoot

    Joined:
    Dec 14, 2005
    Messages:
    11,161
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    For timers, the last value should be a function it calls every interval.

    Then, you'd use GetExpiredTimer in THAT function.

    And run your map with Grimoire, see if it gives you any red text (notifying about potential thread crashes)
     
  3. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    Code (vJASS):
    function bla1 takes nothing returns nothing
    local timer tt = CreateTimer()
    call TimerStart(tt, 11.16, false, function Tacts)
    call GetExpiredTimer //dunno what to do else
    endfunction
    //================================
    functionTacts takes nothing returns nothing
    //bla bla bla bla various actions
    endfunction
     


    Is this what you mean purple ??
    Also grimoire is in JASSnew GEn pack rit >?
     
  4. PurplePoot

    PurplePoot

    Joined:
    Dec 14, 2005
    Messages:
    11,161
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    Yes, but tacts would be above bla1.

    And yes, Grimoire is in JassNewGen.

    And GetExpiredTimer would go in tacts, eg;

    Code (vJASS):
    function Tacts (...)
        local timer t = GetExpiredTimer()
    (...)
     
  5. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    mmm ic ... so in conclusion:

    Code (vJASS):

    function Tacts takes nothing returns nothing
        local timer tt = GetExpiredTimer()
        call KillUnit(Geroge_Bush)
        set George_Bush = null
    endfunction
    //============================================
    function NormalTrigger takes nothing returns nothing
        local integer George_Bush = 'h000'    
        local timer tt = CreateTimer()
        call TimerStart(tt, 11.16, false, function Tacts)
        call CreateUnit(Player(0), 'George_Bush', 123.444, 233.555, 270.0)
    endfunction
    unit.

    so, i can create the unit in the 2nd function, but when the timer with 11.16 seconds expires, the unit will die correct ?? Btw, I know that George_Bush will not work if it is a local, it must be a global correct ??
    Finally, to end, i just want to say that i have nothing against America, or George_Bush (he may be the greatest asshole of the 21 century), the name //of the unit it's an humoristic question... Programing should always be fun =).
    I sry if i hurt anyone feelings with George_Bsh
    Also, is it possible to do with 2 Timers ?? as long as they don't expire at the same time, everything is possible rit ?
    So this is correct rit ?
     
  6. PurplePoot

    PurplePoot

    Joined:
    Dec 14, 2005
    Messages:
    11,161
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    Well, yes, it has to be global. That's why the handle vars came around, so that you can make stuff with timers MUI (among other things)

    Thus

    Code (vJASS):
    function Something_Child takes nothing returns nothing
        local timer t = GetExpiredTimer()
        local unit u = GetHandleUnit(t,"u")
        call KillUnit(u)
        set u = null
        set t = null
    endfunction

    function Something takes nothing returns nothing
        local timer t = CreateTimer()
        call SetHandleHandle(t,"u",GetTriggerUnit())
        call TimerStart(t,1,false,function Something_Child)
        set t = null
    endfunction
     
  7. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    mmmm ok. The purpose of me wanting to learn timers and stuff like Handles, is not because i want to kill units, still i learned a valuable lesson. I will post my code here for further evaluation. Once it is complete, i believe it will be very easy to use and understand, it may seem big, but it's no big deal.
     
  8. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    OK, so here is the scrip, please tell me if this is ok:

    Code (vJASS):
    function effects1 takes nothing retrusn nothing
        local timer tt = GetExpiredTimer()
        local effect ef1
        local effect ef2
        local effect ef3
        local effect ef4
        local effect ef5
        local effect ef6
        local effect ef7
        local effect ef8
        local effect ef9
        local effect ef10
        local effect ef11
        local effect ef12
        local effect ef13
        local effect ef14
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 5335.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 5335.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        set ef3 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 5185.5)
        set ef4 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 5185.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef3)
        call DestroyEffect(ef4)
        set ef5 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 5035.5)
        set ef6 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 5035.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef5)
        call DestroyEffect(ef6)
        set ef7 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4885.5)
        set ef8 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4885.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef7)
        call DestroyEffect(ef8)
        set ef9 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4735.5)
        set ef10 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4735.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef9)
        call DestroyEffect(ef10)
        set ef11 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4585.5)
        set ef12 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4585.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef11)
        call DestroyEffect(ef12)
        set ef13 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4435.5)
        set ef14 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4435.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef13)
        call DestroyEffect(ef14)
        set tt = null
        set ef1 = null
        set ef2 = null
        set ef3 = null
        set ef4 = null
        set ef5 = null
        set ef6 = null
        set ef7 = null
        set ef8 = null
        set ef9 = null
        set ef10 = null
        set ef11 = null
        set ef12 = null
        set ef13 = null
        set ef14 = null
    endfunction
    //====================================================
    function army_acts takes nothing returns nothing  
        local player P1 = Player(0)
        local player P6 = Player(5)
        local unit gate
        local unit m1
        local unit m2
        local unit m3
        local unit m4
        local unit m5
        local unit m6
        local unit m7
        local unit m8
        local unit r1
        local unit r2
        local unit r3
        local unit r4
        local unit r5
        local unit r6
        local unit r7
        local unit r8
        local unit h1
        local unit t = GetTrainedUnit()
        local effect ef
        local unit eff1
        local unit eff2
        local unit eff3
        local unit eff4
        local unit eff5
        local unit eff6
        local unit eff7
        local unit eff8
        local unit eff9
        local unit eff10
        local unit eff11
        local unit eff12
        local timer tt = CreateTimer()
        call GroupAddUnit(udg_UT[0], t)
        if CountUnitsInGroup(udg_UT[0]) == 2 then
            call CameraSetTargetNoiseEx(10, 500000, true)  
            call CameraSetSourceNoiseEx(10, 500000, true)  
            call TimerStart(tt, 11.16, false, function effects1)
            set ef = AddSpecialEffect("Abilities\\Spells\\Human\\FlameStrike\\FlameStrikeTarget.mdl",-6030.5, 5450.5)
            call TriggerSleepAction(1.0)  
            set gate = CreateUnit( P6, 'hprt', -6030.5, 5450.5, 270.0)
            call SetUnitAnimation(gate, "birth")
            call SetUnitTimeScale(gate, 80.00 * 0.01)
            call TerrainDeformationRippleBJ( 7.50, false, Location(-6030.50, 5450.50), 100.00, 800.00, -150.00, 0.35, 1.00 )
     call DestroyEffect(ef)
            call DisplayTextToForce (bj_FORCE_ALL_PLAYERS, ( "The First Northrend Army arrived to aid |cffff0000" + ( GetPlayerName(P1) + "|r and his alliance !!!!! " ) ) )
            set h1 = CreateUnit(P6, 'H015', -6040.5, 5235.0, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -6040.5, 5235.0, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(h1, true)
            call SetUnitMoveSpeed( h1, ( GetUnitDefaultMoveSpeed(h1)/2))
            call IssuePointOrder(h1, "move", -6040.5, 4450.0)
            call TriggerSleepAction (0.75)
            set m1 = CreateUnit(P6, 'h00B', -6160.0, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -6161.0, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(m1, true)
            call SetUnitMoveSpeed( m1, ( GetUnitDefaultMoveSpeed(m1)/2))
            set m2 = CreateUnit(P6, 'h00B', -6065.3, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -6065.3, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(m2, true)
            call SetUnitMoveSpeed( m2, ( GetUnitDefaultMoveSpeed(m2)/2 ))
            set m3 = CreateUnit(P6, 'h00B', -5970.5, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -5973.5, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(m3, true)
            call SetUnitMoveSpeed( m3, ( GetUnitDefaultMoveSpeed(m3) /2 ))
            set m4 = CreateUnit(P6, 'h00B', -5875.5, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -5874.2, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(m4, true)
            call SetUnitMoveSpeed( m4, ( GetUnitDefaultMoveSpeed(m4) /2))
            call IssuePointOrder(m1, "move", -6160.0,4545.0)
            call IssuePointOrder(m2, "move", -6065.3,4545.0)
            call IssuePointOrder(m3, "move", -5970.5,4545.0)
            call IssuePointOrder(m4, "move", -5875.2,4545.0)
            call TriggerSleepAction(0.75)
            set m5 = CreateUnit(P6, 'h00B', -6160.0, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -6161.0, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(m5, true)
            call SetUnitMoveSpeed( m5, ( GetUnitDefaultMoveSpeed(m5)/2))
            set m6 = CreateUnit(P6, 'h00B', -6065.0, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -6065.0, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(m6, true)
            call SetUnitMoveSpeed( m6, ( GetUnitDefaultMoveSpeed(m6)/2 ))
            set m7 = CreateUnit(P6, 'h00B', -5970.5, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -5970.5, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(m7, true)
            call SetUnitMoveSpeed( m7, ( GetUnitDefaultMoveSpeed(m7) /2 ))
            set m8 = CreateUnit(P6, 'h00B', -5875.0, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -5875.0, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(m8, true)
            call SetUnitMoveSpeed( m8, ( GetUnitDefaultMoveSpeed(m8) /2))
            call IssuePointOrder(m5, "move", -6161.0,4635.0)
            call IssuePointOrder(m6, "move", -6065.3,4635.0)
            call IssuePointOrder(m7, "move", -5973.5,4635.0)
            call IssuePointOrder(m8, "move", -5874.2,4635.0)
            call TriggerSleepAction(0.75)
            set r1 = CreateUnit(P6, 'hrif', -6160.0, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -6160.0, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(r1, true)
            call SetUnitMoveSpeed( r1, ( GetUnitDefaultMoveSpeed(r1)/2 ))
            set r2 = CreateUnit(P6, 'hrif', -6065.0, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -6065.0, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(r2, true)
            call SetUnitMoveSpeed( r2, ( GetUnitDefaultMoveSpeed(r2)/2 ))
            set r3 = CreateUnit(P6, 'hrif', -5970.5, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -5970.5, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(r3, true)
            call SetUnitMoveSpeed( r3, ( GetUnitDefaultMoveSpeed(r3)/2 ))
            set r4 = CreateUnit(P6, 'hrif', -5875.0, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -5875.0, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(r4, true)
            call SetUnitMoveSpeed( r4, ( GetUnitDefaultMoveSpeed(r4)/2))
            call IssuePointOrder(r1, "move", -6160.0,4735.0)
            call IssuePointOrder(r2, "move", -6065.0,4735.0)
            call IssuePointOrder(r3, "move", -5970.5,4735.0)
            call IssuePointOrder(r4, "move", -5875.0,4735.0)
            call TriggerSleepAction(0.75)
            set r5 = CreateUnit(P6, 'hrif', -6160.0, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -6160.0, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(r5, true)
            call SetUnitMoveSpeed( r5, ( GetUnitDefaultMoveSpeed(r5)/2 ))
            set r6 = CreateUnit(P6, 'hrif', -6065.0, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -6065.0, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(r6, true)
            call SetUnitMoveSpeed( r6, ( GetUnitDefaultMoveSpeed(r6)/2 ))
            set r7 = CreateUnit(P6, 'hrif', -5970.5, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -5970.5, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(r7, true)
            call SetUnitMoveSpeed( r7, ( GetUnitDefaultMoveSpeed(r7)/2 ))
            set r8 = CreateUnit(P6, 'hrif', -5875.0, 5335.5, 270.00)
            call UnitApplyTimedLife(CreateUnit(P6, 'h01B', -5875.0, 5335.5, 0.00),'BTLF',1.00)
            call SetUnitInvulnerable(r8, true)
            call SetUnitMoveSpeed( r8, ( GetUnitDefaultMoveSpeed(r8)/2))
            call IssuePointOrder(r5, "move", -6160.0,4840.0)
            call IssuePointOrder(r6, "move", -6065.0,4840.0)
            call IssuePointOrder(r7, "move", -5970.5,4840.0)
            call IssuePointOrder(r8, "move", -5875.0,4840.0)
            call TriggerSleepAction(5.00)
            call SetUnitInvulnerable(h1, false)
            call SetUnitInvulnerable(m1, false)
            call SetUnitInvulnerable(m2, false)
            call SetUnitInvulnerable(m3, false)
            call SetUnitInvulnerable(m4, false)
            call SetUnitInvulnerable(m5, false)
            call SetUnitInvulnerable(m6, false)
            call SetUnitInvulnerable(m7, false)
            call SetUnitInvulnerable(m8, false)
            call SetUnitInvulnerable(r1, false)
            call SetUnitInvulnerable(r2, false)
            call SetUnitInvulnerable(r3, false)
            call SetUnitInvulnerable(r4, false)
            call SetUnitInvulnerable(r5, false)
            call SetUnitInvulnerable(r6, false)
            call SetUnitInvulnerable(r7, false)
            call SetUnitInvulnerable(r8, false)
            call SetUnitOwner(m1, P1, true)
            call SetUnitOwner(m2, P1, true)
            call SetUnitOwner(m3, P1, true)
            call SetUnitOwner(m4, P1, true)
            call SetUnitOwner(m5, P1, true)
            call SetUnitOwner(m6, P1, true)
            call SetUnitOwner(m7, P1, true)
            call SetUnitOwner(m8, P1, true)
            call SetUnitOwner(r1, P1, true)
            call SetUnitOwner(r2, P1, true)
            call SetUnitOwner(r3, P1, true)
            call SetUnitOwner(r4, P1, true)
            call SetUnitOwner(r5, P1, true)
            call SetUnitOwner(r6, P1, true)
            call SetUnitOwner(r7, P1, true)
            call SetUnitOwner(r8, P1, true)
            call SetUnitOwner(h1, P1, true)
            call SetUnitMoveSpeed( h1, ( GetUnitDefaultMoveSpeed(h1)))
            call SetUnitMoveSpeed( m1, ( GetUnitDefaultMoveSpeed(m1) ))
            call SetUnitMoveSpeed( m2, ( GetUnitDefaultMoveSpeed(m2) ))
            call SetUnitMoveSpeed( m3, ( GetUnitDefaultMoveSpeed(m3) ))
            call SetUnitMoveSpeed( m4, ( GetUnitDefaultMoveSpeed(m4) ))
            call SetUnitMoveSpeed( m5, ( GetUnitDefaultMoveSpeed(m1) ))
            call SetUnitMoveSpeed( m6, ( GetUnitDefaultMoveSpeed(m2) ))
            call SetUnitMoveSpeed( m7, ( GetUnitDefaultMoveSpeed(m3) ))
            call SetUnitMoveSpeed( m8, ( GetUnitDefaultMoveSpeed(m4) ))
            call SetUnitMoveSpeed( r1, ( GetUnitDefaultMoveSpeed(r1) ))
            call SetUnitMoveSpeed( r2, ( GetUnitDefaultMoveSpeed(r2) ))
            call SetUnitMoveSpeed( r3, ( GetUnitDefaultMoveSpeed(r3) ))
            call SetUnitMoveSpeed( r4, ( GetUnitDefaultMoveSpeed(r4) ))
            call SetUnitMoveSpeed( r5, ( GetUnitDefaultMoveSpeed(r1) ))
            call SetUnitMoveSpeed( r6, ( GetUnitDefaultMoveSpeed(r2) ))
            call SetUnitMoveSpeed( r7, ( GetUnitDefaultMoveSpeed(r3) ))
            call SetUnitMoveSpeed( r8, ( GetUnitDefaultMoveSpeed(r4) ))
            call KillUnit(gate)
            call KillUnit(eff1)
            call KillUnit(eff2)
            call KillUnit(eff3)
            call KillUnit(eff4)
            call KillUnit(eff5)
            call KillUnit(eff6)
            call KillUnit(eff7)
            call KillUnit(eff8)
            call KillUnit(eff9)
            call KillUnit(eff10)
            call KillUnit(eff11)
            call KillUnit(eff12)        
            call CameraClearNoiseForPlayer( Player(0) )
            set gate = null
            set m1 = null
            set m2 = null
            set m3 = null
            set m4 = null
            set m5 = null
            set m6 = null
            set m7 = null
            set m8 = null
            set r1 = null
            set r2 = null
            set r3 = null
            set r4 = null
            set h1 = null
            set ef = null
            set P1 = null
            set P6 = null
            set tt = null
        endif
    endfunction
    //===============================================================
    function InitTrig_Army_P1 takes nothing returns nothing  
        local trigger army = CreateTrigger()  
        call TriggerRegisterPlayerUnitEvent(army, Player(0), EVENT_PLAYER_UNIT_TRAIN_FINISH, null)  
        call TriggerAddAction( army, function army_acts )  
        set army = null
    endfunction


    Please, i know it is huge, but it is also very simple to understand ... please tell me if i use the timers correctly

    Also, can i use more then one timer ??? Another timer that uses another function like effects2 ??
     
  9. PurplePoot

    PurplePoot

    Joined:
    Dec 14, 2005
    Messages:
    11,161
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    You forgot to destroy the timer in the executed func.

    Also, you only need 2 effect variables; just reuse them.
     
  10. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    mmm crap .. now that i see close i realise that i only need 2 vars lol ! ... So where do i have to destroy the timeer ???? in the effects function !??!

    Also, please can i have MORE than one timer ??? like timer tim ??? can my function handle to timers with different exp timings ??
     
  11. PurplePoot

    PurplePoot

    Joined:
    Dec 14, 2005
    Messages:
    11,161
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    Of course you can.

    Also, yes, at the start of the function that the timer calls upon expiration, just add
    call DestroyTimer(GetExpiredTimer())
     
  12. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    Okidoiki !!! Btw now i know why i have to create another timer and why i can't place everything in 1 function. It happens that if my fuctio is too big (like in the case) with too many repetive structures, it will occur a bug named the "bus" bug. It happens with very big codes (like mine, but i believe there are bigger codes that still work ... after all it is a bug .. ). The computer just seems to be confused with all the information i give him, thus separatins big functions in various little functions that are linked between them is better and faster =)

    Thx by your help PP . I will soon post some more news.
     
  13. Silvenon

    Silvenon

    Joined:
    Nov 22, 2006
    Messages:
    1,233
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Omfg! I saw the code, it's a giant! Can't you make loops using arrays or something??? I'm positive you can shorten it somehow.
     
  14. PurplePoot

    PurplePoot

    Joined:
    Dec 14, 2005
    Messages:
    11,161
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    He can definitely, I think he did it that way because he wasn't getting loops or... something.
     
  15. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    i can make loops and arrays .. but arrays make my script slower and loops just complucate things.

    Also, arrays and loops would mees my script in every way ... and as i already said: I prefer to keep stuff simple for now... Now the main priority id to make my code work, after that, i will consider it's optimization.

    EDIT Also what you people are seing is not the entire code, i just posted 1/8 parts of my code.

    EDIT EDITcraaap ! it does NOT work ... arrghhh i don't understand ... what stupid bug is now !!!!

    Code (vJASS):
    function effects1 takes nothing returns nothing
        local timer tt = GetExpiredTimer()
        local effect ef1
        local effect ef2
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 5335.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 5335.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 5185.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 5185.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 5035.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 5035.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4885.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4885.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4735.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4735.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4585.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4585.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4435.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4435.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        call DestroyTimer(GetExpiredTimer())
        set tt = null
        set ef1 = null
        set ef2 = null
    endfunction


    My problem is that, everything seems to be OK, but the effects don't appear!!! they only appear in the first 2 calls ... after that they just keep appearing and they are not destroyed or either removed ... only the 1st to calls work (not properly ... ) help !? why isn't this function working !?
     
    Last edited: Oct 18, 2007
  16. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    Hi, i havew some news... It seems that this function DOES work:
    Code (vJASS):
    function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
         local effect ef1
        local effect ef2

        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 5335.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 5335.5)
        call TriggerSleepAction(0.5)
         call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 5185.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 5185.5)
        call TriggerSleepAction(0.5)
     call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 5035.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 5035.5)
        call TriggerSleepAction(0.5)
     call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4885.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4885.5)
        call TriggerSleepAction(0.5)
     call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4735.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4735.5)
        call TriggerSleepAction(0.5)
     call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4585.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4585.5)
        call TriggerSleepAction(0.5)
     call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4435.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4435.5)
        call TriggerSleepAction(2.0)

        call DestroyEffect(ef1)
        call DestroyEffect(ef2)  
     
        set ef1 = null
        set ef2 = null
    endfunction


    But this function does not:

    Code (vJASS):

        local effect ef1
        local effect ef2
        local effect ef3
        local effect ef4
        local effect ef5
        local effect ef6
        local effect ef7
        local effect ef8
        local effect ef9
        local effect ef10
        local effect ef11
        local effect ef12
        local effect ef13
        local effect ef14
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 5335.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 5335.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        set ef3 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 5185.5)
        set ef4 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 5185.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef3)
        call DestroyEffect(ef4)
        set ef5 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 5035.5)
        set ef6 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 5035.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef5)
        call DestroyEffect(ef6)
        set ef7 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4885.5)
        set ef8 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4885.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef7)
        call DestroyEffect(ef8)
        set ef9 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4735.5)
        set ef10 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4735.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef9)
        call DestroyEffect(ef10)
        set ef11 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4585.5)
        set ef12 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4585.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef11)
        call DestroyEffect(ef12)
        set ef13 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4435.5)
        set ef14 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4435.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef13)
        call DestroyEffect(ef14)


        set ef1 = null
        set ef2 = null
        set ef3 = null
        set ef4 = null
        set ef5 = null
        set ef6 = null
        set ef7 = null
        set ef8 = null
        set ef9 = null
        set ef10 = null
        set ef11 = null
        set ef12 = null
        set ef13 = null
        set ef14 = null


    So, can some1 tell me why !?

    Also, in the code:
    Code (vJASS):
        set ef13 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4435.5)
        set ef14 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4435.5)
        call TriggerSleepAction(0.5)
        call DestroyEffect(ef13)
        call DestroyEffect(ef14)
     

    If the waithing time is < 2.00, the trigger will NOT work ... why !? this is valid for the first example as well....

    I will try to post news soon.
     
  17. PurplePoot

    PurplePoot

    Joined:
    Dec 14, 2005
    Messages:
    11,161
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    I just remembered (forgot before), you can't use TriggerSleepAction in timer callbacks.
     
  18. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    Mmmm..... so using timers will out ofquestion for me .... TriggerSleepAction is an extremely important call i use in this system ... i use to coordinate the effects to a scale of dec of seconds (10 in 1). I guess i will have to use other method but timers ...

    I intent to use the "Run Trigger Ignoring Conditions" action, but to do that, my triggers need to be global correct ?




    EDIT HI ! well, i have found a way ... to avoid timers ... (thinK), it is based on the idea of calling a disabled trigger.
    Here, I have the example,very simple:
    • T1
      • Events
        • Unit - A unit Dies
      • Conditions
      • Actions
        • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
        • Trigger - Run T2 <gen> (ignoring conditions)


    So, everytime a unit dies, i activates the trigger i want:
    Code (vJASS):
    function Trig_T2_Actions takes nothing returns nothing
        local effect ef1
        local effect ef2
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 5335.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 5335.5)
        call TriggerSleepAction(1.0)
        call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 5185.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 5185.5)
        call TriggerSleepAction(1.0)
        call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 5035.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 5035.5)
        call TriggerSleepAction(1.0)
        call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4885.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4885.5)
        call TriggerSleepAction(1.0)
        call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4735.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4735.5)
        call TriggerSleepAction(1.0)
        call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4585.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4585.5)
        call TriggerSleepAction(1.0)
        call DestroyEffect(ef1)
        call DestroyEffect(ef2)
        set ef1 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -6260.0, 4435.5)
        set ef2 = AddSpecialEffect("Doodads\\Cinematic\\FrostTrapUp\\FrostTrapUp.mdl", -5775.5, 4435.5)
        call TriggerSleepAction(2.0)

        call DestroyEffect(ef1)
        call DestroyEffect(ef2)  
     
        set ef1 = null
        set ef2 = null
       
    endfunction

    //===========================================================================
    function InitTrig_T2 takes nothing returns nothing
        set gg_trg_T2 = CreateTrigger(  )
        call DisableTrigger( gg_trg_T2 )
        call TriggerAddAction( gg_trg_T2, function Trig_T2_Actions )
    endfunction

     

    I know that the Indenting is kinda crappy, but this is my test trigger. It works for now.

    Now i have a question:
    -If i add the "call TriggerAddAction( gg_trg_T2, function Trig_T2_Actions )" call to my trigger, how do i order it to run immediatly the action i added him ???

    Example of what i need to know:
    Code (vJASS):

    function walking_on_sunshine takes nothing returns nothing
        call CreateUnit(bla bla bla on middle map)
    endfunction
    //==================================
    function bla bla takes nothing returns nothing
        call TriggerAddAction( gg_trg_T2, function walking_on_sunshine)
    call RunAction (function walking_on_sunshine)
    //=================================
    Trigger Stuff
     


    IS this possible ??
     
    Last edited: Oct 20, 2007
  19. Silvenon

    Silvenon

    Joined:
    Nov 22, 2006
    Messages:
    1,233
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    On the contrary, they are made to make things easier. They can't possible make your script more complicated, they can make it simpler, that's why i was suggesting it.

    When is this thread going to be closed already??? It's been 11 pages already!!! Is the problem that complicated??
     
  20. PurplePoot

    PurplePoot

    Joined:
    Dec 14, 2005
    Messages:
    11,161
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    Threads don't get closed except in special circumstances.