Random Map Events

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
821
First Language
English
Primarily Uses
Introduction/Features


This plugin allows for randomly allocating events on the map manually via a plugin call or automatically when transferring. An event will be placed in one of the regions you specify, or in the same place if desired. You can designate a chance for the event to spawn, and have it spawn more than once.


A new map will generated with these events. The new map will be stored into the save file, allowing you to safely load the save file with the generated map intact. You can also choose to change the tileset.


This plugin is useful anytime you want to automate variation in where or if an event spawns, and how many times. It can allow you to quickly add variation to a map so it is different every time. I had dungeon crawler games in mind when I wrote this plugin - you can create dungeon floors with randomly placed enemies, treasure, traps, secrets and entrance and exit. Through the use of a random number choose function provided by this plugin and a little javascript, you can also easily randomly choose maps and tilesets.


P.S. This is not the dungeon generator I am still working on, but it will either use code from this plugin or require this plugin. The event allocation idea is about the same.


* ============================================================================
* How To Use
* ============================================================================
* ============================================================================
* Plugin Commands
* ============================================================================
* AllocateEvents x y
* This command will randomly allocate events and transfer the player to the
* new map.
* x - Optional. Fade Type. Use -1 to use default.
* y - Optional. Tileset id of new generated map.
*
* In order for events to be placed on the new map, they MUST have the
* notetags <RandomRegion: x> or <AllocateSame>.
* Make sure to read below in "Event Notetags" to learn how to use these.
* ============================================================================
* Event Notetags
* ============================================================================
* <RandomRegion: x> will allow this event to be randomly allocated in the
* specified regions. This is required for events to be spawned in the
* generated map, unless you use <AllocateSame> below.
* Example:
* <RandomRegion: 1-4 7 10> will have the event spawn in regions 1-4, 7 or 10.
* If you want it to be able to spawn in any region, enter 1-255 (or whatever
* the max is in your case).
*
* <AllocateSame> will cause this event to be put in the same exact spot it was
* before the allocation process began.
*
* <AllocateStart> will cause the player to spawn at the point this event is
* placed at. Use this tag for only one event. If this event does not exist or
* is not allocated, the player will spawn on the same tile they were at when
* the map began allocating events.
*
* <AllocatePriority: x> will determine the order that event is allocated. Lower
* numbers get allocated first. Events without a priority get allocated last.
* I recommend using the lowest value for the AllocateStart event.
*
* <AllocateMin: x> will attempt to the spawn the event a minimum of x times.
* Do not use if you want an event to only spawn 1 time, because that is the
* default.
* Do not use with <AllocateStart>.
*
* <AllocateMax: x> will attempt to the spawn the event a maximum of x times.
* Use this only when you are also setting a minimum. Must be greater than the
* minimum. Do not use with <AllocateStart>
*
* <AllocateChance: x> will give the event x chance to spawn. This is tested
* for every attempt at placing the event.
* Example:
* <AllocateChance: 55> will give the event 55% chance to spawn.
*
* <AllocateTag: x> This tag is used to label events for special conditions.
* At the moment, it is only useful for the notetag below.
*
* <AllocateMinimumDistance: x y> will require that the event be spawned away
* at least y tiles from events tagged with x (from <AllocateTag: x>).
* If no tiles fit this criteria, then the event may not be spawned.
* Because of this, it is a good idea to utilize allocation priority to
* ensure that events that have a conditional distance placement are allocated
* after events they must be placed away from.
* You can use more than one distance condition.
* Example:
* <AllocateMinimumDistance: Start 4 End 9> will require that this event
* can only be placed 4 tiles or more from events tagged with Start and
* 9 tiles or more from events tagged with End.
*
* <RemoveSelectedRegion> will prevent the region this event is placed in from
* having any other events placed in it.
*
* <RemoveRegion: x> will prevent the regions specified from having any
* other events placed in it, after this event is placed.
* Example:
* <RemoveRegion: 1-4 7 10> will prevent regions 1-4, 7 and 10.
*
* ============================================================================
* Map Notetags
* ============================================================================
* <AllocateEvents> will automatically allocate events on map load.
*
* <AllocateWallAutotileRegion: x> This will set all wall autotiles to be
* considered region x, besides tiles that you have manually set a region to.
*
* <AllocateRoofAutotileRegion: x> This will set all roof autotiles to be
* considered region x, besides tiles that you have manually set a region to.
*
* <RandomTileset: x> when a new map is generated from this map, it will select
* one of these tileset ids for the new map.
* Example:
* <RandomTileset: 1-4 7 10> will select from ids 1-4, 7 or 10.
* ============================================================================
* Event Commands
* ============================================================================
* Events will the retain the same event id with one exception. Any time that
* the same event is copied to the map more than once, the extra clones have
* new ids. This means that the first copy will retain the same id as on the
* base map, but the other copies will not. This only applies when using the
* <AllocateMin: x> notetag, otherwise an event will never have extra clones.
* ============================================================================
* Functions
* ============================================================================
* Functions you may find useful.
*
* new DXMapRandomElements(args) - Equivalent of the plugin command
* AllocateEvents. Useful if you want to use a tileset id that you generated.
* Example:
* new DXMapRandomElements("0 5") - will have 0 as the fade type and 5 as the
* tileset id.
*
* DreamX.RandomMap.RandomNumber(string) - Will return a random number from the
* string given. Useful for getting a random tileset id, among other things.
* Example:
* DreamX.RandomMap.RandomNumber("1-4 7 10") will return numbers 1-4, 7 or 10.
* ============================================================================
* Future Updates
* ============================================================================
* Be able to use events from other maps.
* Be able to choose the position on a wall to place an event.
* Be able to auto assign a region to any tile id.
* Be able to set limits for a region based on event tag. For example, you
* could set a limit where only 2 events with the tag Enemy can be placed in it.
* ============================================================================
* Terms Of Use
* ============================================================================
* Free to use and modify for commercial and noncommercial games, with credit.
* Credit Yanfly as I used some of the same code/concepts from their
* Item Core plugin.
* ============================================================================
* Credits
* ============================================================================
* DreamX
* Thanks to Yanfly for code/concepts from their Item Core plugin.


Script
 

kovak

Silverguard
Veteran
Joined
Apr 3, 2016
Messages
1,256
Reaction score
1,558
First Language
PT - EN
Primarily Uses
RMMV
All i've read was :

"how to have random encounters with touch events who are randomly generated"

Still in love <3
 

Perr_

Veteran
Veteran
Joined
Mar 6, 2016
Messages
35
Reaction score
20
First Language
Korean
Primarily Uses
Oh it can be used when I want to make a roguelike game :)  Locating treaaure box or monsters would be more comfortable if I use this plugin. Thank you!!
 

Zeustiak

Veteran
Veteran
Joined
Oct 11, 2016
Messages
37
Reaction score
7
First Language
English
Primarily Uses
This looks pretty interesting.  Are you still working on this as well as the random dungeon generator?  
 

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
821
First Language
English
Primarily Uses
This looks pretty interesting.  Are you still working on this as well as the random dungeon generator?  
I'd like to change the plugin around a bit so the impact on the save file size is much less. For random dungeon generator, I'm probably going to wait until december to start up again.
 

SimProse

Veteran
Veteran
Joined
Jul 9, 2016
Messages
364
Reaction score
199
First Language
English
Primarily Uses
I'd like to change the plugin around a bit so the impact on the save file size is much less. For random dungeon generator, I'm probably going to wait until december to start up again.


Aww, a shame. I'd love to see someone create a good dungeon or landscape generator for the engine.
 

Zeustiak

Veteran
Veteran
Joined
Oct 11, 2016
Messages
37
Reaction score
7
First Language
English
Primarily Uses
Sounds good!  I will definitely keep an eye out for it.  
 

seaotter

Veteran
Veteran
Joined
Mar 2, 2019
Messages
125
Reaction score
28
First Language
Chinese
Primarily Uses
RMMV

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Hi, there.
I'm Creta Park, as Software engineer and Indie game developer.

Profile : creft.me/cretapark
GitHub : github.com/creta5164
Blog : creta5164.tumblr.com


My stuff

Who shares/sells their scripts/plugins on itch.io? Can I pick your brain?
If you ever need fantasy names and you're bored, make a fictional alphabet. Switch around the letters and see what you get :p
I JUST GOT PROMOTED TO 9TH GRADE BOIS!

Forum statistics

Threads
98,168
Messages
949,924
Members
129,455
Latest member
DeathByPiercing
Top