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

[Trigger] Need guidance, i suck at timers.

Status
Not open for further replies.
Trigger 1
  • Reload
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to Permanent
    • Actions
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to WeaponUnit[(Integer A)]
              • (Item being manipulated) Equal to (Item carried by (Triggering unit) of type WeaponTypes[(Integer A)])
            • Then - Actions
              • Item - Set charges remaining in (Item being manipulated) to ((Charges remaining in (Item being manipulated)) + 1)
              • Countdown Timer - Start ReloadTimer[(Player number of (Owner of (Triggering unit)))] as a One-shot timer that will expire in 3.00 seconds
              • Set ReloadingUnit[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
            • Else - Actions
  • Finish
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 1, do (Actions)
        • Loop - Actions
          • Set FilledIn = (WeaponRounds[(Integer A)] - (Charges remaining in (Item carried by ReloadingUnit[(Integer A)] of type WeaponTypes[(Integer A)])))
          • Item - Set charges remaining in (Item carried by ReloadingUnit[(Integer A)] of type WeaponTypes[(Integer A)]) to ((Charges remaining in (Item carried by ReloadingUnit[(Integer A)] of type WeaponTypes[(Integer A)])) + FilledIn)
          • Item - Set charges remaining in (Item carried by ReloadingUnit[(Integer A)] of type BulletType[(Integer A)]) to ((Charges remaining in (Item carried by ReloadingUnit[(Integer A)] of type BulletType[(Integer A)])) - FilledIn)
  • Setup Weapons
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Set WeaponTypes[1] = M4A1 Carbine
      • Set WeaponTypes[2] = AK-47
      • Set WeaponUnit[1] = M4A1 Carbine
      • Set WeaponUnit[2] = AK-47
      • Set BulletType[1] = 5.56mm Magazine
      • Set BulletType[2] = 7.62mm Magazine
      • Set WeaponRounds[1] = 30
      • Set WeaponRounds[2] = 30
      • For each (Integer A) from 1 to 9, do (Actions)
        • Loop - Actions
          • Trigger - Add to Finish <gen> the event (Time - ReloadTimer[(Integer A)] expires)
How do i actually connect the first two triggers? Thelast one is just for those who are confused why there are no events in the second trigger.
 
Level 11
Joined
May 8, 2009
Messages
275
100? for what?

Well you wanted to connect your triggers right?
A Timer with an Array Size of 1 won't work (same as Unit Groups), by increasing the size to 100, the second trigger will also fire for timer[2] to timer[9].

Now in the second trigger you loop from 1 to 1, since the ReloadingUnit's index matches the owning player's number, it works for player 1 only .... You have to use an Hashtable and save the player's number within the timer to properly load which player belong to which timer.
 

Attachments

  • Fighting Zombies.w3x
    261.9 KB · Views: 87
Level 11
Joined
May 8, 2009
Messages
275
Status
Not open for further replies.
Top