Group Limiting Question

Status
Not open for further replies.
Level 7
Joined
Nov 6, 2019
Messages
186
ok so, i trying to limit building of specific Unit/Building, i read around to get it to monitor a trigger, i know how to limit one, but want to limit the entire set of buildings so max of 7 total of any building, so 3 sentry, 2 turretbase, 2 gun tower, then u cant upgrade unit ro build another as limit is 7 over all

i have set up the trigger it works, however if limit reached it kills the unit that building and that is putting limit down

so if u limit to 7, and build 6 units after it lets u have 10 units, as it -1 to integer when it cancels the unit

  • TurretLimiter
    • Events
      • Unit - A unit Begins construction
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Triggering unit) Equal to SetHeroGS[(Player number of (Owner of (Triggering unit)))]
              • (Unit-type of (Triggering unit)) Equal to Turret Base
              • (Unit-type of (Triggering unit)) Equal to Helix Laser Sentry
              • (Unit-type of (Triggering unit)) Equal to Laser Sentry
              • (Unit-type of (Triggering unit)) Equal to Rocket Sentry
              • (Unit-type of (Triggering unit)) Equal to Sentry Gun
              • (Unit-type of (Triggering unit)) Equal to Sentry Gun II
              • (Unit-type of (Triggering unit)) Equal to |cffd45e19Undead|r Sentry
              • (Unit-type of (Triggering unit)) Equal to Adaptive Sentry
              • (Unit-type of (Triggering unit)) Equal to |cff00ff00Undead|r Experimental Tower
              • (Unit-type of (Triggering unit)) Equal to |cff00ff00Undead|r Fire Laser
              • (Unit-type of (Triggering unit)) Equal to |cff00ff00Undead|r Poison Laser
              • (Unit-type of (Triggering unit)) Equal to |cff00ff00Undead|r Shock Laser
              • (Unit-type of (Triggering unit)) Equal to |cff00ff00Undead|r Radar Tower
              • (Unit-type of (Triggering unit)) Equal to |cff00ff00Undead|r Turret Base
              • (Unit-type of (Triggering unit)) Equal to |cff00ff00Undead|r Vulcan
              • (Unit-type of (Triggering unit)) Equal to |cffd45e19Undead|r Turret
              • (Unit-type of (Triggering unit)) Equal to |cffd45e19Undead|r Blast Tower
              • (Unit-type of (Triggering unit)) Equal to |cffd45e19Undead|r Monument
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TurretLimitInterger[(Player number of (Owner of (Triggering unit)))] Greater than or equal to 7
            • Then - Actions
              • Set VariableSet CancelUnit = (Triggering unit)
              • Countdown Timer - Start CancelTimer as a One-shot timer that will expire in 0.00 seconds
              • Game - Display to (Player group((Owner of (Triggering unit)))) the text: [|cffff0000U|rD|cff...
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TurretLimitInterger[(Player number of (Owner of (Triggering unit)))] Less than 7
                • Then - Actions
                  • Set VariableSet TurretLimitInterger[(Player number of (Owner of (Triggering unit)))] = (TurretLimitInterger[(Player number of (Owner of (Triggering unit)))] + 1)
                • Else - Actions
        • Else - Actions
  • TurretLimitReducer
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Dying unit)) Equal to Turret Base
              • (Unit-type of (Dying unit)) Equal to Helix Laser Sentry
              • (Unit-type of (Dying unit)) Equal to Laser Sentry
              • (Unit-type of (Dying unit)) Equal to Rocket Sentry
              • (Unit-type of (Dying unit)) Equal to Sentry Gun
              • (Unit-type of (Dying unit)) Equal to Sentry Gun II
              • (Unit-type of (Dying unit)) Equal to |cffd45e19Undead|r Sentry
              • (Unit-type of (Dying unit)) Equal to Adaptive Sentry
              • (Unit-type of (Dying unit)) Equal to |cff00ff00Undead|r Experimental Tower
              • (Unit-type of (Dying unit)) Equal to |cff00ff00Undead|r Fire Laser
              • (Unit-type of (Dying unit)) Equal to |cff00ff00Undead|r Poison Laser
              • (Unit-type of (Dying unit)) Equal to |cff00ff00Undead|r Shock Laser
              • (Unit-type of (Dying unit)) Equal to |cff00ff00Undead|r Radar Tower
              • (Unit-type of (Dying unit)) Equal to |cff00ff00Undead|r Turret Base
              • (Unit-type of (Dying unit)) Equal to |cff00ff00Undead|r Vulcan
              • (Unit-type of (Dying unit)) Equal to |cffd45e19Undead|r Turret
              • (Unit-type of (Dying unit)) Equal to |cffd45e19Undead|r Blast Tower
              • (Unit-type of (Dying unit)) Equal to |cffd45e19Undead|r Monument
        • Then - Actions
          • Set VariableSet TurretLimitInterger[(Player number of (Owner of (Triggering unit)))] = (TurretLimitInterger[(Player number of (Owner of (Triggering unit)))] - 1)
        • Else - Actions
  • CancelTrigger
    • Events
      • Time - CancelTimer expires
    • Conditions
    • Actions
      • Custom script: call IssueImmediateOrderById(udg_CancelUnit, 851976)
 
Level 7
Joined
Nov 6, 2019
Messages
186
so what you want is just for the player to be able to have a max of 7 buildings? or is it more complicated than that?
Na not Complicated, am just not Smart

Anywho, so basically player can have max of 7 defensive buildings

So what all of them buildings to share the same MaxBuild Limit

So you can have max of any 7 of them buildings or 7 of the one, but once interferes reaches 7 you can’t build any more of any of them, and if any of them did it -1 so you can build another
 
Level 25
Joined
Mar 29, 2020
Messages
1,424
here, this does what you want:

  • limit buildings
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(farm))
          • (Issued order) Equal to (Order(humanbarracks))
    • Actions
      • Set VariableSet ExistingBuildings = (Units owned by (Triggering player) matching (((Matching unit) is A structure) Equal to True).)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in ExistingBuildings) Greater than or equal to 7
        • Then - Actions
          • Set VariableSet TempPoint = (Position of (Triggering unit))
          • Unit - Order (Triggering unit) to Move To TempPoint
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Set VariableSet TempPlayerGroup = (Player group((Triggering player)))
          • Game - Display to (Player group((Triggering player))) the text: |cffffff00You Have reached the max amount of buildings! |r
          • Custom script: call DestroyForce(udg_TempPlayerGroup)
          • Sound - Play Error <gen>
        • Else - Actions
      • Custom script: call DestroyGroup(udg_ExistingBuildings)
To get this to work, you just need to add conditions with the Order string for your buildings. In order to find out what those are, just use this:
  • tester
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (String((Issued order)))

If you want the sound to work you need to select the sound you want from the sound editor.

(also I'm assuming you know to use warpten to speed up testing this kind of stuff)

and I'll attach my test map here too.
 

Attachments

  • Limit Buildings.w3m
    18.6 KB · Views: 8
Last edited:
Status
Not open for further replies.
Top