![]() | |
| | #1 |
![]() Join Date: Dec 2006
Posts: 2,992
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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 -------------------------- 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. |
| | |
| | #2 |
![]() Join Date: Mar 2007
Posts: 114
![]() | Re: [Tutorial] A Simple Footmen Spawn Nice no leeks either. A+ for others ![]() ![]() ![]() ![]() Custom Sigs by me |
| | |
| | #3 |
![]() Join Date: Sep 2006 Location: Your Mom
Posts: 2,241
![]() | 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. |
| | |
| | #4 |
![]() Join Date: Dec 2006
Posts: 2,992
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Re: [Tutorial] A Simple Footmen Spawn Opps. When I was correcting that problem I must have added it in the loop my mistake. |
| | |
| | #5 |
![]() Join Date: Sep 2006 Location: Denmark (GMT+1)
Posts: 2,173
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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? |
| | |
| | #6 |
![]() Join Date: Dec 2006
Posts: 2,992
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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. |
| | |
| | #7 |
![]() Join Date: Sep 2006 Location: Your Mom
Posts: 2,241
![]() | Re: [Tutorial] A Simple Footmen Spawn **Admin Bump - More Comments and Votes** |
| | |
| | #8 |
![]() Join Date: Jun 2007
Posts: 37
![]() | Re: [Tutorial] A Simple Footmen Spawn w00t just what I was looking for! |
| | |
| | #9 |
![]() Join Date: Sep 2006 Location: Your Mom
Posts: 2,241
![]() | Re: A Simple Footmen Spawn Moved to Tutorials. |
| | |
| | #10 |
![]() Join Date: Mar 2007 Location: Mushroom Kingdom
Posts: 1,392
![]() ![]() ![]() ![]() ![]() ![]() | Re: A Simple Footmen Spawn i like it, i dont really use the the world editor much but defienetly great for others no doubt! |
| | |
![]() |
| Tags |
| None |
| Thread Tools | |
| Rate This Thread | |
| |
Similar Threads | ||||||
| Thread | Thread Starter | Forum | Replies | Last Post | ||
| 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 | ||