Skip to content

Enemy Spawning

Pheonix KageDesu edited this page Oct 10, 2022 · 12 revisions

⚠️ Information actual for version 0.8.5 and above

Alpha ABS Z have embedded enemies spawning system

Required Settings

For using Spawning system you should set Spawn Map ID first in Plugin Parameters

  1. Create a map where you will store the ABS enemies (templates) for spawning

  1. Add configurated ABS enemies on this map

  2. Set Map ID to Spawn Map ID plugin parameter

  1. Now you can use Spawning system

Spawn Script Calls (Manual)

For spawning Enemies use script calls:

uAPI.spawnEnemy(ID, X, Y)
uAPI.spawnEnemy(ID, RegionID)

Where:

ID - event ID on template map Spawn Map ID
ID, X, Y, RegionID - all arguments is Extended Values

Example:

uAPI.spawnEnemy(1, 10, 20); // Spawn Enemy Event with ID 1 on 10, 20 (map coordinates)
uAPI.spawnEnemy(4, 50); // Spawn Enemy Event with ID 4 in Region 50 (any free random map cell)
uAPI.spawnEnemy([1, 2, 3], [50, 60, 80]); // Spawn Enemy Event with ID 1 or 2 or 3, in one of regions 50 or 60 or 80
uAPI.spawnEnemy("400|V", 100); // Spawn Enemy Event with ID from variable 400 in Region 100

⚠️ If the map cell is not valid (not passable), the enemy will not be spawned
⚠️ If in the whole region not any valid map cell, the enemy will not be spawned

uAPI.spawnEnemyForced(ID, X, Y)
uAPI.spawnEnemyForced(ID, RegionID)
Same, but without any map cell check, so enemy will be spawned anyway (even on not passable map cell)


uAPI.spawnEnemyAround(ID, X, Y, RADIUS); - spawn enemy around X,Y point (withing RADIUS)

ID, X, Y, RADIUS - all arguments is Extended Values

Example:

uAPI.spawnEnemyAround(1, 10, 20, 2); // Spawn Enemy Event with ID 1 around map cell [10, 20] within radius 2 (in map cells)  

uAPI.spawnEnemyAroundForced(ID, X, Y, RADIUS); - same, but without any map cell check

uAPI.spawnEnemyNearPlayer(ID, DIST); - spawn enemy around player within DIST (maximum distance)

ID, DIST - all arguments is Extended Values


Methods, that can help you control spawning process:
uAPI.getLastSpawnedEnemy(); - return last spawned Enemy (Game_Event object) or null
uAPI.isEnemyBeenSpawned(); - returns true if enemy been spawned after last spawn script called

Spawn Event (Spawn Point)

See this page: Spawn Points

Map Encounters (Auto Spawn)

You can spawn enemies using default RPG Maker Map Encounters

2022-10-10_22-04-39

Prepare Map for active Encounters for ABS spawning

Add next lines to Map Note section:

<AAENC>
animation:X
radius:Y
absOnly:Z
</AAENC>

Where:

  • animation - animation played when enemy spawned, X - animation ID from database or 0 (no any animation)
  • radius - the radius in which enemies will appear around the player on map if region is not specified
  • absOnly - 1 disable Encounters when ABS system is disabled. 0 - if ABS system is disabled encounters still will work but as usual (call default battle scene instead)

Add Encounters Troops

⚠️ Troop number - is a enemy event ID on Spawn Map. For example: if you select troop #6, ABS event with ID 6 from spawn map will be spawned

If you set Range to Entire Map, enemies will be spawned anywhere on map (around the player within radius parameter)

If you set Range to Specify By Region ID, enemies will spawned only on this region, and encounter steps will be counted for this troop only when the player on same region.

⚠️ The enemy may not be spawned if the point on the map is not valid (some obstacle, player, event, etc.), but the Encounter counter will be reseted

Ways to control Map Encounters

  • You can Disable or Enable Encounter on map with Event Command - Change Encounter (3 page, System settings tab) 2022-10-10_22-15-09

  • You can use Party Abilities - Encounter Half, Encounter None (Traits, Other tab)

  • You can get spawned enemies count (by map encounters) - uAPI.getSpawnedByEncountersCount()

⚡ Alpha ABS Z Demo project have map with example of implementing and control Map Encounters

Restricted Spawn Zones

You can create special event for blocking enemy spawning in certains map zones.
Add comment to event page disableSpawn:X, where X - radius in map cells around this event.

In this radius around event, enemies will not be able to spawn (if you call any spawn plugin command, except forced ones)

You can create many events or using different event pages for activate or deactivate this effect

⚠️ For deactivate, just change event page to any page without disableSpawn comment

Clone this wiki locally