Auto spawning units from BUILT buildings.

WarToast

Active Member
Reaction score
3
Hello, I've been searching around a lot on this subject, but couldn't find anything that relates directly to my problem. ;)

As in the map Tech Wars Tournament (by oxYgen and Blu3), I'd like to be able to build buildings and make them spawn units. In TWT units are spawned as if there is a summon spell on auto-cast, but after reading around a bit, I've found that it is not possible.

So I need to make a trigger. I can't make the basic periodic spawner because I don't have a specific building already on the map - I need a constructed building to start periodically spawning units.

By the way, I have tried using this:

Code:
Events
    Time - Every 10.00 seconds of game time
Actions
    Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Barracks)) and do (Unit - Create 1 Footman for (Owner of (Picked unit)) at (Position of (Picked unit)) facing Default building facing degrees)

but that spawns units from the building as soon as I start constructing it, also I'd like buildings to have "individual" spawn times, and with a periodic event, units will be created at the same time, no matter when you build the building.

So to wrap this mess up: I need constructed buildings to spawn units, independant on some periodic event, maybe with an ability, auto-cast with triggers?

Thanks in advance guys :thup:
 

Squishy

You can change this now in User CP.
Reaction score
127
You could try setting every building's custom value to 10, and then every second, subtract 1 from every buildings custom value, then, when a building custom value reaches 0, you can create a unit for that building, and set the custom value to 10 again.
 

WarToast

Active Member
Reaction score
3
You could try setting every building's custom value to 10, and then every second, subtract 1 from every buildings custom value, then, when a building custom value reaches 0, you can create a unit for that building, and set the custom value to 10 again.

Woah, that's not really what I had in mind ;) Thanks for answering dude

I think that what I'm looking for is a summon spell that is made auto-cast by triggers.
 

martix

There is no spoon
Reaction score
49
The easy way:
Give each building a summon ability based on the same initial ability(the phoenix one?) and add them to a group, then at say 1 second intervals order each unit in the group to cast that ability. They may be diffrent abilites, but if they are based on the same OrderId(initial ability), all of them will respond to the summon order. Now of course add the proper cooldown, they won't summon anything unless the ability is ready anyway.
That way you don't monopolize the custom value field and have it free for other tasks. :)
The hard way:
JASS and attachments and stuff. :)
 

verdr3t

New Member
Reaction score
8
Or try something simpler like this...

Variables:
Footmen_Timer - Timer
Barracks_Spawn - Point

Code:
Barracks
    Events
        Unit - A unit Finishes construction
    Conditions
        (Unit-type of (Triggering unit)) Equal to Barracks
    Actions
        Countdown Timer - Start [COLOR="Red"]Footmen_Timer[/COLOR] as a Repeating timer that will expire in 30.00 seconds

Code:
Spawn Footmen
    Events
        Time - Footmen_Timer expires
    Conditions
    Actions
        Unit - Create 1 Footman for Player 1 (Red) at [COLOR="Red"]Barracks_Spawn[/COLOR] facing Default building facing degrees

Of course this is only the basics. You also need to consider that there my be
more Barracks, what happens when the Barracks are destroyed and stuff.

EDIT: You can optionally add a Dummy ability to the building which is being
cast when the timer expires but does nothing so you are able to judge by the
cooldown animation when the next waves starts.


Cheers
 

Squishy

You can change this now in User CP.
Reaction score
127
If taking up the custom value is a problem, there are methods to get multiple custom values.
 

Cokemonkey11

New Member
Reaction score
18
I'm not having the problem, and I know 5 other ways off the top of my head to fix the problem, but how do you get multiple custom values? substrings or something? like 1515 = 1, 5, 1, 5?

sorry for offtopic question
 

Squishy

You can change this now in User CP.
Reaction score
127
You can get multiple custom values through integer arrays. First make sure every units custom value is different. Then, make as many integer arrays as you want. Then you can use the arrays as custom values by using the custom value of units as the array number.
 

PureOwnage

Minecraft Server OP, Inactive.
Reaction score
72
By looking at the video, it runs off a auto cast summoning ability then orders the unit to go to the selected region.
 

martix

There is no spoon
Reaction score
49
By the looks of it - its a summoning ability, that is ordered to cast once cooldown is over...
So it can be done either with a universal periodic event as I suggested earlier - with a smaller interval(don't know how this will affect performance though) or, detect the event of casting that ability and start a repeating timer, that upon expiration casts it again.
So yea, not entirely different from what I already said.
 

verdr3t

New Member
Reaction score
8
I think it's just a dummy spell running off everytime a unit is spawned and the rest is triggered.
 

XxShadyxX

I abused the rep system.
Reaction score
81
Here is a simple way of spawning units
Code:
UnitSpawnBarracks
Events
Generic Unit Event: A building is constructed
Condition
Triggering Unit is a Barracks
Action
Issue order with no target: Issue triggering unit to Train a Footman

Trigger 2
Code:
Spawns
Events
A Unit is trained
Conditions
Actions
Issue triggering unit to issue Train of type of trained unit

I hope this helps!! for the First trigger you need to make one for each building that has spawns. To make it easier put them all into a If/then/else function for each building!

I hope this answers your question GL
 

WarToast

Active Member
Reaction score
3
Hey everyone

Certainly got a lot of suggestions in here! I contacted the maker of Tech Wars Tournament sometime ago and today I received an answer.

Well, it turns out that he based his summoning spells on the Archmage's Summon Water Elemental. Then, every 0,5 sec, he ordered all units to cast this ability... that simple.

Also, if anyone is interested, he mentioned that he posted a non-protected version of his map on his TWT blog http://techwarstournament.blogger.de/.

Link here: http://techwarstournament.blogger.de/getfile?name=tech+wars+tournament+1.1b.w3x


Really appreciate all your answers, and I'll look through them. Thanks guys :thup:
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top