Tutorial writing complete. I plan to write more AI tutorials in the future. Next up I will probably do a tutorial on how to write 'bots' for MOBA games. If you have any questions or comments, please let me know what you thought of this tutorial.
Resources > Tutorials
[Data] AI - Simple Behaviors
- 14 posts
-
Ultimaswc3 Author
- Join date
- Oct 04, 2009
- Location
- United States
- Reputation
- 4
- Posts
- 213
- Projects
- 2
- Last login
- May 30, 2013
-
zeldarules28 Moderator
- Join date
- Jul 16, 2010
- Location
- United States
- Reputation
- 70
- Posts
- 4,170
- Projects
- 3
- Last login
- Jun 19, 2013
Quote from Ultimaswc3: Go
Tutorial writing complete. I plan to write more AI tutorials in the future. Next up I will probably do a tutorial on how to write 'bots' for MOBA games. If you have any questions or comments, please let me know what you thought of this tutorial.
Don't mean to sound mean or anything but I made a MOBA/DOTA tutorial series already here: http://forums.sc2mapster.com/resources/tutorials/16045-complete-noobs-guide-to-dota-style-maps-part-1/#p2
It's fine if you show how do the bots too, in fact you probably know a better way than me. (I just attack move them thru a series of points) I just didn't want you to waste your time on or anything so I figured I'd let you know.
As for the tutorial, having 'mercs' follow you around like an escort is something I wanted to know how to do. Nice tutorial :D
Last edited Jan 19, 2011 by zeldarules28 -
Ultimaswc3 Author
- Join date
- Oct 04, 2009
- Location
- United States
- Reputation
- 4
- Posts
- 213
- Projects
- 2
- Last login
- May 30, 2013
Ah, no conflict then. I'll be doing a tutorial on how to write bots that take the place of an actual player. I'm glad you linked that though so I won't do that type of tutorial also.
-
zeldarules28 Moderator
- Join date
- Jul 16, 2010
- Location
- United States
- Reputation
- 70
- Posts
- 4,170
- Projects
- 3
- Last login
- Jun 19, 2013
Ohh lol. I tried to make one bot with triggers back in wc3 and it was so stupid lol... Keep up the good work. :D
-
ZhEcho Regular Shmoe
- Join date
- Feb 27, 2011
- Location
- Portugal
- Reputation
- 0
- Posts
- 1
- Last login
- Mar 08, 2011
good tutorial. i made the fire elemental one but when i cast it it doesnt move. ive checked everything and everything seems to be ok. if you could tell me what the prob is i would thank you
-
Ultimaswc3 Author
- Join date
- Oct 04, 2009
- Location
- United States
- Reputation
- 4
- Posts
- 213
- Projects
- 2
- Last login
- May 30, 2013
Quote from ZhEcho: Go
good tutorial. i made the fire elemental one but when i cast it it doesnt move. ive checked everything and everything seems to be ok. if you could tell me what the prob is i would thank you
Did you check to make sure the behavior is applied to the fire elemental? If the behavior is there, does the fire elemental have a caster?
-
ParanoidPenguin Regular Shmoe
- Join date
- Apr 01, 2011
- Location
- Germany
- Reputation
- 0
- Posts
- 30
- Last login
- Sep 16, 2011
Hi there.
This tutorial is pretty well made and quite useful, yet i've got a problem adapting the system to suit my needs.I'm trying to have a building that can recruit units that follow around other units using the Bovine Warptroopers' example.
I tried doing the following so far:-Created Unit:
Name: Marine
Duplicate of a normal Space-Marine + Behaviour Escort-Created Unit:
Name: Basic Truck
Attributes: Mechanical, Armored
The doodad as unit. Can move and all that, but not attack - that's what the escorts are for.-Created a behaviour buff:
Name: Escort
Phase: 2
Effect Initial: Escort Search Area
Effect Periodic: Escort Set-Created Search Area Effect:
Name: Escort Search Area
Area: Arc 360; Range 5; Effect: Escort Attack Forward
MaxCount: 1
Filters: Mechanical, Armored, Player, Visible; Exclude Self, Dead, Enemy, Ally, Neutral
Target: Targetunit-Created Create Persistent Effect:
Name: Escort Forward
Flags: Random Offset
Periodic Effect: Escort Attack
Periodic Offsets: 1,1,0; 1,0,0; -1,1,0; etc...
Phasedurations: 0
Phasecount: 1
Target: TargetunitCreated Issue Order Effect:
Name: Escort Attack
Ability: Attack
Target: Targetunit/Targetpoint
Player: Source
Unit: SourceCreated Set Effect:
Name: Escort Set
Effects: Escort Keep Going, Escort ForwardCreated Search Area Effect:
Name: Escort Keep Going
Search Include: Escort Search Area, Target
Filter: Excluded Self, Dead, Enemy, Ally, Neutral
Area: 360; Max 1; Radius 10; Effect Escort Forward
Maxcount: 1
Mincount: 1So the idea is to basically have the marine initially search for the truck unit and apply the Forward effect for the first time. Then it would always refer to that unit via Keep Going and hold onto the truck.
Yet, that doesn't work.
What happens is that the marines do find the point where the truck stood initially, but when i move the truck, the marines will keep escorting that point, so it would look like they were dancing around that spot. And sometimes they go even further than i thought they would...However, i hope you can help me point out my mistake.
Thanks in advance,
ParanoidPenguin -
Citiz3nSnip3s Regular Shmoe
- Join date
- Jul 14, 2011
- Location
- Canada
- Reputation
- 0
- Posts
- 12
- Last login
- Aug 06, 2011
@Ultimaswc3: Go
when it says new behavior fire elemental behavior
i create new behavior but their are no Set Stats - Period - .5 or Set Effect - Initial = Fire Elemental Attack Forward Set Effect - Periodic = Fire Elemental Attack Forward can u help me with this
-
Ultimaswc3 Author
- Join date
- Oct 04, 2009
- Location
- United States
- Reputation
- 4
- Posts
- 213
- Projects
- 2
- Last login
- May 30, 2013
Yes, there should be. Trying typing the the 'field filter' (text box top right titled 'search') for the word 'period'.
-
Citiz3nSnip3s Regular Shmoe
- Join date
- Jul 14, 2011
- Location
- Canada
- Reputation
- 0
- Posts
- 12
- Last login
- Aug 06, 2011
@Ultimaswc3: Go
Thanks for the advice
-
Salmon85 Author
- Join date
- Sep 12, 2007
- Location
- United Kingdom
- Reputation
- 0
- Posts
- 20
- Projects
- 1
- Last login
- Nov 09, 2012
Any chance of getting a test map for this to download. Because i've followed the guide for the warp troopers and they just don't follow the caster unit and I would like to see where I went wrong.
- edit*
found out why it wasn't working. It was because I removed the commands from the command card.
Last edited Aug 14, 2011 by Salmon85 -
Selfcreation Author
- Join date
- Sep 17, 2010
- Location
- Canada
- Reputation
- 0
- Posts
- 606
- Projects
- 2
- Last login
- May 09, 2013
3. New behavior - Fire Elemental Behavior
What type of behavior?
-
Ultimaswc3 Author
- Join date
- Oct 04, 2009
- Location
- United States
- Reputation
- 4
- Posts
- 213
- Projects
- 2
- Last login
- May 30, 2013
Buff
- 14 posts
Ultimaswc3 AuthorIntroduction
This tutorial explains how to apply data behaviors to units that provide simple but useful AI. In this tutorial, basic data editing knowledge is assumed (intermediate level or advanced). We will re-create two example behaviors from my custom map:
Each unit is autonomous and does not allow player control.
Key points will be highlighted like this
Videos
Fire Elemental
Warp Trooper
Suicide Fire Elemental
The suicide fire elemental runs forward until it finds a close target to explode itself on. Follow the recipe below to recreate the elemental's running behavior:
1. New issue order effect - Fire Elemental Action - Attack
This causes the fire elemental to attack to some location depending on how it is called from other data entries.
2. New persistent effect - Fire Elemental Attack Forward
This causes the fire elemental to attack move three spaces forward from its current position.
3. New behavior - Fire Elemental Behavior
This behavior forces the fire elemental to continue attacking forward every .5 seconds.
4. New apply behavior effect - Fire Elemental Behavior Apply
This applies the attack move forward behavior.
5. New behavior based on Timed Life - Fire Elemental Timed Life
This behavior causes the fire elemental to explode if it cannot find a target after a short duration.
6. New apply behavior effect - Fire Elemental Timed Life Apply
7. New set effect - Fire Elemental Buffs
This applies all the fire elemental buffs to a target unit.
8. New weapon - Fire Elemental Suicide Explode
The weapon is incredibly important for the behavior because it dictates the distance your minion acquires a target. This is handled by the minimum scan range field.
9. New unit and actor - Fire Elemental Unit / Fire Elemental Actor
For the fire effects, I made some modifications to the actor (optional). I modified the tint color of the spectre to red with a increased HDR setting. In addtion, added a fire animation on top of the tint change. The final touch was to always make the spectre use the cover animation group so its gun would be holstered.
10. New create unit effect - Fire Elemental Create
This creates the fire elemental and applies a set of behaviors to it. It also ensures the fire elemental will run in the same direction the caster was facing.
11. New persistent effect - Fire Elemental Init
This creates the fire elemental 1 space in front of the caster.
12. Create new button - Fire Elemental Button
13. Create new effect-target ability - Fire Elemental Ability
Conclusion
Alternatively, you could have added the behaviors to the Initial Unit Behavior Field in the Unit Tab for the Fire Elemental Unit. The advantage here is that we created effects which are more flexible in their application. We could retool some of the effects here to be more generic for reuse. The overall effect is that a casting unit uses an ability called fire elemental. A unit is created 1 position in front of the caster which runs forward attack-moving. The weapon minimum scan range dictates the distance threshold that your fire elemental will track on to enemy units like a homing missile. The fire elemental has a timed life so that it expires after 7 seconds.
Bovine Warp Troopers
Bovines warp troopers follow the caster around the battle field like a hired merc. Follow the recipe below to recreate the merc. behavior:
1. New unit and actor - Bovine Warp Trooper
I increased the movement speed to 3.5 so the unit will always catch up to the caster. You want it to be uncommandable since it is a mercenary AI. In addition, you can lower its pathing priority if you don't want it to get in the way of your main hero.
2. Create issue order effect - Warp Trooper Action - Attack
This tells the tauren to attack move to a target location specified in the parent effect.
3. Create persistent effect - Warp Trooper Attack Forward
This method tells the tauren to attack move to a location on the caster's 'six'. Using random periodic offsets cause the tauren to shuffle around making things a bit more believable. Also note that the target location is the caster unit, while effects above issue orders to the source unit, which is the tauren.
4. Create new behavior - Warp Trooper Behavior
This continually requests that the tauren follow the caster.
5. Create new apply buff effect - Warp Trooper Apply Behavior
6. Create new set effect - Warp Trooper Buffs Set
The timed life effect in the video is optional and we already did an example of timed life above.
7. Create new create unit effect - Warp Troopers Create Unit
This spawns the warp trooper and applies a set of behaviors to it.
8. Create new persistent effect - Warp Troopers Create
This effect spawns multiple warp troopers around the caster.
9. Create new effect-instant ability - Universal Warp Troopers
For the warp in/out effects, I used a behavior that prevents using abilities. An actor applies the warp animation and blue tint color while the warp behavior is active. I also added a custom weapon that is similar to a plasma rifle. These are just to make things pretty, it's not necessary for the tutorial.
Conclusion
Issuing attack move to a random location behind the caster creates a very believable mercenary effect that is easy to create and manage. The above behavior could be improved by added validators based on the distance to the caster. If the caster is too far away, the warp troopers could move instead of attack to the caster's position. Alternatively, they could warp to the caster's positions since they seem to have the technology.