• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How to make a Creepspawn with upgrades

Level 6
Joined
Apr 22, 2009
Messages
164
Re-create these easy triggers to create a fully functional Creep Spawn system which upgrades units every 30 seconds.

Step 1: The Variable and Regions

For this trigger you will need At least 2 regions. One region for spawning the units and one for the units to move towards. If you like you can use more regions as "corners" on a lane. You can also use 2 or more separate "Spawning" Regions. This map uses 2 spawning regions because I want the Ranged units behind the melee units. This trigger system will make you spawn units, send them to a corner, and send them to a final region which is where you want them to go. As well as this the units will "upgrade" to better units ever 30 seconds. This map also has a final trigger which removes any units that enter the finalr egion. This trigger is optional and is only used to stop units from clogging up.

You will needthe follwoing variables:
MeleeUnit (Unit-type (Array))
RangeUnit (Unit-type (Array))
Upgrade(Integer)

Set the variables up with this trigger.
  • Variables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set MeleeVariable[1] = Militia
      • Set MeleeVariable[2] = Footman
      • Set MeleeVariable[3] = Captain
      • Set MeleeVariable[4] = Knight
      • Set RangeVariable[1] = Rifleman
      • Set RangeVariable[2] = Archer
      • Set RangeVariable[3] = Dragonhawk Rider
      • Set RangeVariable[4] = Gryphon Rider
      • Set Upgrade = 1
Step 2: Set Upgrade Timing

To upgrade the units we will use the Upgrade Variable. Make this trigger to upgrade units every 15 seconds.
  • Upgrade Set-up
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
      • Upgrade Not equal to 4
    • Actions
      • Set Upgrade = (Upgrade + 1)
      • Game - Display to (All players) the text: (The Units are now level + (String(Upgrade)))
Step 3: Unit Spawning

This basic trigger will spawn units in the respective regions. If you want to be more precise spawn ranged units BEHIND melee using a region which is ebhind the melee region.
  • Unit Spawns
    • Events
      • Time - Every 15.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 4 MeleeVariable[Upgrade] for Player 2 (Blue) at (Center of Melee Spawn <gen>) facing Default building facing degrees
      • Unit - Create 2 RangeVariable[Upgrade] for Player 2 (Blue) at (Center of Range Spawn <gen>) facing Default building facing degrees
Step 4: Moving Units

For this trigger we will be moving the spawned units to attack enemies. We do this by "sending" them to another region. If you used 2 regions for spawning you'll need 2 triggers for the first movement. Also the condition is used so other units that aren't part of the spawn won't move.
The Melee Trigger
  • Unit Enters Melee Spawn
    • Events
      • Unit - A unit enters Melee Spawn <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
    • Actions
      • Unit - Order (Triggering unit) to Attack-Move To (Center of Corner <gen>)
The Ranged Trigger
  • Unit Enters Range Spawn
    • Events
      • Unit - A unit enters Range Spawn <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
    • Actions
      • Unit - Order (Triggering unit) to Attack-Move To (Center of Corner <gen>)
Step 5: The Final Movement

It's almost over. Finally the last trigger will move you to the last region which i name the "objective" region. This is the last trigger if your doing an AoS, If your doing a TD or something like that you will want Step 6: The Removal to remove excess units.
  • Unit Enters Corner
    • Events
      • Unit - A unit enters Corner <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
    • Actions
      • Unit - Order (Triggering unit) to Attack-Move To (Center of Objective Region <gen>)
Step 6: The Removal

This trigger removes units that enter the final region. It also adds 1 point to the Score Variable which will record how many monsters have made it to the final objective. The variable is Score(Integer). The bottom trigger is a simple trigger which shows a player the score when they type -Score.
Removal Trigger
  • Unit Enters Objective
    • Events
      • Unit - A unit enters Objective Region <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
    • Actions
      • Unit - Remove (Triggering unit) from the game
      • Set Score = (Score + 1)
Show Score Trigger
  • Show Score
    • Events
      • Player - Player 1 (Red) types a chat message containing -Score as An exact match
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (String(Score))

Well thats the end of the tutorial. It IS NOT leakless because I wanted to keep it simple for new map makers. I hope its of use to someone. Any queries or questions can be left as a comment. A demo map is added below with good documentation.
 

Attachments

  • Demo Map Upgrade System.w3x
    18 KB · Views: 61
Top