PoLlama Forums  

Go Back   PoLlama Forums > WarCraft > Tutorials > Submit a Tutorial [World Editor]

Reply
 
LinkBack Thread Tools Rating: Thread Rating: 1 votes, 5.00 average.
Old 08-11-2008   #1
 
shocker's Avatar
 
Join Date: Oct 2007
Posts: 1,089
shocker is a jewel in the roughshocker is a jewel in the rough
[Tutorial] Spawning Systems

This Tutorial is for all those people who want to learn how to make a spawn system.

Tutorial will be in 5 chapters
  1. Making a Timer
  2. Army Spawning
  3. Base Upgrading Spawning
  4. Single Troop Spawning
  5. Buying/Changing controll of a Base

Color Code:
Red = Variable
Blue = Unit on the map
Green = Unit type


Chapter 1: Making a Timer

A timer is key in most spawning maps because it tells the troops when to spawn. Below is a trigger that makes a timer that last 90 seconds, repeats, and is show to all players.

Code:
setting a timer
    Events
        Time - Elapsed game time is 5.00 seconds
    Conditions
    Actions
        Countdown Timer - Start timer as a Repeating timer that will expire in 90.00 seconds
        Countdown Timer - Create a timer window for timer with title Spawn Time
        Countdown Timer - Show (Last created timer window)
Trigger Break Down

Code:
 Time - Elapsed game time is 5.00 seconds
Will make the trigger happen 5 seconds after the game starts

Code:
Countdown Timer - Start timer as a Repeating timer that will expire in 90.00 seconds
Sets the timer to last 90 secs and repeat
Varaible "timer" is a Timer type varaible

Code:
 Countdown Timer - Create a timer window for timer with title Spawn Time
Makes a window for the timer

Code:
Countdown Timer - Show (Last created timer window)
Lets players see the timer


Chapter 2: Spawning Armys
This is for when you train 1 troop many troops are made. A map example would be Rise of Empires. The trigger show is for when a troop named army is trained 9 footment and 3 rifleman are made at the owners base.

Code:
army spawns
    Events
        Unit - A unit Finishes training a unit
    Conditions
        (Owner of (Trained unit)) Equal to (Owner of Town Hall 0002 <gen>)
        (Unit-type of (Trained unit)) Equal to Army
    Actions
        Set A_temp_point = (Center of Region 000 <gen>)
        Unit - Create 9 Footman for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
        Unit - Create 3 Rifleman for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
        Unit - Remove (Trained unit) from the game
        Custom script:   call RemoveLocation (udg_A_temp_point)
Trigger Break Down

Code:
 Unit - A unit Finishes training a unit
starts the trigger when a troop is trained

Code:
(Owner of (Trained unit)) Equal to (Owner of Town Hall 0002 <gen>) 
makes sure that the troop was made by Town Hall 0002

Code:
 (Unit-type of (Trained unit)) Equal to Army
makes sure that the troop trained was Army

Code:
 Set A_temp_point = (Center of Region 000 <gen>)
sets the spot were you want the troops to spawn

Code:
Unit - Create 9 Footman for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
        Unit - Create 3 Rifleman for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
makes 9 footmen and 3 rifleman at the spot

Code:
Unit - Remove (Trained unit) from the game
removes the unit called army that was jsut trained form the map

Code:
 Custom script:   call RemoveLocation (udg_A_temp_point)
deletes the varable A_temp_point from the game to stop memory leaks. do not skip this part, or it will make your game laggy in the end.

Chapter 3: Base Upgrading Spawning

In this chapture it tells how to make you spawn mroe when you biuld something like a barrack and spawn less if the barrack dies. e.x. Lost kingdoms, 12 kingdoms, and most basic spawn system maps.

trigger 1: add spawns
Code:
adding base lvl
    Events
        Unit - A unit owned by (Owner of Town Hall 0002 <gen>) Finishes training a unit
    Conditions
        (Owner of (Trained unit)) Equal to (Owner of Town Hall 0002 <gen>)
        (Unit-type of (Trained unit)) Equal to Barracks
    Actions
        Set base_lvl = (base_lvl + 1)
Trigger Break Down

Code:
 Unit - A unit owned by (Owner of Town Hall 0002 <gen>) Finishes training a unit
starts trigger when town hall trains a unit

Code:
(Owner of (Trained unit)) Equal to (Owner of Town Hall 0002 <gen>)
        (Unit-type of (Trained unit)) Equal to Barracks
checks the ownership and the type of the unit

Code:
 Set base_lvl = (base_lvl + 1)
sets the varrable to a higher number to know how many barracks that base made.
Varaible "base_lvl" is a intager type varaible starting at value 0

Trigger Two

trigger 2:spawning troops based on lvl

Code:
 spawning
    Events
        Time - timer expires
    Conditions
        (Owner of Town Hall 0002 <gen>) Not equal to Neutral Passive
    Actions
        Set A_temp_point = (Center of Region 000 <gen>)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                base_lvl Equal to 0
            Then - Actions
                Unit - Create 2 Footman for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
                Unit - Create 1 Rifleman for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        base_lvl Equal to 1
                    Then - Actions
                        Unit - Create 7 Footman for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
                        Unit - Create 3 Rifleman for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                base_lvl Equal to 2
                            Then - Actions
                                Unit - Create 10 Footman for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
                                Unit - Create 5 Rifleman for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
                                Unit - Create 3 Knight for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
                            Else - Actions
        Custom script:   call RemoveLocation (udg_A_temp_point)
Trigger Break Down

Code:
Time - timer expires
starts trigger when the timer ends

Code:
 (Owner of Town Hall 0002 <gen>) Not equal to Neutral Passive
if the base is buy-able then it starts out nuetal passive and this will stop it from spawning untill it is baught.

Code:
 Set A_temp_point = (Center of Region 000 <gen>)
sets the spot the troops will spawn at

Code:
base_lvl Equal to 0
ckecks the amount of barracks made and seeing if it is 0

Code:
 Unit - Create 2 Footman for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
                Unit - Create 1 Rifleman for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
makes 2 footmen and 1 riflmen at the target spot

Code:
  If - Conditions
                        base_lvl Equal to 1
                    Then - Actions
                        Unit - Create 7 Footman for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
                        Unit - Create 3 Rifleman for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
same as above just check to see if it has 1 barrack then spawns 7 footmen and 3 rifleman

Code:
 If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                base_lvl Equal to 2
                            Then - Actions
                                Unit - Create 10 Footman for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
                                Unit - Create 5 Rifleman for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
                                Unit - Create 3 Knight for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
same as above just check to see if it has 2 barrack then spawns 10 footmen and 5 rifleman and 3 knights

Code:
  Custom script:   call RemoveLocation (udg_A_temp_point)
deletes the varable A_temp_point from the game to stop memory leaks. do not skip this part, or it will make your game laggy in the end.

Trigger Three

trigger three: lowering level when barrack is destroyed
Code:
 lower base lvl
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Dying unit)) Equal to Barracks
    Actions
        Set base_lvl = (base_lvl - 1)
Trigger Break Down

Code:
 Unit - A unit Dies
trigger starts when a unit is killed

Code:
(Unit-type of (Dying unit)) Equal to Barracks
checks to see if the unit the dieded is a barrack

Code:
Set base_lvl = (base_lvl - 1)
lowers the varrable number

Trigger Four

trigger four:sets max amount of barracks
Code:
 setting max amout of base upgrades
    Events
        Unit - Town Hall 0002 <gen> Changes owner
    Conditions
    Actions
        Player - Limit training of Barracks to 2 for (Owner of Town Hall 0002 <gen>)
Trigger Break Down

Code:
 Unit - Town Hall 0002 <gen> Changes owner
when ownership changes from like buying a base or someone capturing it the trigger start.

Code:
  Player - Limit training of Barracks to 2 for (Owner of Town Hall 0002 <gen>)
sets the max amount of barracks that can be trained

Chapter 4: Single Troop Spawning

In this Chapter it tells you how to add spawns by biulding troops like in broken alliances

trigger 1: add spawns
Code:
adding single troops 2 spawn
    Events
        Unit - A unit owned by (Owner of Town Hall 0002 <gen>) Finishes training a unit
    Conditions
        (Owner of (Trained unit)) Equal to (Owner of Town Hall 0002 <gen>)
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Unit-type of (Trained unit)) Equal to Footman
            Then - Actions
                Set footmen = (footmen + 1)
                Unit - Remove (Trained unit) from the game
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Unit-type of (Trained unit)) Equal to Rifleman
            Then - Actions
                Set rifleman = (rifleman + 1)
                Unit - Remove (Trained unit) from the game
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Unit-type of (Trained unit)) Equal to Knight
            Then - Actions
                Set knight = (knight + 1)
                Unit - Remove (Trained unit) from the game
            Else - Actions
Trigger Break Down

Code:
Unit - A unit owned by (Owner of Town Hall 0002 <gen>) Finishes training a unit
trigger start when the owner of town hall trains a unit

Code:
 (Owner of (Trained unit)) Equal to (Owner of Town Hall 0002 <gen>)
checks that the owner of the townhall equalls the owner of the troop

Code:
(Unit-type of (Trained unit)) Equal to Footman
checks to see if the unti trained is a footmen

Code:
Set footmen = (footmen + 1)
adds one to the varrable "footmen" which is counting how many footmen were trained
Varaible "footmen" is a intager type varaible starting at value 0

Code:
 Unit - Remove (Trained unit) from the game
removes the footmen that was trained

Code:
     If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Unit-type of (Trained unit)) Equal to Rifleman
            Then - Actions
                Set rifleman = (rifleman + 1)
                Unit - Remove (Trained unit) from the game
            Else - Actions
does the same thing as above but with rifleman not a footmen

Code:
  If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Unit-type of (Trained unit)) Equal to Knight
            Then - Actions
                Set knight = (knight + 1)
                Unit - Remove (Trained unit) from the game
            Else - Actions
does the same thing as above but with knight not a footmen

Trigger Two

trigger 2:spawning the troops
Code:
 spawning single added troops
    Events
        Time - timer expires
    Conditions
        (Owner of Town Hall 0002 <gen>) Not equal to Neutral Passive
    Actions
        Set A_temp_point = (Center of Region 000 <gen>)
        Unit - Create footmen Footman for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
        Unit - Create rifleman Rifleman for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
        Unit - Create knight Knight for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
        Custom script:   call RemoveLocation (udg_A_temp_point)
Trigger Break Down

Code:
  Time - timer expires
trigger starts when timer hits zero

Code:
  (Owner of Town Hall 0002 <gen>) Not equal to Neutral Passive
stops troops from spawning if base is not owned by a player

Code:
 Unit - Create footmen Footman for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
makes the amount of footmen equall to varrable "footmen"

Code:
Unit - Create rifleman Rifleman for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
makes the amount of rifleman equall to varrable "rifleman"

Code:
  Unit - Create knight Knight for (Owner of Town Hall 0002 <gen>) at A_temp_point facing Default building facing degrees
makes the amount of knights equall to varrable "knight"

Code:
 Custom script:   call RemoveLocation (udg_A_temp_point)
deletes the varable A_temp_point from the game to stop memory leaks. do not skip this part, or it will make your game laggy in the end.

Chapter 5: Buying/Changing controll of a Base

In this Chapter it tells you how to make a base buy-able and how to change ownership like if the base is captured.

trigger 1: buying a base
Code:
 buying a base
    Events
        Unit - Peasant 0001 <gen> Sells a unit
    Conditions
    Actions
        Unit - Change ownership of Town Hall 0002 <gen> to (Owner of (Buying unit)) and Change color
        Unit - Change ownership of Guard Tower 0004 <gen> to (Owner of (Buying unit)) and Change color
        Unit - Change ownership of Guard Tower 0003 <gen> to (Owner of (Buying unit)) and Change color
        Unit - Change ownership of Guard Tower 0005 <gen> to (Owner of (Buying unit)) and Change color
        Unit - Change ownership of Guard Tower 0006 <gen> to (Owner of (Buying unit)) and Change color
        Unit - Remove (Sold unit) from the game
        Unit - Remove (Selling unit) from the game
Trigger Break Down

Code:
 Unit - Peasant 0001 <gen> Sells a unit
starts the trigger when a peasant sells a troop

Code:
   Unit - Change ownership of Town Hall 0002 <gen> to (Owner of (Buying unit)) and Change color
        Unit - Change ownership of Guard Tower 0004 <gen> to (Owner of (Buying unit)) and Change color
        Unit - Change ownership of Guard Tower 0003 <gen> to (Owner of (Buying unit)) and Change color
        Unit - Change ownership of Guard Tower 0005 <gen> to (Owner of (Buying unit)) and Change color
        Unit - Change ownership of Guard Tower 0006 <gen> to (Owner of (Buying unit)) and Change color
change owner ship of the base and towers to the person who bought the troop form the peasant

Code:
 Unit - Remove (Sold unit) from the game
        Unit - Remove (Selling unit) from the game
removes the peasant and the troop it sold from the game

Trigger Two

trigger 2:hange base ownership when low hp
Code:
changing base ownership adv
    Events
        Unit - Town Hall 0002 <gen> Is attacked
    Conditions
        (Life of (Triggering unit)) Less than or equal to 500.00
    Actions
        Unit - Change ownership of Town Hall 0002 <gen> to (Owner of (Attacking unit)) and Change color
        Unit - Set life of (Triggering unit) to 100.00%
        Set footmen = 0
        Set rifleman = 0
        Set knight = 0
Trigger Break Down

Code:
 Unit - Town Hall 0002 <gen> Is attacked
starts trigger when town hall is attacked

Code:
(Life of (Triggering unit)) Less than or equal to 500.00
checks to see if hp is less then 501

Code:
Unit - Change ownership of Town Hall 0002 <gen> to (Owner of (Attacking unit)) and Change color
change ownership of town hall to the owner of the attacking unit

Code:
 Unit - Set life of (Triggering unit) to 100.00%
gives townhall full hp

Code:
    Set footmen = 0
        Set rifleman = 0
        Set knight = 0
only need if you are using Single Troop Spawning system
removes all spawns added to the base

Last edited by shocker; 08-18-2008 at 11:09 PM.
shocker is offline   Reply With Quote
Old 08-18-2008   #2
 
shocker's Avatar
 
Join Date: Oct 2007
Posts: 1,089
shocker is a jewel in the roughshocker is a jewel in the rough
Re: [Tutorial] Spawning Systems

ok its finaly done!
shocker is offline   Reply With Quote
Old 08-19-2008   #3
 
King_Leopold's Avatar
 
Join Date: Apr 2007
Posts: 2,436
King_Leopold is a jewel in the roughKing_Leopold is a jewel in the roughKing_Leopold is a jewel in the rough
Re: [Tutorial] Spawning Systems

nice tutorial on the basics of spawning

Go to this link, now. [Only registered and activated users can see links. ]
King_Leopold is offline   Reply With Quote
Old 08-22-2008   #4
 
JuniorXpd's Avatar
 
Join Date: Jan 2008
Location: Los Angeles, California
Posts: 226
JuniorXpd is a jewel in the roughJuniorXpd is a jewel in the roughJuniorXpd is a jewel in the rough
Re: [Tutorial] Spawning Systems

hey can u guys show me how to grant control units automaticly to his allies if a player leaves?...


example: player red leaves, control is given to all his allies AUTOMATICALLY

i know its not a very smart question coming from me...
JuniorXpd is offline   Reply With Quote
Old 08-23-2008   #5
 
shocker's Avatar
 
Join Date: Oct 2007
Posts: 1,089
shocker is a jewel in the roughshocker is a jewel in the rough
Re: [Tutorial] Spawning Systems

jsut look in the triggers it a realy simple one to do but y are u asking here?
shocker is offline   Reply With Quote
Old 08-23-2008   #6
 
JuniorXpd's Avatar
 
Join Date: Jan 2008
Location: Los Angeles, California
Posts: 226
JuniorXpd is a jewel in the roughJuniorXpd is a jewel in the roughJuniorXpd is a jewel in the rough
Re: [Tutorial] Spawning Systems

Quote:
Originally Posted by shocker View Post
jsut look in the triggers it a realy simple one to do but y are u asking here?
cuz i feel like i make too many threads...



I am a King
I am a warrior
I am a honest and fair man
I am the future
I am JuniorXpd
JuniorXpd is offline   Reply With Quote
Old 08-25-2008   #7
 
shocker's Avatar
 
Join Date: Oct 2007
Posts: 1,089
shocker is a jewel in the roughshocker is a jewel in the rough
Re: [Tutorial] Spawning Systems

well this is not even close 2 the right spot 2 even ask that question....
shocker is offline   Reply With Quote
Old 09-06-2008   #8
 
shocker's Avatar
 
Join Date: Oct 2007
Posts: 1,089
shocker is a jewel in the roughshocker is a jewel in the rough
Re: [Tutorial] Spawning Systems

so how do i get the tutorial apoved?
shocker is offline   Reply With Quote
Old 10-03-2008   #9
 
Nine's Avatar
 
Join Date: Jul 2008
Location: Labrador City , NL , Canada
Posts: 12
Nine is an unknown quantity at this point
Re: [Tutorial] Spawning Systems

Nice tutorial.

-----------------------------------------------------
ZOMG!>!@?!@!
Nine is offline   Reply With Quote
Old 10-04-2008   #10
 
shocker's Avatar
 
Join Date: Oct 2007
Posts: 1,089
shocker is a jewel in the roughshocker is a jewel in the rough
Re: [Tutorial] Spawning Systems

WOOT at lest some one thinks so!
shocker is offline   Reply With Quote
Old 10-05-2008   #11
 
Blocksoul[BAWL]'s Avatar
 
Join Date: Aug 2008
Posts: 257
Blocksoul[BAWL] is on a distinguished road
Re: [Tutorial] Spawning Systems

Im gunna try to make a small map using this spawning system just for fun. If it works it should get approved.

Aussie Hip Hop, whilst there isnt much of it, Bliss n Eso hold us down.... So check them out.
Blocksoul[BAWL] is offline   Reply With Quote
Reply

Tags
None

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may post replies
You may post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] King's General Guide to (spawn-based) Map-Making. King_Leopold Submit a Tutorial [World Editor] 4 08-10-2008 01:14 AM
Shockers spawning map (still needs name) shocker Members Projects 4 02-13-2008 06:49 PM
[Tutorial] Map Protection/Optimization tylord Submit a Tutorial [World Editor] 6 06-13-2007 09:24 PM
[TUTORIAL] Background Coloring. state-property Graphics and Art 2 06-08-2007 02:57 PM
[Tutorial] Quickmask MrOrange Graphics and Art 2 05-26-2007 05:36 PM


All times are GMT -5. The time now is 07:23 PM.

A friend of Wc3Happy
Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165