• 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.

Replacement of dying units

Status
Not open for further replies.
Level 4
Joined
Aug 7, 2010
Messages
77
Hello all. As a noob, i have some trigger question regarding replacement of units. Replacement of units is used commonly in warcraft III campaigns.

For example, a footman guarding at position X was dead, Barrack A will automatically train back footman and he went back to the guarding position X. Position X is a fixed guarding spot such that if the guarding enemy were to chase and was dead half way, the newly trained unit will be backed guarding at Position X. What if i have a lot of units guarding while the barrack is trying to handle all of the unit's replacement that had been dead. Besides doing a hash table, any other trigger that can make this happen? Any help provided will be greatly appreciated.

Here's a draft on what i wanted.

 
Last edited:
Level 33
Joined
Mar 27, 2008
Messages
8,035
For example, a footman guarding at position X was dead
By "guarding", you mean it just stands passively at a static spot and wait for enemy ?
Or patrolling ?

So basically, how do we know that a Footman is on "guarding" mode ?
Right after it is spawned/trained ?

What if the Footman dies right after it is trained ?
Will it be re-train and move to that same location ?

Also, is there any gold/lumber/food requirements for this Footman to be trained ??
If it does, it stops automatically, right ?
And when to resume it back ?

A check of loop per 1 second interval for Players' Gold/Lumber/Food ?

You know you should think this thorough.
 
Level 13
Joined
Jun 3, 2011
Messages
1,058
Testing

Test if this work
  • Events
  • Unit - A unit Dies
  • Conditions
  • (Unit-type of (Dying unit)) Equal to Footman
  • Actions
  • Unit - Order Barracks 0090 <gen> to train/upgrade to a footman
  • Unit - Order (last created unit) to Move to (Center of Region 021 <gen>)
 
Level 11
Joined
Oct 31, 2010
Messages
1,057
did that work ? i am guessing it did not as the game cannot detect the last created unit becuase the barrack training the unit takes time,

what you should be doing is , make two triggers,

one is to order the barrack to train the unit (like the one above)

then the next trigger should be doing

event = a unit finishes training a unit
action = order trained unit to move to (region)
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
Ur triggered wont work because last created unit in ur trigger isnt the footman (Since footman needs time to be trained). Instead of order that barrack to train a foot man, why dont u use create unit? By doing that, ur last created unit will be footman.
edit: By saying u, i mean Legendary.
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
i guess his problem is something like this

210329-albums5809-picture62158.jpg


from what you see on the picture above, the slot to train footmans are already full. his question is, will the awaiting footman training (the footmans that is not on the slot) be trained after a slot is availabe? and if not, what should he do to counter this ? and he added a side note that he don't want to use any hashtables.

i'm just guessing anyway.
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
Hmm, in that case, may be using the unit create will be good, just add the wait time to it. And if he want to have the animation, create another trigger to cause the building to play that animation.
Edit: Omg, we post the reply in the same time again, darkzxx. :))
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
My Understanding:
1. Footman dies at location X
2. Barrack that is responsible to spawn that Footman will "re-train" the Footman
3. Until it has finished training, the newly trained Footman will go back to the Location X without being ordered by Players.

Question is, what happen if Footman training list is full ?
Or, players can't control the training productivity ?
Or do you want to spawn Footman based on custom training system (instead of default one from Blizzard) ?

So much loopholes....
 
Level 4
Joined
Aug 7, 2010
Messages
77
1st of all, thanks to all who replied this thread. +rep to all.

Sorry that i couldn't phrase it properly due to my poor english. i will try my best to explain again.

Hmm.. Anyone played war3 campaign? If an enemy AI unit (guarding in the enemy base) died due to player's attack, enemy barrack will immediately train back the same unit and this freshly trained unit will go to the position of the dying unit, taking over the dead unit's guarding role. And regarding the loophole on the max amount of unit in one barrack, i think the problem can be solved if there are multiple barracks?

Here's a draft on what i wanted.




This is the simple trigger that allows the dead unit to be retrained at barrack, but i don't know how to continue from here in order for the unit to go back to the guarding spot.


Any1 can help me continue?
 
Level 11
Joined
Oct 31, 2010
Messages
1,057
like i said, that trigger will not work !!!!, you have to make two triggers

one like this

Event = A unit dies event

Action = Order barrack to train a unit type of dying unit
Action = Set (Temppoint) = position of dying unit

-----------------------------

Second trigger like this

Event = A unit finishes training a unit

Action = Order trained unit to move to (Temppoint)
 
Level 4
Joined
Aug 7, 2010
Messages
77
like i said, that trigger will not work !!!!, you have to make two triggers

one like this

Event = A unit dies event

Action = Order barrack to train a unit type of dying unit
Action = Set (Temppoint) = position of dying unit

-----------------------------

Second trigger like this

Event = A unit finishes training a unit

Action = Order trained unit to move to (Temppoint)

well, this works for one unit. However if multiple units are dead, how do i store those position of the units?

Updated post 1.
 
Level 4
Joined
Aug 7, 2010
Messages
77
@darkzxx
It's useless to just give the name of the method to the solution when you don't show one.
Actions speaks louder than words

Here's a test map.

Thanks alot of the demo.

And i suddenly thought of something. Can we use the AI Editor(building tab) for the monitoring of lost unit and build back immediately?
 
Status
Not open for further replies.
Top