Skip to content

Instantly share code, notes, and snippets.

@KageDesu
Created September 30, 2025 13:30
Show Gist options
  • Select an option

  • Save KageDesu/bdea485c9b2c9b967d4c4ce8284061a4 to your computer and use it in GitHub Desktop.

Select an option

Save KageDesu/bdea485c9b2c9b967d4c4ce8284061a4 to your computer and use it in GitHub Desktop.
Spawn Points (AABSZ Extension)

๐ŸŽฏ Spawn Points (AABSZ Extension)

This extension plugin requires Alpha ABS Z to work.

โš ๏ธ Information valid for version 0.11 and above


๐Ÿ“– Table of Contents


๐ŸŒŸ Overview

The Spawn Points extension allows you to create dynamic enemy spawning systems in your Alpha ABS Z game. You can configure spawn points that will automatically generate enemies based on various conditions and settings.

Key Features:

  • โœ… Multiple spawn types (self, region, player-based)
  • โœ… Configurable spawn rates and limits
  • โœ… Conditional spawning with switches
  • โœ… Player proximity detection
  • โœ… Custom events on spawn completion
  • โœ… Full script API for advanced control

๐Ÿ“‹ Prerequisites

Before using Spawn Points, ensure you have:

  1. Alpha ABS Z plugin installed and configured
  2. Spawn Map set up - see Enemy Spawning guide
  3. Enemy events created on your Spawn Map

โšก Important: The Spawn Map is essential for spawn points to work. It contains the enemy events that will be spawned on your game maps.


๐Ÿš€ Quick Start Guide

Step 1: Create a Spawn Point Configuration

  1. Open Plugin Parameters โ†’ Enemy settings group โ†’ Spawn Points
  2. Click Add to create a new spawn point
  3. Configure the basic settings:
    • ID: Give it a unique identifier (e.g., "forestSpawner")
    • Spawn Type: Choose "self" for basic spawning around the event
    • Events to spawn: Enter the enemy event IDs from your Spawn Map (e.g., "1, 2, 3")

SpawnPointPP

Step 2: Add Spawn Point to Your Map

  1. Create or select an event on your map
  2. Add a comment command to the event page
  3. In the comment, write: <absSpawnPoint:ID>
    • Replace ID with your spawn point's ID from Step 1

Example: <absSpawnPoint:forestSpawner>

โš ๏ธ Important: The spawn point only works when the event is on a page that contains the <absSpawnPoint> comment.


โš™๏ธ Spawn Point Configuration

Core Parameters

Parameter Type Description Default
ID Text Unique identifier for the spawn point "spawnPoint"
Spawn Type Select Where enemies spawn (self/region/player) "self"
Radius or Region Extended Value Spawn area size or region ID "3"
Events to spawn Extended Value Enemy event IDs from Spawn Map "1, 2, 3"

Limit Parameters

Parameter Type Description Default
Max Extended Value Maximum total spawned enemies (0 = unlimited) "3"
Max alive Extended Value Maximum alive enemies at once (0 = unlimited) "2"
Rate Extended Value Spawn interval in seconds (minimum 1) "4"

Condition Parameters

Parameter Type Description Default
Switch Switch Conditional switch (0 = always spawn) 0
Visor Number Player detection radius (0 = always active) 3
On Reach Max Common Event Event called when max spawns reached 0

๐ŸŽฎ Implementation

Basic Implementation

// Event page with spawn point comment
<absSpawnPoint:mySpawner>

Multiple Spawn Points

You can have multiple spawn points with different configurations:

// Forest area spawner
<absSpawnPoint:forestSpawner>

// Cave area spawner  
<absSpawnPoint:caveSpawner>

// Boss area spawner
<absSpawnPoint:bossSpawner>

๐Ÿ—บ๏ธ Spawn Types

1. Self Spawning (self)

Spawns enemies around the spawn point event itself.

Best for: Static spawn locations, guard posts, nests

Configuration:

  • Radius: Distance from the spawn point event where enemies can appear
  • Example: Radius of 3 means enemies spawn within 3 tiles of the event

2. Region Spawning (region)

Spawns enemies within a specific map region.

Best for: Area-based spawning, territorial enemies

Configuration:

  • Region: The region ID where enemies will spawn
  • Example: Region 5 means enemies spawn anywhere within region 5

3. Player Spawning (player)

Spawns enemies around the player's current position.

Best for: Dynamic encounters, pursuit enemies

Configuration:

  • Radius: Distance from the player where enemies can appear
  • Example: Radius of 5 means enemies spawn within 5 tiles of the player

๐Ÿ”ง Advanced Settings

Extended Values

Many parameters support Extended Values, allowing for dynamic configurations:

// Static value
"5"

// Variable reference
"10|V"

// Formula
"10|V + 2"

// Random number from list
"1, 2, ..."

Conditional Spawning

Use switches to control when spawning occurs:

  • Switch 0: Always spawn (no condition)
  • Switch 1-N: Only spawn when the specified switch is ON

Player Detection (Visor)

Control spawning based on player proximity:

  • 0: Always active (spawns regardless of player position)
  • 1-N: Only spawn when player is within N tiles of the spawn point

Common Events

Execute custom logic when spawn limits are reached:

// Example: Show message when area is cleared
// Set in "On Reach Max" parameter
Common Event 1: 
  Show Text: "All enemies in this area have been defeated!"

๐Ÿ” Troubleshooting

Common Issues

โŒ Spawn point not working

  • Ensure the event page contains the <absSpawnPoint:ID> comment
  • Verify the spawn point ID matches the one in plugin parameters
  • Check if the conditional switch (if used) is ON

โŒ No enemies spawning

  • Verify the Spawn Map is properly configured
  • Check if the enemy event IDs exist on the Spawn Map
  • Ensure spawn limits haven't been reached

โŒ Enemies spawning in wrong location

  • For region spawning: Verify the region is painted correctly on the map
  • For self/player spawning: Check the radius value
  • Ensure spawn areas have passable tiles

โŒ Too many/few enemies

  • Adjust "Max alive" parameter to control simultaneous enemies
  • Modify "Rate" parameter to change spawn frequency
  • Use "Visor" parameter to control when spawning is active

๐Ÿ“ก Script API

The plugin provides a comprehensive API for advanced spawn point control:

Core Functions

// Get the last spawned enemy (useful for immediate actions)
let lastEnemy = uAPI.getLastSpawnedEnemy();
if (lastEnemy) {
    console.log("Enemy spawned at position:", lastEnemy.x, lastEnemy.y);
}

// Get all enemies spawned by a specific spawn point
let spawnedEnemies = uAPI.getSpawnPointSpawnedEnemies(eventId);
spawnedEnemies.forEach(enemy => {
    console.log("Enemy HP:", enemy.AABattler().hp);
});

// Get total count of enemies ever spawned by this spawn point
let totalSpawned = uAPI.getSpawnPointSpawnedTotal(eventId);
console.log("Total enemies spawned:", totalSpawned);

// Get count of currently alive enemies from this spawn point
let aliveCount = uAPI.getSpawnPointSpawnedAlive(eventId);
console.log("Enemies still alive:", aliveCount);

Practical Examples

// Example: Reward player when all spawned enemies are defeated
if (uAPI.getSpawnPointSpawnedAlive(5) === 0 && 
    uAPI.getSpawnPointSpawnedTotal(5) > 0) {
    $gameParty.gainGold(100);
    $gameMessage.add("Area cleared! Bonus gold awarded!");
}

// Example: Adjust difficulty based on spawn count
let totalSpawned = uAPI.getSpawnPointSpawnedTotal(3);
if (totalSpawned > 10) {
    // Make future enemies stronger
    $gameSwitches.setValue(10, true);
}

// Example: Special action for the latest spawned enemy
let lastEnemy = uAPI.getLastSpawnedEnemy();
if (lastEnemy) {
    // Make it glow or add special effects
    lastEnemy.requestAnimation(1);
}

API Reference

Function Parameters Return Type Description
getLastSpawnedEnemy() None Game_Event | null Returns the most recently spawned enemy
getSpawnPointSpawnedEnemies() eventId: number Game_Event[] Returns array of all spawned enemies from specific spawn point
getSpawnPointSpawnedTotal() eventId: number number Returns total count of enemies ever spawned by the spawn point
getSpawnPointSpawnedAlive() eventId: number number Returns count of currently alive spawned enemies

๐Ÿ“š Examples

You can find comprehensive examples in the Demo Project, map SpawnPoints (ID 37) ๐Ÿ—บ๏ธ

spawnPointDemoMap

Example Configurations

1. Guard Tower (Self Spawning)

{
    "id": "guardTower",
    "spawnPointType": "self",
    "spawnRadius": "2",
    "spawnMax": "5",
    "spawnAliveMax": "2", 
    "spawnRate": "6",
    "spawnEnemiesId": "1, 2",
    "visorRadius": 4
}

2. Forest Region (Region Spawning)

{
    "id": "forestRegion",
    "spawnPointType": "region",
    "spawnRadius": "3",
    "spawnMax": "0",
    "spawnAliveMax": "3",
    "spawnRate": "8", 
    "spawnEnemiesId": "5, 6, 7",
    "conditionSwitch": 15
}

3. Pursuit Spawner (Player Spawning)

{
    "id": "pursuitSpawner", 
    "spawnPointType": "player",
    "spawnRadius": "4",
    "spawnMax": "10",
    "spawnAliveMax": "1",
    "spawnRate": "3",
    "spawnEnemiesId": "10",
    "visorRadius": 0
}

๐Ÿ“ž Support

If you need additional help:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment