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

Limits

Status
Not open for further replies.
Level 2
Joined
Aug 24, 2008
Messages
17
k some one just asked in a thread below how to put a limit on how many of a certain unit you can have. he got.

player - limit of training footman to 2 player 1 (red)

this is good but i have another problem
My question being can you set a limit like that to 3 different units where as for example you have footmen, riflemen, and Knights but you can only make 6 in any combination

Note:
not talking about food limits
 
This might work:
  • Train
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Trained unit)) Equal to Footman
          • (Unit-type of (Trained unit)) Equal to Rifleman
          • (Unit-type of (Trained unit)) Equal to Knight
    • Actions
      • Set TrainTotal[(Player number of (Triggering player))] = (TrainTotal[(Player number of (Triggering player))] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TrainTotal[(Player number of (Triggering player))] Equal to 6
        • Then - Actions
          • Player - Limit training of Footman to 0 for (Triggering player)
          • Player - Limit training of Rifleman to 0 for (Triggering player)
          • Player - Limit training of Knight to 0 for (Triggering player)
        • Else - Actions
  • Reduce
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Footman
          • (Unit-type of (Triggering unit)) Equal to Rifleman
          • (Unit-type of (Triggering unit)) Equal to Knight
    • Actions
      • Set TrainTotal[(Player number of (Triggering player))] = (TrainTotal[(Player number of (Triggering player))] - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TrainTotal[(Player number of (Triggering player))] Equal to 5
        • Then - Actions
          • Player - Limit training of Footman to -1 for (Triggering player)
          • Player - Limit training of Rifleman to -1 for (Triggering player)
          • Player - Limit training of Knight to -1 for (Triggering player)
        • Else - Actions
Variable: TrainTotal[] - Integer Array

Basically, when it trains a unit of that type it adds to the total of those 3 units. Once it gets to 6, it limits the training. Once it gets reduced to 5 after the death of one of those units, it will allow the training once more. (-1 allows for unlimited training)
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
With that system you're able to put many units in production queue and end up having more than 6 units.

You need to play around with "Unit begins training a unit" and
  • Custom script: call IssueImmediateOrderById( GetTriggerUnit( ), 0xD0008 )
^That issues cancel order.
 
Status
Not open for further replies.
Top