| 08-24-2004, 10:01 AM | #1 |
Hi. In a TD i'm creating i'm setting up a "special level" in which some large flying sheeps are the target. When they die, the'll fall out of the sky (still not the biggest problem), but after that I want to replace the unit with 2 (or more) smaller walking sheep. The walking sheeps need to follow the same pattern as their "parents" (the flying sheep) did. For this I want to "copy" the order of the flying sheep and set that order on the walking sheep. Is this possible? And uhm.. how ;) |
| 08-24-2004, 10:21 AM | #2 |
Triggers: Code:
SheepSpawn
Events
Unit - A unit Dies
Conditions
(Unit-type of (Dying unit)) Equal to Flying Sheep
Actions
Unit Group - Pick every unit in (Units within 250.00 of (Position of (Dying unit)) matching ((Unit-type of (Triggering unit)) Equal to WalkingSheep)) and do (Actions)
Loop - Actions
Unit - Order (Picked unit) to Move To (Center of (Region)) |
| 08-27-2004, 07:29 PM | #3 | |
Quote:
That's the point... I don't want them to move to a center of just a region. I want them to move to the same region as the original unit did. In other words, 'copy' the order of the dying unit. |
| 08-27-2004, 08:04 PM | #4 |
It would be quite complicated. Many if/than/elses, getting what region they are in, and then ordering them to go to the next one. |
| 08-27-2004, 08:57 PM | #5 |
I'm not sure, but I think the easiest way to do this is using unit groups. Have one unit group for each region (path part-goal, you know what I mean) and make sure the flying sheeps are always in the unit group that fits their current order (remove/add from units group while giving orders). Using this, you should be able to determine what region they are heading towards and thus give the new units the same order: If (dying unit) is in unit group "X". Order (last created unit) to move to region "Z". That's all I can think of right now. |
| 08-28-2004, 01:35 AM | #6 |
I dunno if this will help or not, but i extracted the blizzard secret TD map which has zeppelins that do the same thing as u have there. Heres the map and the related triggers so you can take a look at how bliz did it. Code:
Calculate Dying Path Target
Events
Conditions
Actions
-------- Find The Zep's Path Target --------
Set DyingPathTarget = 0
For each (Integer A) from 1 to PathTargets, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Dying unit) is in UnitsOnPath[(Integer A)]) Equal to True
Then - Actions
Set DyingPathTarget = (Integer A)
Else - ActionsCode:
Send Zeppelin Subspawn
Events
Conditions
Actions
-------- Create Subspawn --------
Set TempPoint = (Position of (Dying unit))
Unit - Create 1 SubspawnType for P07_HumansWave at (TempPoint offset by (Random real number between 0.00 and 64.00) towards (Random angle) degrees) facing (Random angle) degrees
Custom script: call RemoveLocation( udg_TempPoint )
-------- Die If Too Early --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(DestroyPlayerSummonedUnits <gen> contains (Last created unit)) Equal to True
Then - Actions
Unit - Explode (Last created unit)
Skip remaining actions
Else - Actions
-------- Bookkeeping --------
Unit Group - Add (Last created unit) to AttackingUnits
Unit Group - Add (Last created unit) to UnitsOnPath[DyingPathTarget]
-------- Tweak Unit --------
AI - Ignore (Last created unit)'s guard position
Unit - Turn collision for (Last created unit) Off
Special Effect - Create a special effect attached to the hand left of (Last created unit) using ExplosiveArt
-------- Move To Waiting Spot --------
Unit - Order (Last created unit) to Move To PointPathTargetArray[DyingPathTarget] |
| 08-28-2004, 02:23 AM | #7 |
Make a variable, integer, and everytime the sheep get to a corner, set the variable higher. When the big sheep dies, create some sheep at the triggering units point, and then check the variable with if's, if its 1, send them to the center of region 1, if its 2, send them to the center of region 2. Here is an example: Code:
Path 1
Events
Unit - A unit enters Path 1 <gen>
Conditions
(Owner of (Triggering unit)) Equal to Creep
Actions
Set MoveSheep = 1
Unit - Order (Triggering unit) to Move To (Center of Path 2 <gen>)
Path 2
Events
Unit - A unit enters Path 2 <gen>
Conditions
(Owner of (Triggering unit)) Equal to Creep
Actions
Set MoveSheep = 2
Unit - Order (Triggering unit) to Move To (Center of Path 3 <gen>)
Sheep Dies
Events
Unit - Sheep dies
Conditions
(Owner of (Triggering unit)) Equal to Creep
Actions
Unit - Create 1 No Small Sheep for Creeps at (Position of (Triggering unit)) facing Default building facing degrees
If (MoveSheep Equal to 1) then do (Unit - Order (Last created unit) to Move To (Center of Path 2 <gen>)) else do (Do nothing)
If (MoveSheep Equal to 2) then do (Unit - Order (Last created unit) to Move To (Center of Path 3 <gen>)) else do (Do nothing)Path 1, Path 2, and Path 3 are regions for the Creeps to follow a path. MoveSheep is an Integer variable. Im not sure if this is the easiest way but im pretty sure it should work. |
| 08-28-2004, 08:43 AM | #8 |
The last three posts basically said the same thing, they just do things in different ways. Still think my way would be the easiest way though. :) |
| 08-28-2004, 05:30 PM | #9 |
Thanks guys! I've worked along these tips and have used the "custom value" of the unit to see in what region it has been. Basicly, every time it enters a region along the path the custom value is added with one and then the unit is given an order to move to next region in an array of regions. Now when the big sheep dies, the "custom value" is copied to the new (smaller sheep) units and the value is substracted with one. Then I manually execute the "region entered"-trigger again to set the correct "move to" command again. Again, thank you all very much |
| 08-30-2004, 02:09 PM | #10 |
Just create regions all over their path and then: Events: A unit enters Region Condition: owner of entering unit equal to Player # Action: Unit - Order Unit to move to center of (playable map area). Now you just have to create one trigger for each path. you can add multiple "unit enters region" event for one trigger. Happy mapping |
| 08-30-2004, 02:18 PM | #11 |
Frozzt, there is really not many TD's in which you can use this strategy. First of all, all monsters would have to be going for the middle. Second, they'll use their own pathfinding on the entire terrain instead of going to each regin. Last, there can be bugs and glitches where monsters stop in this system. I wouldn't really recommend it :/ |
