Save-Point
Auto Populate Maps, Version 0.5 - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+--- Thread: Auto Populate Maps, Version 0.5 (/thread-2331.html)

Pages: 1 2


Auto Populate Maps, Version 0.5 - Charlie Fleed - 12-31-2008

Auto Populate Maps
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.
[Image: Immagine3.jpg]
And this is how the map looks like in RMXP
[Image: 13216076og1.jpg]

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)
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.

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



Auto Populate Maps - Charlie Fleed - 03-06-2009

Version 3!
Corrected a really annoying bug I have been hunting for a loooong time.


Auto Populate Maps - Charlie Fleed - 11-22-2009

Up(dated).


Auto Populate Maps - Alpha-Mad - 11-22-2009

I've never noticed this before but it could really come in handy. I might look into this. Looks great!


Auto Populate Maps - Nadim - 06-14-2010

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 ;)


Auto Populate Maps - Charlie Fleed - 06-14-2010

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.


Auto Populate Maps - Nadim - 06-14-2010

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.

Ok, thanks for the explanation! :D


RE: Auto Populate Maps - Charlie Fleed - 11-21-2010

Updated.


RE: Auto Populate Maps, Version 0.5 - deValdr - 11-21-2010

this is cool, it's very usefull for people using action battle systems and tactical battle systems. Good work ;)


RE: Auto Populate Maps, Version 0.5 - xnadvance - 05-31-2011

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. :)