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
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:
This causes the fire elemental to attack to some location depending on how it is called from other data entries.
This causes the fire elemental to attack move three spaces forward from its current position.
This behavior forces the fire elemental to continue attacking forward every .5 seconds.
This applies the attack move forward behavior.
This behavior causes the fire elemental to explode if it cannot find a target after a short duration.
This applies all the fire elemental buffs to a target unit.
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.
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.
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.
This creates the fire elemental 1 space in front of the caster.
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.
Bovines warp troopers follow the caster around the battle field like a hired merc. Follow the recipe below to recreate the merc. behavior:
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.
This tells the tauren to attack move to a target location specified in the parent effect.
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.
This continually requests that the tauren follow the caster.
The timed life effect in the video is optional and we already did an example of timed life above.
This spawns the warp trooper and applies a set of behaviors to it.
This effect spawns multiple warp troopers around the caster.
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.
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.
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.
Quote from Ultimaswc3: GoTutorial 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
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.
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
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
Quote from ZhEcho: Gogood 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?
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:
Duplicate of a normal Space-Marine + Behaviour Escort
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:
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
Filters: Mechanical, Armored, Player, Visible; Exclude Self, Dead, Enemy, Ally, Neutral
-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...
Created Issue Order Effect:
Name: Escort Attack
Created Set Effect:
Name: Escort Set
Effects: Escort Keep Going, Escort Forward
Created 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
So 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,
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
Yes, there should be. Trying typing the the 'field filter' (text box top right titled 'search') for the word 'period'.
Thanks for the advice
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.
found out why it wasn't working. It was because I removed the commands from the command card.
What type of behavior?
You must login to post a comment. Don't have an account? Register to get one!