JU TPS Documentation
  • 🤩Welcome to JU TPS
  • 😄Quick Start
    • How to start a new scene
    • How to create a JU Character / Reskin Default Character / Setup New Characters
      • Ragdoll
      • Damageable Body
      • Physical Damage
      • Body Leaning Setup
      • Taking Damage / Healing
      • Footstep System
      • Resizable Capsule Collider
    • 📦 Addon Installer
  • 🎮Game Development
    • Game Styles
      • Third Person Shooter Style
      • First Person Shooter Style
      • Top Down Style
      • 2.5D Sidescroller Style
      • ⚠️Important Info About Cross-Plataform
    • Controls / Inputs
      • JU Input Manager
      • Input Events
    • How to create a Mobile Game with JU TPS
      • Mobile Inputs
    • How to load scene
      • Scene Controller
    • How to use Cover System
    • How to use inventory and add items
      • Inventory in UI
      • How to switch between items
      • How to align weapon rotation
    • How to create weapons and items
      • Prevent gun clipping through walls
      • Creating Projectiles/Bullets
    • How to use Dual Wielding System
    • How to use Armor/Cloth System
    • How to use Vehicle System
      • Standard Vehicle Configuration
      • How to create a Car Controller
      • How to create a Motorcycle Controller
      • Vehicle Engine Sounds
      • Coding Custom Wheeled Vehicles
      • How to enter and exit from a vehicle
    • How to use Gravity Switching
    • How to use Actions/Skill and Animation Events
      • JU TPS State Machine Behaviours
      • JUTPSActions Lib Scripting Reference
    • Camera State Trigger
    • How to use Enemies AI
    • How to use Vehicles AI
  • ⚙️Tools, Utils and Tutorials
    • General Tutorials
      • How to do Ragdoll Fall with Input Event
      • How to disable FPS Aim Mode / Scope / Iron Sight Aim
    • Auto Scripts
    • Icon Generator Tool
    • Destructible Objects System
      • Fracture Generator Tool
    • Pixel Quality Scaler
    • Camera Shake
    • Slow Motion
    • Gizmo Drawer
  • ▶️Video Tutorials
    • How to use JU TPS
  • 💬Discord Community
  • ❓Support | Help
  • 📍Roadmap
  • 🔃Change Log
  • 📦Official Addons
Powered by GitBook
On this page
  • Standard first steps to use Character AI
  • Hit Box
  • Zombie AI
  • Patrol AI
  1. Game Development

How to use Enemies AI

PreviousCamera State TriggerNextHow to use Vehicles AI

Last updated 1 year ago

Standard first steps to use Character AI

1-

2- Turn on and set tag to Enemy(or any other tag that is not "Player")

3- Add a JU Health component and JU Inventory

4-

Your JU Character is now an NPC who can die and also keep items.

Hit Box

To be able to deal damage by punches, make the Hitbox setup:

Adjust the size of the hit boxes the way that best fits your character

Zombie AI

The Zombie AI component makes the character walk to a destination or a Waypoint, follow the player and attack him with punches. Your character doesn't necessarily have to be a zombie, you can use this script to make an aggressive NPC for example.

As you can see in the GIF above, it only takes 3 clicks to setup a zombie enemy.

You can also adjust the parameters below to better adapt to what you want

Default AI Class Parameters
Description

Destination

Destination

Waypoint Path

Waypoint Path

Distance To Finish One Point

Distance to go to next waypoint/path index

Check Nearest Point On Part

Checks the nearest point on the waypoint/path and prevents the AI from going back to a previous Waypoint

On Start Path [Unity Event]

Event called when AI start path

On Following Path [Unity Event]

Event called when AI walk along the path

On Ended [Unity Event]

Event called when AI reaches the end

Zombie AI Parameters
Description

Target Tags

Filter targets by tags

Field Of View

AI field of view, it is by this sensor that will detect targets

Sensor Layer Mask

Layer Mask of Field of View

Start Running At Distance

Runs when the target is greater than this distance

Attack At Distance

Attack at distance

Aim Up Offset

Target direction height

Look At Target Speed

Look at rotation speed

Min Time To Attack

Min Time To Attack

Max Time To Attack

Max Time To Attack

On Follow Waypoint [Unity Event]

Event called when AI follow a WAYPOINT path

On Follow AI Path [Unity Event]

Event called when AI follow a NAVMESH path

On See Target [Unity Event]

Event called when AI sees a target

On Stop Seeing Target [Unity Event]

Event called when AI stop seeing a target

Patrol AI's parameters are similar to Zombie AI's, so you can use the parameters above to configure Patrol AI in the same way.

Patrol AI

You can create a Waypoint Path and assign it to the Patrol AI, and you will have a Patrol Enemy:

The Patrol AI has an extremely similar setup to the Zombie AI, with the difference that it adds a Inventory and an Item Switch Manager. You can normally and the AI will start using it, and in the Item Switch Manager you can set the ID of the item it will equip by default.

🎮
add a weapon
Bake a NavMesh
Create a JU Character in Simple Setup
IsAI option
✅ Patrol AI configured successfully