Warcraft III resources & community, 2003–2006 · archived

Refering to expiring triggers, help

3 posts
#1

Refering to expiring triggers, help

Hey guys
I have a trigger which by needs has to refer to multiple expiring timers. The timers are set as an array (72), and when the timer expires, i need to know the array number of which timer is expiring to determine where to send the unit subsequently created.
The only way that i can find to do this is like so:

For each (Integer A) from 1 to 72, do (Actions)
    Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Remaining time for SpawnTimer[(Integer A)]) Equal to 0.00
            Then - Actions
                Set UnitNumber = (Integer A)
            Else - Actions
                Do nothing



For some reason, this seems to be creating a million other ships (well, 72), implying that it is just running the trigger for each integer A, and seeing that each timer has 0 seconds remaining. Every timer has been created and set to having 1E1000 seconds remaining (1000 zeros people!) so theres no problem there that i can see. Anyone know whats wrong?


Hmm world edit really needs a way to reference array values... and a function to reference timers... and a timer to reference the Training unit (unit doing the training). hmm.

Any help much appreciated,
=][= Bort
#2
if interg a = to 1

create unit at position 1 or move unit to 1 whatever.

if integer a = to 2

create unit at position 2 or move unit to 2 whatever.

I dont get what your asking maybe give the entire trigger because nothingin that trigger creates boats.
#3
ok, here's the entire trigger, as i have it so far.


ShipLeave
    Events
    Conditions
    Actions
        For each (Integer A) from 1 to 72, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Remaining time for LeaveTimer[(Integer A)]) Equal to 0.00
                    Then - Actions
                        Set int_leaveship = (Integer A)
                        Set leave_playerno = (((int_leaveship - (int_leaveship mod 6)) / 6) + 1)
                        Countdown Timer - Start rLeaveTimer[int_leaveship] as a One-shot timer that will expire in 240.00 seconds
                        Unit - Create 1 Trading Ship for (Player(eave_playerno)) at (Center of shipleaveport[int_leaveship]) facing Default building facing degrees
                        Set shipname[int_leaveship] = (Last created unit)
                        Unit - Set the custom value of (Last created unit) to leave_playerno
                        Unit - Order (Last created unit) to Move To (Position of player_port[leave_playerno])
                    Else - Actions
                        Do nothing


Ok. The reason for the 'leave_playerno' maths function involving the modulos is because when the ship is created (via another trigger) it is given a reference number, the array number of the timer, by this funtion:

Set real_int_temp_creatship = ((((Player number of (Owner of (Triggering unit))) - 1) x 6) + (Random integer number between 0 and 5))

With a if-then-else function for each player this means that there 6 ships that each player can have: for example player two's ships would have array numbers (2-1)x6 + 0/1/2/3/4/5 = from 6 to 11. Then the playerno function should return this as:
(example number 10)= ((10-10mod6)/6) +1= 2
But for some reason its just creating 6 ships for every player in the regions around the map. Humm. Can you help me now?
Thanks,
=][= Bort