• 🏆 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.
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.
 
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 !!!!

JASS:
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:
Hi, i havew some news... It seems that this function DOES work:
JASS:
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:

JASS:
    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:
JASS:
    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.
 
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:
JASS:
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:
JASS:
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:
Level 13
Joined
Nov 22, 2006
Messages
1,260
i can make loops and arrays .. but arrays make my script slower and loops just complucate things.

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??
 
Silvernoon said:
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.

You are c100% wrong ... Arrays and loops DO make my script more complicated because they NEED a superior level of knowledge about programing and bout JASS. Because i am still trying to reach that level i decided to keep things simple for now.
And as i said:
Flame_Phoenix said:
improving my script is not out of question, and it is something i will probably do in the future, when i finish my system

Also loops ARE slower according to PP:

PurplePoot said:
They take up less space, but loops are always slower, FP.
This sentence can be found in page 9 (yes, i actually took some time to re-read those pages .... )

And to end
silvernon said:
When is this thread going to be closed already??? It's been 11 pages already!!! Is the problem that complicated??

This thread means no HARM to THW community .... So i see no reason for deleting it. Also, the thread will be closed once i finish my system ,which will take a while because i have constant question.
I also don't see the problem of thread having 11 pages ... It's just big ....

To end, i just want to say, that if you don't have any suggestions or constructive comments, than DON'T post. Also, please don't make me repeat myself 100 times .... it's the third time i answer to the loops and arrays question ... please read some post b4 posting ...
My script's are huge but yet, extremelly easy to understand and follow.

Also, please answer my question PP or Silvernon or any1 else ... i really need to know.

Please =)
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Not very much at all, the main drawback of an array is that it takes an additional operation to read and write to (OP limit hurts 'cause of this, if you have massive amounts of operations).

And Arrays and Loops don't really make the script much more complicated <imo>, even with little programming knowledge.
 
Again, you are tellng me a simple rule of life : "Every thing we already know it's easy for us !! Everything else... is not !"

You find it easy because you are a professional in JASS ... I am not a pro at JASS, i am a "student".

Also, i strongly remmember using loops and arrays in my script during 3 months, and the result was a NON working system.

I prefer to keep things this way, and then, move to the more advanced step later.
 
LOL !!! Is JASS your 1st prog language ???? Because it is for me. Also no1 is equal to no1. Your brain can be great at some areas and mine can be better than yours at other areas. Every1 is unique in the world.

Your barin works better with arrays and loops, but mine doesn't for now. Althought, my brain can qork better with more complicated stuff (somehow i usually don't understand simple things, but i tend to understand complex and difficult concepts that most people can't easely understand).

Still, I won't repeat myself again ...
Also please tell me if
Flame_Phoenix said:
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:
JASS:
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 ??
 
AHHHH Thx, that was what i was lookinf for =).

Also .... blarg ... no comments. If you really have a facility to learn programing language then you should take advantage of it, it may be good in a nearby future to be a techinal support guy or even better. Nowaday the more you know the better you are, because the more money you get (generally).

EDIT AHHH good, your calls work in perfection with my trigger =) thx a lot =)
 
Last edited:
JESUS i am afk 5 dyas and my post gets to the 2nd page lol ...

Anyway, i am just here to say that my REWARD system finally nearlly works !! lol. It is concluded now and it just needs a few timing adjustments =).
So, this is my last post, where i will give you a chance to see my script.
I would like to thank to all who helped me achieve such a work =).

JASS:
globals 
    group array udg_UT 
endglobals
//====================================================
function First_Seq_Effects 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.3)
    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.3)
    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.3)
    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.3)
    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.3)
    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.3)
    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
    call TriggerSleepAction(0.5)
    call ExecuteFunc("Second_Seq_Effects")
endfunction
//====================================================
function Second_Seq_Effects takes nothing returns nothing
    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  
    set eff1 = CreateUnit(Player(5),'h01N', -6260.0, 5335.5, 0.00)
    call SetUnitAnimation(eff1, "stand second")
    set eff2 = CreateUnit(Player(5),'h01N', -5775.5, 5335.5, 0.00)
    call SetUnitAnimation(eff2, "stand second")
    set eff3 = CreateUnit(Player(5),'h01N', -6260.0, 5185.5, 0.00)
    call SetUnitAnimation(eff3, "stand second")
    set eff4 = CreateUnit(Player(5),'h01N', -5775.5, 5185.5, 0.00)
    call SetUnitAnimation(eff4, "stand second")
    set eff5 = CreateUnit(Player(5),'h01N', -6260.0, 5035.5, 0.00)
    call SetUnitAnimation(eff5, "stand second")
    set eff6 = CreateUnit(Player(5),'h01N', -5775.5, 5035.5, 0.00)
    call SetUnitAnimation(eff6, "stand second")
    set eff7 = CreateUnit(Player(5),'h01N', -6260.0, 4885.5, 0.00)
    call SetUnitAnimation(eff7, "stand second")
    set eff8 = CreateUnit(Player(5),'h01N', -5775.5, 4885.5, 0.00)
    call SetUnitAnimation(eff8, "stand second")
    set eff9 = CreateUnit(Player(5),'h01N', -6260.0, 4735.5, 0.00)
    call SetUnitAnimation(eff9, "stand second")
    set eff10 = CreateUnit(Player(5),'h01N', -5775.5, 4735.5, 0.00)
    call SetUnitAnimation(eff10, "stand second")
    set eff11 = CreateUnit(Player(5),'h01N', -6260.0, 4585.5, 0.00)
    call SetUnitAnimation(eff11, "stand second")
    set eff12 = CreateUnit(Player(5),'h01N', -5775.5, 4585.5, 0.00)
    call SetUnitAnimation(eff12, "stand second")
    call TriggerSleepAction(7.0)
    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)  
    set eff1 = null
    set eff2 = null
    set eff3 = null
    set eff4 = null
    set eff5 = null
    set eff6 = null
    set eff7 = null
    set eff8 = null
    set eff9 = null
    set eff10 = null
    set eff11 = null
    set eff12 = 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
    call GroupAddUnit(udg_UT[0], t)
    if CountUnitsInGroup(udg_UT[0]) == 2 then
        call CameraSetTargetNoiseEx(10, 500000, true)  
        call CameraSetSourceNoiseEx(10, 500000, true)  
        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, 85.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 !!!!! " ) ) ) 
        call TriggerSleepAction(8.25)
        call ExecuteFunc("First_Seq_Effects") 
        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 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
    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

So here it is =). The gigantic code =). I told you i was going to optimize in the future and i may do so, but it will be in another post.
I may also decide to post my full system in the spells section in order to say thx to THW community.
Still THW did nothing to help me, only PP and a few more people really helped me, (silvermoon maybe lol, Hyndi and other that i don't remmember) so i still don't know =D.

Now this post is here so that i can share what i've learned with every1.
Thx fot all help.

Also PurplePoot, you may delete my thread if you wish to, it is 13 pages long :piru: I bet you have never seen such a bid thread in this forum :p

Last post, it has finally come to an end. Thx to all who helped me. Flame_Phoenix
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Congratulations!! You did it man! And it only took you 13 pages......

I can help you shorten it, I'm good at that. The only problem is.......erghh when I CnP it's all in the same line. What's your method again, Pooty? You said something about quotes, I tried to CnP it in quotes but it didn't break into lines.... :(

Could you maybe give me a .txt file which contains the code? I'm not in the mood of breaking this code into lines by myself (Ralle should really fix that sometimes....)

silvermoon maybe lol

Whoa...???? Why you....... :) (It's Silvenon)
 
Level 17
Joined
Jun 17, 2007
Messages
1,433
Guys, i have a problem with my reward system...
To explain the reward system in my map rewards the players that train more units.
So every time a player trains 1 unit, i add that unit to a group.
Ex: An Unit owned by Player 1 finishes training a unit > add trained unit yo 'P1_Units_Trained'.

When 'P1_units_trained' reaches 20 (this means that Player 1 trained 20 units), my reward system will be activated and the player will summon a dwarf army in his aid.

Here is the trigger:

JASS:
function army_conds takes nothing returns boolean
     return CountUnitsInGroup(udg_TrainedUnits_P1) == 20  
endfunction
//============================================================================
function army_acts takes nothing returns nothing
        local location m = gg_rct_Region_033
        local location p = gg_rct_p1_workers_start 
        local unit gate = CreateNUnitsAtLoc( 1, 'hprt', Player(0), GetRectCenter(m), bj_UNIT_FACING )
        local effect ef = AddSpecialEffectLoc("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTo.mdl", m)
        local unit m1 = CreateUnitAtLoc(Player(5), 'h014', GetRectCenter(m), 90.00)
        local unit m2 = CreateUnitAtLoc(Player(5), 'h014', GetRectCenter(m), 90.00)
        local unit m3 = CreateUnitAtLoc(Player(5), 'h014', GetRectCenter(m), 90.00)
        local unit m4 = CreateUnitAtLoc(Player(5), 'h014', GetRectCenter(m), 90.00)
        local unit r1 = CreateUnitAtLoc(Player(5), 'hrif', GetRectCenter(m), 90.00)
        local unit r2 = CreateUnitAtLoc(Player(5), 'hrif', GetRectCenter(m), 90.00)
        local unit r3 = CreateUnitAtLoc(Player(5), 'hrif', GetRectCenter(m), 90.00)
        local unit r4 = CreateUnitAtLoc(Player(5), 'hrif', GetRectCenter(m), 90.00)
        local unit h1 = CreateUnitAtLoc(Player(5), 'H015', GetRectCenter(m), 90.00)  
        call TriggerExecute( gg_trg_Army1_text ) 
        call CameraSetTargetNoiseEx(10, 5*Pow(10, 5), true)
        call CameraSetSourceNoiseEx(10, 5*Pow(10, 5), true)
        call GroupPointOrder(GetUnitsInRectAll(m), "move", GetRectCenter(p)) 
        call DestroyEffect(ef)
        call KillUnit( gate )
        call TriggerSleepAction(4.00)
        call SetUnitOwner(m1, Player(0), true)
        call SetUnitOwner(m2, Player(0), true)
        call SetUnitOwner(m3, Player(0), true)
        call SetUnitOwner(m4, Player(0), true)
        call SetUnitOwner(r1, Player(0), true)
        call SetUnitOwner(r2, Player(0), true)
        call SetUnitOwner(r3, Player(0), true)
        call SetUnitOwner(r4, Player(0), true)
        call SetUnitOwner(h1, Player(0), true)
        call CameraSetTargetNoiseEx(0, 0*Pow(0, 0), true)
        call CameraSetSourceNoiseEx(0, 0*Pow(0, 0), true)
        call RemoveLocation(m)
        call RemoveLocation(p)
        set gate = null
        set ef = null
        set m = null
        set p = 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
        call DisableTrigger( GetTriggeringTrigger() )
endfunction
//===========================================================================
function Army_P1 takes nothing returns nothing
    local trigger army = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( army, Player(0), EVENT_PLAYER_UNIT_TRAIN_FINISH )
    call TriggerAddCondition(army, Condition(function army_conds))
    call TriggerAddAction( army, function army_acts )
endfunction


I will explain, to start i have to regions: m and p.
1- The number is reached, the camera starts shacking and a text is displayed
2- Create a portal in region m
3- Create the special Town Portal Effect in region m
4- create 9 units in region m for Player 6
5- order those units to move to region p
6- Once the units reach the region, their ownership goes to Player 1
7- Stop shacking the camera


However i have several problems with BJ's and even more problems with the dam locations .... i just don't know how to use them .... yet ..

So what i ask here is if some1 who understands my script to plz help me improve it and, more important, please help me make it work (ya, because it doesn't work).

This is my next level of JASS learning ... as you can see i tried to dismount the Cam BJ's and i think i did it ... Anyway help please ?

Also if you have a better system to keep track of trained units, instead of creating a single UnitGroup for each player, plz share that method with me.

Use coordinates, and natives.
 
Status
Not open for further replies.
Top