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

Problem in TD

Status
Not open for further replies.
Level 2
Joined
Feb 13, 2013
Messages
7
Hi

I have problem in tower defense.
Enemy units want to steal children from the center of the map (instead of life). If enemy comes into middle, it persuade one child to follow it back to spawning zone. If they reach it, they both disappear. If player lost all his children (number of children depends on difficulty), game is over. During the wave, player can return one of his child back.
My problems
- when followed unit dies, i want return child back to middle
or
- if followed unit dies, child will stop movement. If another enemy unit come close to it, they will run to spawning zone.
How can it be done?

Thx for help
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
When a unit picks up a child you add it to a group (havechild). You also use a hashtable to map the child to the unit (so from the unit you can get the child). When a unit dies and is inside the group (havechild) then you get its child (look it up in the hashtable) and order it to move back.
 
Status
Not open for further replies.
Top