12-31-2008, 06:42 AM
(This post was last modified: 11-21-2010, 09:52 AM by Charlie Fleed.)
Auto Populate Maps
Version 0.5 (9-22-2009)
Version 0.5 (9-22-2009)
Introduction
Hi all. This is a small script that lets you populate a map with events/monsters, which you can use for "on-map" encounters for example. Events can be placed randomly on the passable tiles of the map or within a specified area. They can be distributed only on tiles with a specified terrain tag, and they can be forbidden from blocking passages for the player.
Please note that these events are generated on the fly. So, while you can use self-switches as long as you stay in that map, everything is reset when you exit from the map and re-enter.
Screenshots
Bats, big rocks (unpassable) and small ones (passable) have been generated with the script.
And this is how the map looks like in RMXP
Demo
Here
Instructions
Create your enemy event, with a call to a battle in the first page, a desired movement, a second page to be used when you defeat the enemy and everything you need. Write down its event number, let's call it "event_id". Let's also assume that you want to create "max_events" enemies.
Now create a second event and use a script call with:
Code:
$game_system.map_interpreter.populate(event_id, max_events)
If you want the prototype events to be erased, use $game_system.apm_remove_original_event=true in a script call. It will be saved when you save the game.
additional methods
EDIT: the use of "$game_system.map_interpreter." isn't actually necessary, you can directly call "populate".
Author's notes
This is still in a preliminary state. Code is not clean, not thoroughly tested.
I guess there are many uses as populating with enemies, animals, vegetation ... use your imagination.
EDIT: this could have been done with class Game_Map as well... whatever...
Tutorial
tutorial