• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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,208
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