• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Auto produce units (castlefight-style)

Status
Not open for further replies.
Level 1
Joined
Jan 11, 2008
Messages
1
I don't get how this is done properly.
What I want is a system that lets you select between some unit types (~3) in a building which are produced then and queued automatically. Is this done with spells? I tried to do it with autocasting spells, but no spell just autocasts for no reason, and doing it with a simple timer doesnt seem to be the best solution since i have multiple buildings and so I would need a timer for each building, wouldnt I?

Any help appreciated :)
 
Level 11
Joined
Feb 22, 2006
Messages
752
A timer for each building isn't really a bad thing (unless you have like hundreds of buildings spawning units). In my opinion it's your best shot. (If you really want to have only one timer, you could just make the callback function loop through every building and spawn accordingly, but this way all your buildings would have to have to have the same spawn cooldown and they would all spawn at the same time.)
 
Level 12
Joined
Apr 15, 2008
Messages
1,063
At the game start, create a single timer that expires in 9999999 seconds. The just save the time of the last spawn for each building and check every second or so, if there has been a period long enough to spawn another unit.

Another option is to use Custom value, every second increase the custom value of each building by 1, and if it reaches certain number, spawn unit ans set custom value to 0.

Or third option, make the spawn ability from raise dead, which autocasts "for no reason" and give the buildng teh graveyard ability (spawns corpses). You will propably need mltiple different raise dead abilities
 
Level 2
Joined
May 28, 2009
Messages
7
Where can i read about this factory spell? I newbie too, and need spawn script :)

Edit: okay, I think I understand it. So if I create a custom factory spell for all buildings, then I can leed the spawnings (and the building destroyed then the spawn will dismissed) Am I rignt?
 
Last edited:
Level 22
Joined
Feb 4, 2005
Messages
3,971
Yes, the ability cannot work for destroyed buildings, just for those still standing :)

Remember that it can only produce one type of unit, you can increase the levels of the ability and make other levels produce another unit type if you want more than 1 type.


Or
  • h
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Barracks) and do (Unit - Order (Picked unit) to train/upgrade to a Footman)
If the race reaches food limit or needs more food or gold, it will only work for as much food and gold it has and then until the next 30 seconds when if having enough food or gold will continue training.
 
Status
Not open for further replies.
Top