• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Refering to expiring triggers, help

Status
Not open for further replies.
Level 6
Joined
Aug 29, 2004
Messages
159
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:
Code:
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
 
Level 6
Joined
Aug 29, 2004
Messages
159
ok, here's the entire trigger, as i have it so far.

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