Enemy Spawner + Chase AI (RPG Developer BAKIN)
A downloadable Eventsheet
Two event sheet lists to create enemy spawners and field enemies, with basic line of sight, chase, abandon chase, and basic obstacle avoidance. Enemy spawners also only spawn enemies when they aren't visibly on screen, which helps with immersion, and starting a battle should delete all enemies on the field and reset other spawners until the battle ends.
These events were designed for a third-person 3D game (rather than the average top-down BAKIN default), but it should work anywhere with some tweaks.
Feel free to edit and upgrade this preset for your own game. You're also free to upload your own versions of these events for others to enjoy (commercial use OK!). Credit would be nice but not necessary.
HOW TO USE:
You'll need to install SANA's MainScriptForCast Ver.20240317 Add-On for the Enemy AI (older versions seem to work)!
- Download their add-on at https://steamcommunity.com/sharedfiles/filedetails/?id=3187968422, go to BAKIN's home page, into Steam Workshop, select the script, and "Rename and Save Project". Save it anywhere and extract.
- Click on "C# Program Assignment" in a new event and press Add. Then find the downloaded SANA addon. This will install the add-on.
STEP 1: ENEMY SPAWNER SETUP
- Go into Database -> Casts, then Add, and select None for graphics.
- Press "Cast Event Settings…" under the Name/Description area.
- Press "Import" located at the Event window's top-right position, go to Local Files tab, and select "Enemy Spawner.txt"
- Select the sheet "EventSheet" on the sheet list and delete it.
- Open the "!!! FEnemy Setting and Summon" sheet, go in the "Generate Events" event, and change the "Event to be Generated" to the field enemy you want.
- To add it to the map, go into the Stamps list on the right of the map editor, then Events, then scroll to the Casts folders, find your corresponding Spawner, and select. Then just start placing them on the field!
You can configure a few parameters, such as spawn speed, RNG, and the pixel range of "off-screen" inside the "!!! Settings" sheet.
To make the spawner choose a random foe to spawn (such as for a dungeon), you'll need to manually create your own RNG check and then do the corresponding Generate Event based on the result.
Feel free to un-comment the Debug function that creates a visual text on screen that prints the current timer value of the spawner inside the event.
STEP 2: FIELD ENEMY AI SETUP
The movement code works around the game setting "NPC Movement Speed" set to 0,030 instead of default. If you can't change this value, make sure to adjust and edit this script accordingly.
- Go into Database -> Casts, either use an existing enemy (recommended) or create a new entity, and go into "Cast Event Settings…"
- Press "Import" located at the Event window's top-right position, go to Local Files tab, and select "Enemy AI (Pursuit)"
- Select the sheet "EventSheet" on the sheet list and delete it (assuming you didn't have anything worth keeping).
- MAKE SURE TO REASSIGN GRAPHICS UNDER THE FIRST EVENT (not doing this will lead to your enemy being invisible)
- In the Start Battle sheet, make sure to assign a foe in the battle, or it won't launch.
There's a lot of settings throughout both the scripts, so feel free to examine and improve upon it (especially the chase script). Read the notes to get a better understanding.
For example, the enemy AI only offers one set battle, but making your own RNG event here (or offloading the selection and battle start to a common event instead) would be more useful for more traditional RPGs.
STEP 3: DISABLE INBATTLE AFTER BATTLE
This battle script just turns off inBattle after a battle ends. You don't need to use this EXACT script, but you need to turn off this switch at the end of battle to renable spawners after a battle, as a battle disables spawners and deletes all enemies using the AI code included.
- Create a Battle script, and import "Battle Script - Disable InBattle after battle"
- Remove the empty sheet.
If you did everything right, then looking away from a spawner (with the camera) will build a timer, and when it reaches the max time, and succeeds in its RNG check, an enemy will be placed. Get in front of it, and it'll notice you, and chase you for a bit! Get too close and a battle will start.
Have fun making your RPGs!
Status | Released |
Category | Assets |
Author | ingenoire |
Genre | Role Playing |
Tags | 3D, bakin, event, JRPG, rpg-developer-bakin |
Download
Click download now to get access to the following files:
Leave a comment
Log in with itch.io to leave a comment.