• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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

Status
Not open for further replies.
MM
Hynd, yes you already explained that to me, but the problem here is the fact that i can't use your way in this part. I have GetUnitLoc, and not GetUnitX(Y), thus i can't.
About your alternative, PurplePoot already suggested it but it didn't work ... i will give it a second try.

Also PurplePoot If i use the "call UnitApplyTimedLife(CreateUnit(...),'BTLF',1)
" the effect will die b4 reaching it's full potential if you understand me.
Such method is not strange for me, but i also know it's disavantages, thus my choice not to use it.

And Wyrmworld, well, what can i say, you are correct. I will make the units invulnerable, but if they are under the effect of an aura, well, i won't be able to avoid that since auras are not spells which can be casted...

Further development soon.

Also, the fact that this thread has 6 pages, only shows how interested i am in learning JASS. =P
As the title says, this is the new level of JASS for me.



EDIT: Hey Guys i changed and fixed my script, but now i have a problem ... When the units reach their destination, they turn back, and they walk back ... it's like they are trying to go to the original point from which they came from.
How do i avoid this situation ?

Here are some pieces of my script:
JASS:
set h1 = CreateUnit(P6, 'H015', GetRectCenterX(uh1), GetRectCenterY(uh1), 270.00)
        set ef1 = CreateUnit(P6, 'h01B', GetRectCenterX(uh1), GetRectCenterY(uh1), 0.00)
        call SetUnitInvulnerable(h1, true)
        call UnitApplyTimedLife(ef1, 'BTLF', 1.00)
        call SetUnitMoveSpeed( h1, ( GetUnitDefaultMoveSpeed(h1)/2))
        call IssuePointOrder(h1, "attack", GetUnitX(h1),GetUnitY(h1)-1000)
        call TriggerSleepAction (1.00)
Here iis when i order my general to move.

Now here are when i order the following units:
JASS:
set m1 = CreateUnit(P6, 'h00B', GetRectCenterX(u1), GetRectCenterY(u1), 270.00) 
        set ef2 = CreateUnit(P6, 'h01B', GetRectCenterX(u1), GetRectCenterY(u1), 0.00)
        call SetUnitInvulnerable(m1, true)
        call UnitApplyTimedLife(ef2, 'BTLF', 1.00)
        call SetUnitMoveSpeed( m1, ( GetUnitDefaultMoveSpeed(m1)/2))
        set m2 = CreateUnit(P6, 'h00B', GetRectCenterX(u2), GetRectCenterY(u2), 270.00) 
        set ef3 = CreateUnit(P6, 'h01B', GetRectCenterX(u2), GetRectCenterY(u2), 0.00)
        call SetUnitInvulnerable(m2, true)
        call UnitApplyTimedLife(ef3, 'BTLF', 1.00)
        call SetUnitMoveSpeed( m2, ( GetUnitDefaultMoveSpeed(m2)/2 ))
        set m3 = CreateUnit(P6, 'h00B', GetRectCenterX(u3), GetRectCenterY(u3), 270.00) 
        set ef4 = CreateUnit(P6, 'h01B', GetRectCenterX(u3), GetRectCenterY(u3), 0.00)
        call SetUnitInvulnerable(m3, true)
        call UnitApplyTimedLife(ef4, 'BTLF', 1.00)
        call SetUnitMoveSpeed( m3, ( GetUnitDefaultMoveSpeed(m3) /2 ))
        set m4 = CreateUnit(P6, 'h00B', GetRectCenterX(u4), GetRectCenterY(u4), 270.00) 
        set ef5 = CreateUnit(P6, 'h01B', GetRectCenterX(u4), GetRectCenterY(u4), 0.00)
        call SetUnitInvulnerable(m4, true)
        call UnitApplyTimedLife(ef5, 'BTLF', 1.00)
        call SetUnitMoveSpeed( m4, ( GetUnitDefaultMoveSpeed(m4) /2))
        call IssuePointOrder(m1, "attack", GetUnitX(m1),GetUnitY(m1)-900)
        call IssuePointOrder(m2, "attack", GetUnitX(m2),GetUnitY(m2)-900)
        call IssuePointOrder(m3, "attack", GetUnitX(m3),GetUnitY(m3)-900)
        call IssuePointOrder(m4, "attack", GetUnitX(m4),GetUnitY(m4)-900)
        call TriggerSleepAction(1.00)


Can you please tell me why the unit turn back plz ??, i don't want that to happen =S
If you want i can post the whole script...
 
Last edited:
Level 40
Joined
Dec 14, 2005
Messages
10,532
Well then, that's retarded, FP, since IssuePointOrderLoc is just IssuePointOrder using the loc's X and Y -.-

And FP,

set u = CreateUnit(...)
call UnitApplyTimedLife(u,'BTLF',1)

is exactly the same as

call UnitApplyTimedLife(CreateUnit(...),'BTLF',1)

if you don't need to use u later on.

And weirdnesses in the AI sometimes cause units to turn around like you're talking about.
 
I have a few things to say/ask:
1 . FP = me rit ?? lol ... i always though you could come up with something more original ... like pooty (from silvermon) lol. No offense ;P
2 . I hope the "retarded" part is not for me, but for the script (i think it is for the script lol)
3 . Also, i understand now the UnitApllyTimedLife and i will use it.
4 . Also about the AI, I tell the unit
JASS:
call IssuePointOrder(m1, "attack", GetUnitX(m1),GetUnitY(m1)-900)
. The unit goes to where i want, and when it arrives there, it just goes all the way back ... So, my question is: Is the problem with the "-" signal ??? does it invert some kind of orders ??? I know "-" plus "-" is equal to "+" (well basic lol) and so there could be some kind of conflict, that would result in a "+" instead of a null value or something, thus making the unit go all the way back.

Any suggestions plz ?

PS: PurplePoot, you should change your signature, as people cant read it all the way to the end. It gets cut.
 
mmmm, i also thought about ordering the units to stop... problem is, how do i know the unit has already reached it's location ? I mean i know when that happens, but the computer doesn't ... how do i tell the computer that my unit made 700 meters and that when it finishes doing them, i order it to stop ?

Also, it is probably my resolution in deed ..
 
mm, sry i only read solution 2 last time lol ...

About the timer ... mmmm .... it does seems to be the perfect solution, but again ... i never use timers .. i don't know what to do with them .. Also, what happens if the units are under the effect of a speed aura ??? like Endurance aura or other ?

The movement speed will be changed and the timer won't work ... Is there a way to make my units "invulnetable" to auras ???

Anyway, although auras may be a problem, i do know a solution for that (i guess), so please explain me how the timer works =S
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Erm, 700/GetUnitMoveSpeed() will work fine in most cases, only if they're affected partway through will it mess up.

You could also just have the timer loop until they near the destination, you'd have to learn Handle Vars, CSCache, or something similar though. (Well you would anyways for timers...)

There are tutorials all over the place, here is one of the originals.
 
I have 2 problem:
1 - first i alreday have a script into my maps header (the script to change a unit's health), so i can't place the handlers script there
2 - It must be the 10000 time i see that tutorial, and i really make no idea about how that is supposed to help me ...

Also isn't there anything like:
  • Wait until unit Position of triggeredunit is euqal to position of trig unit offset by 1000
That i can convert and optimize to JASS ?
 
Inaccurate !??! I can't think of something better then them for now ... I mean, i don't know if that GUI trigger exists, but if it does, it will be the perfect solution for my problem ... The unit will stop where i want it to do so, and it is easy to use ! (if such trigger actions exists).

I could use handlers and timers, but i make no idea how to do it !!! i never used such functions b4 ...

However, as i said, if you teach me how to use timers, i will leran and apply that to my scripts concept ... if not.... well, i really can't see ho that is supposed to help me ... i don't want to poison a unit ...
 
Well, i know timers are far more accurate ... but only for those who know how to use them .. and i have tried something from GUI to JASS. An alternative way, an alternative solution.
please, follow my logic: When i create the unit i order it to move 700 meters forward. This means that the unit will move 700 "units" in a 270º direction.
When the unit reaches the location, the issue begins, it turns around and it goes back.
But now think, when the unit reaches its location, its angle is still 270º. So to go all the way back, the unit must turn around, and choose the 90º direction. So, this means that if i order the unit when it turns around, i will be able to solve the problem:

JASS:
function problem solve takes nothing returns nothing
//Here i create, order and bla bla bla my unit
    if TurnAngle(m1) == 90 then // m1 is one of my units
        call IssueImmediateOrder(m1, "stop") // i order the unit to stop, so it won't move
        call ChangeUnitOwner(P1, true) // Here i change the players owner
    endif
//Other actions     
endfunction

This should solve my problem .... However, it doesn't work !!! When the unit reaches 90º nothing happens ... why !!
 
Wewll it still does NOT work ... and i don't know why ... This time i simplified the script in order to make the calls a little easier to see in game.

JASS:
set m1 = CreateUnit(P6, 'h00B', GetRectCenterX(u1), GetRectCenterY(u1), 270.00) 
        set ef2 = CreateUnit(P6, 'h01B', GetRectCenterX(u1), GetRectCenterY(u1), 0.00)
        call SetUnitInvulnerable(m1, true)
        call UnitApplyTimedLife(ef2, 'BTLF', 1.00)
        call SetUnitMoveSpeed( m1, ( GetUnitDefaultMoveSpeed(m1)/2))
        call IssuePointOrder(m1, "attack", GetUnitX(m1),GetUnitY(m1)-900)
        if GetUnitFacing(m1) >= 225.00 and GetUnitFacing(m1) <= 135.00then
            call KillUnit(m1)               
        endif

Any idea why the dam unit doesn't die !? plz

The unit turns left ... but i think i have it all ok ..
 
mmm i see.

However, i changed the scipt, i am now trying to use a new coordinates system that may solve my problem.

MUHAHAHHAHA EDIT: It works perfectly now !!! my creation is complete !!! MUHAHAHAHA finally !! By using the coordinates i have sucessefully eliminated that turn around AI bug !
Here is the new script, thx to Hyndi by telling me about the use of coordinates =). Also, thx to PurplePooot for all his comments.

JASS:
globals 
    group array udg_UT 
endglobals
//====================================================
function army_acts takes nothing returns nothing  
    local player P1 = Player(0)
    local player P6 = Player(5) 
    local unit gate
    local unit ef1
    local unit ef2
    local unit ef3
    local unit ef4
    local unit ef5
    local unit ef6
    local unit ef7
    local unit ef8
    local unit ef9
    local unit m1
    local unit m2
    local unit m3
    local unit m4 
    local unit r1
    local unit r2
    local unit r3
    local unit r4 
    local unit h1 
    local unit t = GetTrainedUnit()
    call GroupAddUnit(udg_UT[0], t)
    set t = null  
    if CountUnitsInGroup(udg_UT[0]) == 20 then
        set gate = CreateUnit( P6, 'hprt', -6028.5, 5448.5, 270.0)
        call TriggerSleepAction(2.00)
        call DisplayTextToForce (bj_FORCE_ALL_PLAYERS, ( "The First Northrend Army arrived to aid |cffff0000" + ( GetPlayerName(P1) + "|r and his alliance !!!!! " ) ) )  
        call CameraSetTargetNoiseEx(10, 500000, true)  
        call CameraSetSourceNoiseEx(10, 500000, true)  
        set h1 = CreateUnit(P6, 'H015', -6037.6, 5236.2, 270.00)
        set ef1 = CreateUnit(P6, 'h01B', -6037.6, 5236.2, 0.00)
        call SetUnitInvulnerable(h1, true)
        call UnitApplyTimedLife(ef1, 'BTLF', 1.00)
        call SetUnitMoveSpeed( h1, ( GetUnitDefaultMoveSpeed(h1)/2))
        call IssuePointOrder(h1, "move", -6037.6, 4337.0)
        call TriggerSleepAction (1.00)
        set m1 = CreateUnit(P6, 'h00B', -6161.0, 5335.5, 270.00) 
        set ef2 = CreateUnit(P6, 'h01B', -6161.0, 5335.5, 0.00)
        call SetUnitInvulnerable(m1, true)
        call UnitApplyTimedLife(ef2, 'BTLF', 1.00)
        call SetUnitMoveSpeed( m1, ( GetUnitDefaultMoveSpeed(m1)/2))
        set m2 = CreateUnit(P6, 'h00B', -6065.3, 5335.5, 270.00) 
        set ef3 = CreateUnit(P6, 'h01B', -6065.3, 5335.5, 0.00)
        call SetUnitInvulnerable(m2, true)
        call UnitApplyTimedLife(ef3, 'BTLF', 1.00)
        call SetUnitMoveSpeed( m2, ( GetUnitDefaultMoveSpeed(m2)/2 ))
        set m3 = CreateUnit(P6, 'h00B', -5973.5, 5335.5, 270.00) 
        set ef4 = CreateUnit(P6, 'h01B', -5973.5, 5335.5, 0.00)
        call SetUnitInvulnerable(m3, true)
        call UnitApplyTimedLife(ef4, 'BTLF', 1.00)
        call SetUnitMoveSpeed( m3, ( GetUnitDefaultMoveSpeed(m3) /2 ))
        set m4 = CreateUnit(P6, 'h00B', -5874.2, 5335.5, 270.00) 
        set ef5 = CreateUnit(P6, 'h01B', -5874.2, 5335.5, 0.00)
        call SetUnitInvulnerable(m4, true)
        call UnitApplyTimedLife(ef5, 'BTLF', 1.00)
        call SetUnitMoveSpeed( m4, ( GetUnitDefaultMoveSpeed(m4) /2))
        call IssuePointOrder(m1, "move", -6161.0,4437.0)
        call IssuePointOrder(m2, "move", -6065.3,4437.0)
        call IssuePointOrder(m3, "move", -5973.5,4437.0)
        call IssuePointOrder(m4, "move", -5874.2,4437.0)
        call TriggerSleepAction(0.75)
        set r1 = CreateUnit(P6, 'hrif', -6161.0, 5335.5, 270.00) 
        set ef6 = CreateUnit(P6, 'h01B', -6161.0, 5335.5, 0.00)
        call SetUnitInvulnerable(r1, true)
        call UnitApplyTimedLife(ef6, 'BTLF', 1.00)
        call SetUnitMoveSpeed( r1, ( GetUnitDefaultMoveSpeed(r1)/2 ))
        set r2 = CreateUnit(P6, 'hrif', -6065.3, 5335.5, 270.00) 
        set ef7 = CreateUnit(P6, 'h01B', -6065.3, 5335.5, 0.00)
        call SetUnitInvulnerable(r2, true)
        call UnitApplyTimedLife(ef7, 'BTLF', 1.00)
        call SetUnitMoveSpeed( r2, ( GetUnitDefaultMoveSpeed(r2)/2 ))
        set r3 = CreateUnit(P6, 'hrif', -5973.5, 5335.5, 270.00) 
        set ef8 = CreateUnit(P6, 'h01B', -5973.5, 5335.5, 0.00)
        call SetUnitInvulnerable(r3, true)
        call UnitApplyTimedLife(ef8, 'BTLF', 1.00)
        call SetUnitMoveSpeed( r3, ( GetUnitDefaultMoveSpeed(r3)/2 ))
        set r4 = CreateUnit(P6, 'hrif', -5874.2, 5335.5, 270.00) 
        set ef9 = CreateUnit(P6, 'h01B', -5874.2, 5335.5, 0.00)
        call SetUnitInvulnerable(r4, true)
        call UnitApplyTimedLife(ef9, 'BTLF', 1.00)
        call SetUnitMoveSpeed( r4, ( GetUnitDefaultMoveSpeed(r4)/2))
        call IssuePointOrder(r1, "move", -6161.0,4537.0)
        call IssuePointOrder(r2, "move", -6065.3,4537.0)
        call IssuePointOrder(r3, "move", -5973.5,4537.0)
        call IssuePointOrder(r4, "move", -5874.2,4537.0)
        call TriggerSleepAction(7.00)
        call SetUnitInvulnerable(h1, false)
        call SetUnitInvulnerable(m1, false)
        call SetUnitInvulnerable(m2, false)
        call SetUnitInvulnerable(m3, false)
        call SetUnitInvulnerable(m4, false)
        call SetUnitInvulnerable(r1, false)
        call SetUnitInvulnerable(r2, false)
        call SetUnitInvulnerable(r3, false)
        call SetUnitInvulnerable(r4, false)
        call SetUnitOwner(m1, P1, true) 
        call SetUnitOwner(m2, P1, true)
        call SetUnitOwner(m3, P1, true)
        call SetUnitOwner(m4, P1, true)
        call SetUnitOwner(r1, P1, true)
        call SetUnitOwner(r2, P1, true)
        call SetUnitOwner(r3, P1, true)
        call SetUnitOwner(r4, 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( r1, ( GetUnitDefaultMoveSpeed(r1) ))
        call SetUnitMoveSpeed( r2, ( GetUnitDefaultMoveSpeed(r2) ))
        call SetUnitMoveSpeed( r3, ( GetUnitDefaultMoveSpeed(r3) ))
        call SetUnitMoveSpeed( r4, ( GetUnitDefaultMoveSpeed(r4) ))
        call KillUnit(gate)
        call CameraSetTargetNoiseEx(0, 0, true)  
        call CameraSetSourceNoiseEx(0, 0, true)  
        set gate = 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 m1 = null
        set m2 = null
        set m3 = null
        set m4 = null
        set r1 = null
        set r2 = null
        set r3 = null
        set r4 = null
        set h1 = 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

Know that this is the "skeleton" of my script. Soon i will add more units and more special effects. I will Also optimize (probably).
I will also probably keep posting here my script, so you guys can give an opinion about the cide i use (always good to have an opinion of the pros).
I will eventually post the last version of the script, once i complete it.

Also, keep in mind that once i finish, this script will probably be the double of it's current size ... and that is just for player 1 ! lol
 
Last edited:
LOl ... i do not agree 100%. I find easier loops without arrays ... Arrays can make then faster or they may take less space, but they just complicate things -.- You are telling me a rule of life: Everything we alreday know and understand is easy for us .... everything else .... is not !


PS: dude, what happened to the reaper avatar !??! are you gothic !?!? i give you my heart !? lol ...
 
mmm i see.... Well thx God i can avoid them for now...

guys i have another problem ...
I am trying to make the ground tremble due the opening of my portal (very coll for eye candy =D) so i mad ethis action in GUI:
  • Actions
    • Environment - Create a 3.00 second Normal ripple deformation at (Point(-6030.50, 5450.50)) with starting radius 100.00, ending radius 600.00, and depth -150.00, using 0.10 second ripples spaced 1.00 apart
However, we all know that Gui is not efficient, and it leaks like hell .... so i converted this trigger and i got this:
JASS:
call TerrainDeformationRippleBJ( 7.50, false, Location(-6030.50, 5450.50), 100.00, 600.00, -150.00, 0.30, 1.00 )

A BJ ... surprise ... but that is not the worse ... thing is that:
JASS:
function TerrainDeformationRippleBJ takes real duration, boolean limitNeg, location where, real startRadius, real endRadius, real depth, real wavePeriod, real waveWidth returns terraindeformation
    local real spaceWave
    local real timeWave
    local real radiusRatio

    if (endRadius <= 0 or waveWidth <= 0 or wavePeriod <= 0) then
        return null
    endif

    set timeWave = 2.0 * duration / wavePeriod
    set spaceWave = 2.0 * endRadius / waveWidth
    set radiusRatio = startRadius / endRadius

    set bj_lastCreatedTerrainDeformation = TerrainDeformRipple(GetLocationX(where), GetLocationY(where), endRadius, depth, R2I(duration * 1000), 1, spaceWave, timeWave, radiusRatio, limitNeg)
    return bj_lastCreatedTerrainDeformation
endfunction

Ya .. well, what does this have to do with my very simple innitial trigger !?!??! i don't know which values are which !! please i need info !
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
This is what TriggerData.txt says.

Code:
TerrainDeformationRippleBJ=1,real,rippletype,location,real,real,real,real,real
_TerrainDeformationRippleBJ_Defaults=4,RippleTypeNormal,GetRectCenter,1024,1024,64,1,512
_TerrainDeformationRippleBJ_Limits=0.01,_,_,_,_,_,0,_,1,_,_,_,0.01,_,1,_
_TerrainDeformationRippleBJ_Category=TC_ENVIRONMENT

See if you can decipher that, inside lies the answer.

The easiest way would be to use the defaults, then convert to custom script and see what lines up where.
 
Mmm sry purp, after reading you suggestion carefully i was unable to understand it =(.

Please explain better.

Also, i have found another problem in my trigger:
Now my trigger creates a gate, and while the gaye is being opened (while it is playing the birth animation), i want to run this sections of the script:

JASS:
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 = null
        set ef2= null
        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 DestroyEffect(ef1)
        call DestroyEffect(ef2)
        call TriggerSleepAction(0.5)
        set ef1 = null
        set ef2= null 
        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 = null
        set ef2= null
        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 = null
        set ef2= null
        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 = null
        set ef2= null  
        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 = null
        set ef2= null
        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)
        set ef1 = null
        set ef2= null

This will create a nice ordered effect. while the gate is being created, geisers of ice will erupt in both sides of the game in various directions. The coordinates are all correct, but i just can make the "calls" run properly ... please help ...

I believe that each animation takes 0.333 seconds to run ... but i used 0.5 to play safe ... can you tell me why it doesn't work ?
 
Purple !!! i have an urgent problem !!! My trigger... it seems that it doesn't work now !! why !!! please tell me what is wrong !!!

JASS:
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:
JASS:
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 !
 
JASS:
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 >?
 
mmm ic ... so in conclusion:

JASS:
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 ?
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
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

JASS:
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
 
OK, so here is the scrip, please tell me if this is ok:

JASS:
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 ??
 
Status
Not open for further replies.
Top