PoLlama Forums  

Go Back   PoLlama Forums > WarCraft > Tutorials

Reply
 
LinkBack Thread Tools Rate Thread
Old 04-27-2007   #1
 
MrOrange's Avatar
 
Join Date: Dec 2006
Posts: 2,992
MrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond repute
A Simple Footmen Spawn

FootmenWarsSpawnTutorial
One question I hear a lot is how to spawn units like in a Footmen Wars map. Well this tutorial will tell you just how to do that. First of all you need to know some basic GUi triggering and know about variables.
--------------------------
This a simple spawning trigger that you should be able to do easily, as long as I wrote correctly. Ok to start it off you need to make two variables. A Point variable and a Unit Group variable. Name them whatever you want. First of all, you know what the event is going to be. It's going to be something like this.

Code:
Spawn Footmen
  Events
    Time - Every 6.00 seconds of game time
  Conditions
  Actions
The event is a Time-Periodic Event.
--------------------------
Next we need to set the unit group variable. So for action set your unit group variable = A unit in region with matching condition. For condition make it an and condition. That would make the condition be two things instead of the normally having just one. For the region make it stay (playable map area) for the first comparison find the Unit-Type comparison. And make it say (Unit-Type of (matching unit) Equals To Barracks. And for the second one you will use the condition called Boolean Comparison. Click on the first part of the Boolean Comparison and change it to Unit-Unit is alive. Then make it say Matching Unit is alive. Then press ok for all the windows and your trigger should look something like this.

Code:
Spawn Footmen
  Events
    Time - Every 6.00 seconds of game time
  Conditions
  Actions
    Set Unit_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Barracks) and (((Matching unit) is alive) Equal to True)))
--------------------------
For the next action you will use something called Unit Group-Pick Every Unit in Unit Group and Do Multiple Actions. Then replace (Unit in (playable map area) to your unit group variable.

Code:
Spawn Footmen
  Events
    Time - Every 6.00 seconds of game time
  Conditions
  Actions
    Set Unit_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Barracks) and (((Matching unit) is alive) Equal to True)))
    Unit Group - Pick every unit in Unit_Group and do (Actions)
      Loop - Actions
--------------------------
For the first loop action you will set your point variable. Set it to Unit-Position of Unit. So make it say Position of (picked Unit). This is what you should have now.

Code:
Spawn Footmen
  Events
    Time - Every 6.00 seconds of game time
  Conditions
  Actions
    Set Unit_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Barracks) and (((Matching unit) is alive) Equal to True)))
    Unit Group - Pick every unit in Unit_Group and do (Actions)
      Loop - Actions
        Set Point = (Position of (Picked unit))
--------------------------
Now for the moment you all been waiting for. You finally get to make the unit. For the second action under the the loop.Find Unit-Create Unit facing angle. Make it say 1 Footmen for the first underline. Then for the second one. Find owner of unit. Then change it to owner of (Picked Unit). For the third underline make it say your Point variable. And then for the forth don't change anything because it should say at default building facing. So now you should have this.

Code:
Spawn Footmen
  Events
    Time - Every 6.00 seconds of game time
  Conditions
  Actions
    Set Unit_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Barracks) and (((Matching unit) is alive) Equal to True)))
    Unit Group - Pick every unit in Unit_Group and do (Actions)
      Loop - Actions
        Set Point = (Position of (Picked unit))
        Unit - Create 1 Footman for (Owner of (Picked unit)) at Point facing Default building facing degrees
--------------------------
Now all you have to do is remove any possible memory leaks. I'll help you remove the common ones. Now make sure that it is inside the loop and use a action known as custom script. If you use it outside the loop then it would only get rid of the last point it made which doesn't do very much. (Thanks for MrApples on this tip) It lets you use a little line of JASS which is the other well known way of triggering next to GUI. But only you have to actually type in everything. Well for custom script change the red and type in call RemoveLocation(udg_your point variable's name) And then make another custom script and type in call DestroyGroup(udg_your unit group variable). So now you should have

Code:
Spawn Footmen
  Events
    Time - Every 6.00 seconds of game time
  Conditions
  Actions
    Set Unit_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Barracks) and (((Matching unit) is alive) Equal to True)))
    Unit Group - Pick every unit in Unit_Group and do (Actions)
      Loop - Actions
        Set Point = (Position of (Picked unit))
        Unit - Create 1 Footman for (Owner of (Picked unit)) at Point facing Default building facing degrees
        Custom script:  call RemoveLocation(udg_Point)
      Custom script:  call DestroyGroup(udg_Unit_Group)
_________________
Now every 6 seconds a footmen will spawn at the barrack. Tell me if this trigger doesn't work because it was late at night when I wrote it and I might have made a typo somewhere that ruins the trigger.

Tell me if any parts of this is unclear. If you need more help them feel free to PM me or post here.
Attached Files
File Type: w3x Footmen Wars Spawn.w3x (16.3 KB, 28 views)
MrOrange is offline   Reply With Quote
Old 04-28-2007   #2
 
Join Date: Mar 2007
Posts: 114
tylord is on a distinguished road
Re: [Tutorial] A Simple Footmen Spawn

Nice no leeks either. A+ for others


Custom Sigs by me
tylord is offline   Reply With Quote
Old 04-28-2007   #3
 
MrApples's Avatar
 
Join Date: Sep 2006
Location: Your Mom
Posts: 2,241
MrApples has a spectacular aura about
Re: [Tutorial] A Simple Footmen Spawn

It won't work. Take the destroy group and put it after the pick every, not in it. Keep the destroy location in the loop though.
MrApples is offline   Reply With Quote
Old 04-28-2007   #4
 
MrOrange's Avatar
 
Join Date: Dec 2006
Posts: 2,992
MrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond repute
Re: [Tutorial] A Simple Footmen Spawn

Opps. When I was correcting that problem I must have added it in the loop my mistake.
MrOrange is offline   Reply With Quote
Old 04-28-2007   #5
 
Mr. Zero's Avatar
 
Join Date: Sep 2006
Location: Denmark (GMT+1)
Posts: 2,173
Mr. Zero has a reputation beyond reputeMr. Zero has a reputation beyond reputeMr. Zero has a reputation beyond reputeMr. Zero has a reputation beyond reputeMr. Zero has a reputation beyond reputeMr. Zero has a reputation beyond reputeMr. Zero has a reputation beyond reputeMr. Zero has a reputation beyond reputeMr. Zero has a reputation beyond reputeMr. Zero has a reputation beyond reputeMr. Zero has a reputation beyond repute
Re: [Tutorial] A Simple Footmen Spawn

If you ask me this is more like "free trigger code". How about open a sub-board with that?

[Only registered and activated users can see links. ]
[Only registered and activated users can see links. ]
[Only registered and activated users can see links. ]
[Only registered and activated users can see links. ]

"In the end there is no greater motivation than revenge"
SO I HERD U LEIK MUDKIPZ?!
Mr. Zero is offline   Reply With Quote
Old 04-28-2007   #6
 
MrOrange's Avatar
 
Join Date: Dec 2006
Posts: 2,992
MrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond reputeMrOrange has a reputation beyond repute
Re: [Tutorial] A Simple Footmen Spawn

Actually you know how some people can learn from opening other's maps? Well that's what I was kind of going for. But I'll never just post a triggers without telling why it is needed. Besides if you take some parts out and look at them. Then they would be used for other stuff also.
MrOrange is offline   Reply With Quote
Old 06-13-2007   #7
 
MrApples's Avatar
 
Join Date: Sep 2006
Location: Your Mom
Posts: 2,241
MrApples has a spectacular aura about
Re: [Tutorial] A Simple Footmen Spawn

**Admin Bump - More Comments and Votes**
MrApples is offline   Reply With Quote
Old 06-13-2007   #8
 
Join Date: Jun 2007
Posts: 37
Benderlender is an unknown quantity at this point
Re: [Tutorial] A Simple Footmen Spawn

w00t just what I was looking for!

Benderlender is offline   Reply With Quote
Old 07-08-2007   #9
 
MrApples's Avatar
 
Join Date: Sep 2006
Location: Your Mom
Posts: 2,241
MrApples has a spectacular aura about
Re: A Simple Footmen Spawn

Moved to Tutorials.
MrApples is offline   Reply With Quote
Old 07-14-2007   #10
 
luigi_fan64's Avatar
 
Join Date: Mar 2007
Location: Mushroom Kingdom
Posts: 1,392
luigi_fan64 is a name known to allluigi_fan64 is a name known to allluigi_fan64 is a name known to allluigi_fan64 is a name known to allluigi_fan64 is a name known to allluigi_fan64 is a name known to all
Re: A Simple Footmen Spawn

i like it, i dont really use the the world editor much but defienetly great for others no doubt!

-------------------------
A wise man once said, When you know whats good for people more then they do, you have the right to impose your will on those people. As a mod of pollama, i have that right.

[Only registered and activated users can see links. ]

luigi_fan64 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 On
Trackbacks are Off
Pingbacks are Off
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Triggering
Triggering
Help on Spawn Footmen Upgrade.
CRAZY-PENGUIN World Editor Help 3 03-16-2008 02:26 PM
RoS: Rise of Sauron MMG_God Members Projects 19 03-07-2008 02:33 PM
Footmen Revolution Maelstrom_ WarCraft Maps 17 03-02-2008 05:11 PM
[UltF] Basic Ultimate Footmen Guide Benderlender Guides 2 07-03-2007 02:38 PM
[Tutorial] Footmen Wars Spawn MrOrange World Editor Help 5 04-23-2007 10:33 PM


All times are GMT -5. The time now is 07:40 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