StarCraft® II

How to limit the number of workers

Posts: 84
Hello all!
I want make this so a player can only warp-in/train/spawn 15 workers throughout the game.

I was fooling around with protoss and
I was able to limit the number of workers by going to: warp in probe ability > Info charge count max > I set this to 15 (max worker)
> Info charge start > i set this to the same as max (how many times i can use the ability)
> Info charge use > set it to 1 so it will count -1 from usage

All works neatly with 1 little bump!

If a worker dies the " Info charge use " wont count it as +1 to info charge use meaning I can only build 15 workers and if they all die I wont be able to replace them.

How do I fix this?

Hope I made sence... :)
Reply Quote
Posts: 2
I haven't tried this on data but on triggers, set it to "-1"
Reply Quote
Developer
Posts: 236
I'd suggest using requirement data since it sounds like you want to limit them to 15 at a time and that's easy to hookup with requirements.

Requirements for abilities are assigned in the Ability portion of the data editor. These can be assigned per command for all ability types, so you can have unique requirements for each button, or have them all share the same requirements; up to you.

There are two types of requirements: use and show. Use requirements will disable a button if they are not met; show requirements will hide the button if they aren't met.

If you want all types of workers to be considered as a group, then you can use a "sum" requirement node that combines the "count" requirement nodes of all types you want to check for. Another method would be to assign the same tech alias in the unit data for each of the worker types you want to be equivalent and then you can use a single count node and compare the count to whatever you want.

If you haven't worked with requirement data a lot, I'd suggest looking at how requirements are setup for something similar. For example, there is a requirement on the Nexus to prevent more than one Mothership from being constructed. You'd basically want to mimic that setup to start and make tweaks to it to suit your data (basically choosing different unit types rather than the Mothership and a different total count).
Reply Quote
Posts: 84
Cool thx for the reps guys!!

so this is what i did :

new requirement-->use-->Less than-->count unit-->probe-->queued or better-->constant-->15

This works great!

The only thing tho is when I add those digits (15/15/1) to the Info Charge the #15 will show up on the probe build icon and will count how many probes I built, now when i destroy 1 it wont show that I can build 1 more (only the number won't show, the icon goes colored from grayed ).

so it counts down the queued ones but wont count up if 1 killed.

Can u help me out ?

Thx!
Edited by Bushido on 11/13/2012 11:18 PM PST
Reply Quote
Posts: 598
There is one way to display the current available scv count.

You can imitate the nuke abilty. nuke have max limit per Ghost Academy, while you can replenish them after they be used. And it would show the current nuke amount on ghost's calldown ability button.

What you need to do is reverse the Magazine number.

The only problem is Train ability cannot display calldown number, so you may need to use a effect ability to simulate the button
Edited by Renee on 11/15/2012 7:58 PM PST
Reply Quote
Posts: 598
Duplicate post
Edited by Renee on 11/14/2012 3:16 AM PST
Reply Quote
Posts: 84
Ye it looks a bit complicated right now. I want to spend time on other things that needs to be done so I might get back to this later.
And since this is a TD map I removed the supplies on all units .
But now I added (+) 15 to the town centers and -1 for probe/drone/SCV.
This way the supply count will show how many worker a player has, elliminating the need of the counter on the icon itself (and the requirement for that matter)
Edited by Bushido on 11/15/2012 4:12 PM PST
Reply Quote
Posts: 3
Not sure if anyone still needs to know this info but, heres how you limit the number of workers you can build, and be able to build another if one gets killed or used up (ie zerg drone mutating into a building)

  • From opening the map editor, find the 'Data' button on the top near the 'Triggers' button.
  • Like the Triggers it opens up a new window, click on the 'Requirements' tab
  • Next click on the 'Requirement' drop down menu on top and click 'Add Requirement'
    Give it a name, doesnt matter what it is, but I suggest using the name of the unit that you are limiting the number built of. I.E Drone, Probe or SCV.
  • Next the ID under the name, just simple press the 'Suggest' button to make things easier and simple
  • Move down and select the race the unit is associated with
  • Select the Tech type. (Basically the type of limitation its going to be.) In this case because we are limiting units, select 'Unit'
  • Thats it for that part, click 'OK'
    Next with your new Requirement selected in the left box, in the right box you should have 2 green items and the rest is grayed out.. If this is what you see you're on the right track
  • In the right box under 'Field' find the line that says "(Basic)Basic: Requirement -" and across from that to the right should say ((None)(None))
  • Double Click the '((None)(None))'
  • Should open a new window with the name of you requirement and underneathe it , 'Use' and 'Show" (Here determine if you want the button to always be visible or not. If you choose 'Use' the button will be colored until the requirements are met and then go gray until the requirements are not met. Which it will then become colored again until requirements are re-met. I.E you set up to build max 15 drones. You build 15 drones, meeting the requirements, button grays out. You kill a drone leaving you with 14, not meeting the requirements, the button becomes colored again, until you create that 15th. If you choose 'Show' it does the EXACT same thing as 'Use' except the button wont be grayed out, it will simply dissapear when the requirements are met, and reappear when they arent met.)
  • So Choose one, right click on it and select 'Add Requirement Node'
  • Select the new node, should be 'And' by default'
    on the right is a drop down menu, select it and select 'Not Equal to' (Here also you may want to add a tool tip as to why the player can no longer build these units. This tooltip will show up once the requirements are met. So something like "Must have fewer than 15 Drones" for example)
  • On the left again you see your 'Not Equal To' node, right click that and select 'Add Requirement Node' Do this twice. You should see something like this
  • Not Equal to
    And
    And
  • Select the first 'And' and on the right select 'Count Unit'
  • For Alias, select the unit of which you are limiting (I.E Drone)
  • For State, select 'Queued or Better' (However for zerg, because their unit build Process isn't queued but rather each larva is selected and used, you must choose 'In Progress or Better'
  • Now select the second 'And' and again on the right select 'Constant'
  • For Value Select the max number of this particular unit you wish to have before the requirement is met.
  • Thats it for that part, Click 'OK'
    Now to add the requirement you made to a building process.
  • where you once selected the 'Requirements' tab, now to the left, selet the 'Units' tab
  • In the box to the left, find the Structure (or in the zergs case the unit) that creates the unit you are limiting. (I.E Terran = Command Center Protoss = Nexus and Zerg = Larva)
  • For Terran when you have the 'Command Center' selected, below is a list of all the Command Centers abilities, buttons, requirements.. etc. Select Command Center - Train (Command Center)
  • For Protoss when you have 'Nexus' selected, same as terran, only select 'Nexus - Train (Nexus)
  • For Zerg when you have 'Larva' selected, underneath select 'Larva - Morph Unit (Larva-> Basic)
  • For either of the above cases, on the right side you now see a load of lines, Simple double click the very top one, which opens a new window, and again double click the very top one (Morph to Drone, Train SCV or Warp in Probe)
  • Which Opens another window.
    In this window there is a bunch of changes you can make, resource cost, build time, recharge time, charges avaliable etc.
  • To simply insert the new requirement, you will see the 'Requirement' and its field is blank. From the list below it, find your requirement and select it (Should be under the sub-folder 'Unit')
  • Then click 'OK'
  • Voila!! You have now created a limiting requirement for that unit
    You can copy and paste that Requirement and modify it to fit other units if you wish.
    Reply Quote

    Please report any Code of Conduct violations, including:

    Threats of violence. We take these seriously and will alert the proper authorities.

    Posts containing personal information about other players. This includes physical addresses, e-mail addresses, phone numbers, and inappropriate photos and/or videos.

    Harassing or discriminatory language. This will not be tolerated.

    Forums Code of Conduct

    Report Post # written by

    Reason
    Explain (256 characters max)
    Submit Cancel

    Reported!

    [Close]