• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

How to Limit only 1 unit-type per game

Status
Not open for further replies.
Level 33
Joined
Mar 27, 2008
Messages
8,035
  • Cancel Train
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Barracks
    • Actions
      • Set Footman = (Trained unit)
      • Player - Make Footman Unavailable for training/construction by (Owner of Footman)
      • Trigger - Turn on Enable Train <gen>
      • Trigger - Turn off (This trigger)
  • Enable Train
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Footman is dead) Equal to True
        • Then - Actions
          • Player - Make Footman Available for training/construction by (Owner of Footman)
          • Trigger - Turn on Cancel Train <gen>
          • Trigger - Turn off (This trigger)
        • Else - Actions
If you have any question, please ask =D
The "Enable Train" trigger is Initially Off

TRIGGER EDITED
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
@GhostThruster
If we use "Player - Limit Training of Unit", can we possibly get back the unit ?
I mean, the trigger uses what concept ?
Max unit at ONE time OR Maximum unit throughout the game ?
If Max unit at one time, the limit for Z unit must NOT more than X value
If Max unit throughout the game, once the unit is created to a X value, the unit can NEVER be trained ever again
Well, too lazy to test it out (but not lazy to type... weird o.0)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
  • Unit - A unit Begins training a unit
If you use this, what if the player suddenly CANCELS the Training Order ?
The WHOLE trigger would be bugged
That's why I used Finishes training a unit because, even if the player cancels it, the trigger won't start

  • Unit - A unit Dies
If I use this Event, the system can be bugged too
A unit Dies event will go on if the game detects ANY unit in the map, DIES
Meaning, if some creep dies, the trigger will be fired, thus, ruining the WHOLE trigger
That's why I saved the Footman (trained unit) to a variable
So I can use it to check once every 0.03 seconds whether the SPECIFIC unit dies or live
 
Status
Not open for further replies.
Top