Menu

The Weapon System

This section talks about the weapon system. This is not a tutorial.  We suggest you read this section FIRST, before moving on to the weapon/attack tutorials.

There so are many weapon implementations out there that it is very hard to predict which methods our users will be using. So we simplified things, for easier integration. Instead of creating a full blown weapon system that forces you to do things one way, we designed a system of general inputs and outputs that can be used by other weapon systems. Perhaps you purchased a great weapon package from the Asset Store that you want to integrate with.
The ATTACK FSM is large and complex. However, only one State actually deals with the weapon itself:1

 

It fires a selected rigidbody bullet in the direction of the target, at the given bullet position.
You can set a custom bullet here in the charSTAT_currentBullet of the ATTACK FSM:

2

 

Other weapon systems and game kits you may have purchased can communicate with the bot’s ATTACK FSM by changing these variables at run time. See the weapon changing example scene on how to do this.

[Beta 1.5 NEW FEATURE] We designed the weapon system to allow for 2 types of bullets: Collider-based Bullets, and Raycast-based bullets. Collider bullets only damage a target after colliding with it, and must fly through the environment first. Raycast bullets damage the enemy immediately (unless the bot misses) by shooting a raycast out from the bullet’s location. Collider bullets are the default type, and suit the majority of games. Raycast bullets require additional Vector3 calculations which impact performance, but they are good for sniper shots and laser beams. In your bot’s ATTACK FSM, find the variable “charSTAT_BulletUseRaycast”. Set this to TRUE if you want the current bullet to use raycast damage. Set this to false (default), if you want collider-based damage.

 

All bullets can use either collider-based damage or raycast-based. This can be dynamically changed at runtime for maximum flexibility!

Bullet Damage: Check the bullet prefab’s “Main” FSM. Change the 2 variables: STAT_DamageMin and STAT_DamageMax. This is the range of random damage.

 

WEAPON AUDIO: Set it up here (Attack FSM). Audio clip is played once per shot:

3

 

Some steps can be difficult to describe in text. The best way to learn how it works is by looking at the 20 example scenes provided and looking at the bots’ FSM variable settings.

For basic weapon development, check out the Weapon Setup and Switching scene.