Tutorial Creep Spawn and Moving them.

simonake

New Member
Reaction score
72
Intelligent Creep Spawn.
By Simonake


Purposes:
This system has been created, to help you to make easier creep spawns and to help you moving them once created. (Very useful for Tower defenses). Triggers are leakless, Mui and shouldn't bug. It can bug when the Unit's collision size is too hight, units can stop moving and lost their orders.
  • Notes: If you use custom spells that modify the custom value of the units that will be spawn, you can't use this system because it use the custom value of the units.
  • Notes: To stop spawning, remove the location of the player.
  • Notes: This system can't be implent on your map because it's use region of my own map. Create your map and custom the system for yourself.

How it's work.

1. Moving the units part


  • At map Initialization, it set all the region where's the units must pass. The trigger below shows how it's done in the map that's provided at the end of the Tutorial. (Only for Red). You set each unit to a "Unit region array" variable. Then you do a trigger like this one.

Trigger:
  • Initializing region
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Start --------
      • -------- Red --------
      • Set Red_Region[1] = Red1 <gen>
      • Set Red_Region[2] = Red2 <gen>
      • Set Red_Region[3] = Red3 <gen>
      • Set Red_Region[4] = Red4 <gen>
      • Set Red_Region[5] = Red5 <gen>
      • Set Red_Region[6] = Red6 <gen>
      • Set Red_Region[7] = Red7 <gen>
      • Set Red_Region[8] = Red8 <gen>
      • Set Red_Region[9] = Red Ender <gen>
      • Set zTempSpawnPoint[1] = (Center of Red1 <gen>)


  • Now you have to create a trigger that will order a unit that enters a region to go to the next one. (This is for red once again.) You order to the unit to go to the region, it custom value +1 in therms, next region.
Trigger:
  • Red Regions
    • Events
      • Unit - A unit enters Red1 <gen>
      • Unit - A unit enters Red2 <gen>
      • Unit - A unit enters Red3 <gen>
      • Unit - A unit enters Red4 <gen>
      • Unit - A unit enters Red5 <gen>
      • Unit - A unit enters Red6 <gen>
      • Unit - A unit enters Red7 <gen>
      • Unit - A unit enters Red8 <gen>
    • Conditions
      • ((Triggering unit) is A Structure) Equal to_ FALSE
      • (Owner of (Triggering unit)) Equal to Joueur 12 (Brown)
    • Actions
      • Unit - Set the custom value of (Triggering unit) to ((Custom value of (Triggering unit)) + 1)
      • Set zTempOrderPoint = (Center of Red_Region[((Custom value of (Triggering unit)) + 1)])
      • Unit - Order (Triggering unit) to Move to zTempOrderPoint
      • Custom script: call RemoveLocation( udg_zTempOrderPoint)


  • (This is a Optional part) And finally removing the units when they enter last region. When the unit enters, it's removed and it creates a special effect.
Trigger:
  • RedEnder
    • Events
      • Unit - A unit enters Red Ender <gen>
    • Conditions
      • ((Triggering unit) is A Structure) Equal to FALSE
      • (Owner of (Triggering unit)) Equal to Joueur 12 (Brown)
    • Actions
      • Set zTempUnitEffectPoint = (Position of (Triggering unit))
      • Unit - Remove (Triggering unit) from the game
      • Special Effect - Create a special effect at zTempUnitEffectPoint using Objects\Spawnmodels\NightElf\NECancelDeath\NECancelDeath.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation( udg_zTempUnitEffectPoint )



2. Creating the unit part
  • You basicly use a periodic trigger with a unit-type variable and change the variable.
Trigger:
  • Spawning
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Unit - Create 1 zSpawn_UnitType for Joueur 12 (Brown) at zTempSpawnPoint[(Integer A)] facing 0.00 degrees


  • Then this is the part where's the unit-type of created unit will change. Again, this is quite simple. (It's an example.)
Trigger:
  • Setting Unit Type
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set zSpawn_UnitType = Troll Priest 1
      • Wait 45.00 seconds
      • Set zSpawn_UnitType = No unit type
      • Wait 15.00 seconds
      • Set zSpawn_UnitType = Troll Priest 2
      • Wait 45.00 seconds
      • Set zSpawn_UnitType = No unit type
      • Wait 15.00 seconds
      • Set zSpawn_UnitType = Troll Priest 3
      • Wait 45.00 seconds
      • Set zSpawn_UnitType = No unit type
      • Wait 15.00 seconds
      • Set zSpawn_UnitType = Troll Priest 4
      • Wait 45.00 seconds
      • Set zSpawn_UnitType = No unit type
      • Wait 15.00 seconds
      • Set zSpawn_UnitType = Axe Troll 1
      • Wait 45.00 seconds
      • Set zSpawn_UnitType = No unit type
      • Wait 15.00 seconds
      • Set zSpawn_UnitType = Axe Troll 2
      • Wait 45.00 seconds
      • Set zSpawn_UnitType = No unit type
      • Wait 15.00 seconds
      • Set zSpawn_UnitType = Axe Troll 3
      • Wait 45.00 seconds
      • Set zSpawn_UnitType = No unit type
      • Wait 15.00 seconds
      • Set zSpawn_UnitType = Axe Troll 4


Thank you for reading, questions, suggestions, find bug, leaks; Post comments.
(Map is done for 8 player :( it's just to help you to understand how it's work)
:thup:
 

wraithseeker

Tired.
Reaction score
122
Ryoko's tower defense tutorial is more detailed, you need to explain more or this will get graveyarded probaby..
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Just a few things I noted about this:
Notes: If you use custom spells that modify the custom value of the units that will be spawn, you can't use this system because it use the custom value of the units.
Any good TD will most likely use custom spells.

Trigger:
  • Initializing region
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Start --------
      • -------- Red --------
      • Set Red_Region[1] = Red1 <gen>
      • Set Red_Region[2] = Red2 <gen>
      • Set Red_Region[3] = Red3 <gen>
      • Set Red_Region[4] = Red4 <gen>
      • Set Red_Region[5] = Red5 <gen>
      • Set Red_Region[6] = Red6 <gen>
      • Set Red_Region[7] = Red7 <gen>
      • Set Red_Region[8] = Red8 <gen>
      • Set Red_Region[9] = Red Ender <gen>
      • Set zTempSpawnPoint[1] = (Center of Red1 <gen>)
Why do you need the last one?
And I don't think people will have 9 regions;
Showing just 3-4 would get the point across.

Trigger:
  • Spawning
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Unit - Create 1 zSpawn_UnitType for Joueur 12 (Brown) at zTempSpawnPoint[(Integer A)] facing 0.00 degrees
Have you tested this?
I'm pretty sure this would lag, a lot.
Even with only 8 players, 8 x 12 = 96 units being create at once.

Trigger:
  • Setting Unit Type
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set zSpawn_UnitType = Troll Priest 1
      • Wait 45.00 seconds
      • Set zSpawn_UnitType = No unit type
      • Wait 15.00 seconds
      • Set zSpawn_UnitType = Troll Priest 2
      • Wait 45.00 seconds
      • [...]
What's all this doing?
And why all the waits.
This will become very inaccurate after a while.

Also, with the whole using custom values thing.
What if a player mazes so that a creep goes:
PointStart -> Point4 -> Point 2 -> Point 1 -> Point 3 -> PointEnd
Would your system still work (As I don't believe it would) .

And like wraithseeker said;
Not being rude but there are already a couple of these out there.
See: Guide - Tower Defense by AndrewGosu.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top