Tutorial #6: Ranged Attacks

Ranged attacks are simple and fun to set up.  Some combinations can build some pretty cool effects!  Please see the included demo scene, “Weapon Switching” to see how you can tweak the Attack FSM variables to create different types of weapons.  All bots come with ranged attacks, both gunfire and grenade throwing.

In a typical fight scenario, the bot’s action process goes like this:

[Bot detects enemy within shoot range] -> [Use grenades or use gun?] -> [Execute attack with either grenade or gun]  –> [If using gun, fire burst shot] -> [Wait for next fire time]


STEP 1: First, enable Ranged attacks on the bot.  In the Attack FSM, set this to true:



STEP 2: Drag a bullet type into the bot’s weapon slot.  If you noticed, you can use any bullet model, from rockets to shotgun shells, to arrows and rocks!  However, you have to set up the bullet model with 2 required FSMs before adding (see the Bullet Tutorial).  For this tutorial, we will keep it simple and use our pre-configured demo bullets.




STEP 3:  Now that you have the model, you now set up how the bullet is fired. The following parameters all pertain to the projectile ranged attack system (for grenades, see the grenade tutorial).  Feel free to tweak the numbers to get some cool results!

A few tips: