Force computer to continuously produce workers

Post Reply
operwolf
Terran Settler (Unemployed)
Terran Settler (Unemployed)
Posts: 3
Joined: Wed Aug 27, 2008 7:31 pm

Force computer to continuously produce workers

Post by operwolf »

I'm a noob to starcraft map editing and just enjoy basically messing around with it and recently ran into a problem.
I can't figure out how to force the computer to produce workers throughout the mission.  Or at least to begin workers when the number of them get below a certain number, then stop producing workers once they are at a certain number again.  I guess any unit for that matter, assuming they all work the same way.

Hope that's not too confusing.
User avatar
Legion
Xel'naga Hero
Xel'naga Hero
Posts: 1140
Joined: Tue Aug 21, 2007 1:17 am

Re: Force computer to continuously produce workers

Post by Legion »

operwolf wrote: I'm a noob to starcraft map editing and just enjoy basically messing around with it and recently ran into a problem.
I can't figure out how to force the computer to produce workers throughout the mission.  Or at least to begin workers when the number of them get below a certain number, then stop producing workers once they are at a certain number again.  I guess any unit for that matter, assuming they all work the same way.

Hope that's not too confusing.
So, you want a computer to produce workers, when they don't have any to begin with or build additional workers? Because in the first case, I'd say giving the computer's town hall the '[race] Area Town' AI script, although I've never tried that out. If the computer already commands a number of workers, or at least one, I'm pretty sure it would only create more if it absolutely needed them. I'm not an expert on AI scripting, but you could make your own (which is an arduous undertaking, I'd think) where you can control the number of peasants the computer builds.

Controlling the number of units (any unit) is easily done with the "command" condition or somesuch.

I don't think I've helped you much, to be honest. What is the effect you're trying to create? Because maybe there's a way to work around it.
User avatar
Lavarinth
Xel'naga Administrator
Xel'naga Administrator
Posts: 6539
Joined: Wed Aug 16, 2006 5:21 pm
Location: His Ashworld Planet

Re: Force computer to continuously produce workers

Post by Lavarinth »

If you're running an AI Script, the scripts limit the amount of units it needs to perform its script. The script could say "only have ten workers at a time" for example. I don't know of how to avoid this without creating your own script or attempting to spawn workers through triggers and possibly having the AI acknowledge them and make them work.
- - Lavarinth
Campaign Creations Administrator
operwolf
Terran Settler (Unemployed)
Terran Settler (Unemployed)
Posts: 3
Joined: Wed Aug 27, 2008 7:31 pm

Re: Force computer to continuously produce workers

Post by operwolf »

The Real Legion, I have tried the [race] Area Town AI script in the triggers and it basically works as you said.  The computer only creates more as needed.  What I am am trying to do is force the computer to always have a constant number of workers, let's say 30.  I give them say 20 at the start of the mission.  Now I would like them to build 10 until they reach 30 and if one gets killed they should build one.

I tried the Command trigger as you suggested and the unit just appears at the specified location on the map, but I would prefer the unit to be built in the appropriate structure.

Lavarinth, I have no experience with writing my own script and had no idea it was even possible until I began wondering if this problem I have found was even possible.  Once I began to do some research I found that people write scripts.  I may have to look into this but it looks quite complicated and I am really just building custom maps for fun and to see if I can come up with anything decent.

Perhaps if someone could write a small script that I could edit where it could control the amount of a specific unit that the computer race controls at any given time, and when that number is different than what the script specifies, the specific unit is built out of the correct building.  I would be very grateful.
User avatar
Lavarinth
Xel'naga Administrator
Xel'naga Administrator
Posts: 6539
Joined: Wed Aug 16, 2006 5:21 pm
Location: His Ashworld Planet

Re: Force computer to continuously produce workers

Post by Lavarinth »

You could attempt the other suggestion I mentioned as well.
- - Lavarinth
Campaign Creations Administrator
operwolf
Terran Settler (Unemployed)
Terran Settler (Unemployed)
Posts: 3
Joined: Wed Aug 27, 2008 7:31 pm

Re: Force computer to continuously produce workers

Post by operwolf »

Lavarinth wrote: You could attempt the other suggestion I mentioned as well.
I would give it a try but I am still unsure how to have the unit be built out of the correct building rather than spawn on the map using triggers.
User avatar
Lavarinth
Xel'naga Administrator
Xel'naga Administrator
Posts: 6539
Joined: Wed Aug 16, 2006 5:21 pm
Location: His Ashworld Planet

Re: Force computer to continuously produce workers

Post by Lavarinth »

operwolf wrote:
Lavarinth wrote: You could attempt the other suggestion I mentioned as well.
I would give it a try but I am still unsure how to have the unit be built out of the correct building rather than spawn on the map using triggers.
I meant use triggers. If you want to mimic the effect, you can place a Location over the general area a unit spawns out of a specific building and then have a trigger Spawn unit at Location, and hope the AI Script picks up the worker and makes it actually do something.
- - Lavarinth
Campaign Creations Administrator
Post Reply