12-31-2008, 06:42 AM (This post was last modified: 11-21-2010, 09:52 AM by Charlie Fleed.)
AutoPopulateMaps 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.
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:
Repeat everything if you want different types of monsters on your map.
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.
lets you also specify a tag_id of the tiles on which you want the events to be placed.
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
Create the events. Here i want two types of enemies and the needed "populate" event:
Setup your enemy events so that a battle is called and so on. Remember the ID:
I know this thread is really old, but man, let me say, this script is just really, really, really cool!
I will use it, and honestly, it's one of my favourite and one of the most usefull script! I'm using it to populate the maps with the monsters, and I have big maps, so with this scipt I don't have to become stupid to create lots of enemyes.
Only few questions: what is the meaning of "APM_RESET_SELF_SWITCHES=true" at the start of the script. What does it supposed to do? I use self-switches for some events (if you run away from the fight, s-s A = true) and it doesn't reset. For me it's good, I like it, but I would like to know if it's someway linked to this command or not.
However, will ever been update anymore?
Really nice job, man! Thanks to have created it ;)
With "APM_RESET_SELF_SWITCHES=true" the self-switches of the generated events will be reset upon their generation. However that happens only when the populate function is used, not when the other ones are (populate_area, populate_area_2, populate_area_3 and so on). If you are using only the other ones, you won't see any effect and the self-switches will keep their previous value.
Self-switches are a little tricky, because they are not stored within events, but instead there's a global array for them.
This can be good in a simple situation, as for example lets you do things with this script as controlling the number of monsters that are alive in a map, by keeping a self-switch set indicating that a monster is dead. That monster will be generated dead. This is under the assumption that the events will always take the same IDs, which correspond with the indexes in the self-switches array.
But, if for some reason the IDs/indexes of some events change, because the order in which they are generated changes or I don't know why, then their self-switches will get the values that before belonged to the events with the new indexes, causing a total mess.
Mmh... I have to pay attention than... well, I have tried it a lot, and for now no matters. I'll try it more, however.
My idea is to use this script for normal monsters only (or maybe for some treasure chest), so it should not be a big problem if a self switch is activated for a monster instead of another one.
Having a look at this neat script. Will let you know how it goes!
Update: Maybe you can add more features like have the NPCs give random amounts of gold(set), item, equips...etc
Check out berka's Npc generator if you want to see what I mean. :)