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

[Trigger] Need guidance, i suck at timers.

Status
Not open for further replies.
Level 18
Joined
Dec 17, 2009
Messages
1,114
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 10
Joined
May 8, 2009
Messages
253
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.
 
Level 18
Joined
Dec 17, 2009
Messages
1,114

Attachments

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