RM2K Defined Encounters Areas
#1
RM2K Defined Encounters Areas
Version: 1.1
by RPG Advocate
Not by DerVVulfman

Introduction
This script allows you to set up rectangular areas with different encounters like the map editor functionality of RPG Maker 2000 and 2003.

Screenshots
Meh... It's a map feature.

Demo
HERE ya go!
I drew some tiles surrounding my defined areas in the demo map, just so you can see where ya are.

Script
The script is in two components, a parallel map event and the RGSS script itself.

"Map Event"

RM2K Defined Encounter Areas


Instructions
The 1st thing to look at is the 'Event' code:

This is a map event (set to parallel process) that checks every-so-often whether the player is in a defined area (defined in the script). When it checks, it fills a variable (I chose variable #1 [0001]) with the number of a defined rectangular area... or '0' if the hero is NOT in a defined area.

Quote:I created 2 rectangle areas in my demo, so the value it would return would be 0, 1 or 2... again, a '0' would mean the player is NOT in one of the two rectangle areas.

When that is done, it then goes through if conditions, one after the other. Each one does almost the same thing... it calls an RGSS script:
$game_map.enum_encounter_list = [ list of enemy troop ids ]

Quote:My first list that HOLDS troops is... = [1, 2]
This holds troop numbers 1 and 2 (ie Ghost*2 and Ghost*3 in the default setup).

And, that's all the map event does. Sees where the player is on the map, uses a user-defined variable to check what script-defined rectangle he/she's in (if any), and store a list of enemy encounters in a value ($game_map.enum_encounter_list).


The next thing to look at is the actual RGSS Script:

This script should be pasted above MAIN... or more importantly, above ANY script that messes with Scene_Map's update It's a complete rewrite... or more to the point, line 100 down to line 126 replaces the original random-encounter section of Scene_Map.


Where to edit in the script?: Sure... I'll tell ya.

Go to the bottom of the script... the get_world_map_area_id area.
Here, you define the rectangle(s) where the enemy troops are encountered, and copy ALL the defined areas into an array. As an example, consider this:

Code:
rect1 = [1, 1, 7, 7]
    rect2 = [8, 8, 14, 14]
    area_rects = [rect1, rect2]
The first rectangle I defined is kinda small, it starts at the top left corner of the map and is 7 tiles high and 7 tiles wide.
The second rectangle starts at tile 8 across and 8 down. It TOO is 7 tiles high and 7 tiles wide (not 14!).
After designing the two rectangles (I coulda added more rectangles), I put 'em both in my area_rects array.

Now, the first rectangle (rect1) is checked every so often by the map 'event' (the 'event' instructions above), and if the player is in THIS rectangle, the number 1 is returned. Likewise, if the player is found to be within the area defined in the second rectangle (rect2), the number 2 is returned (value based on it's order in area_rects).

Now, the next section to edit... if need be... is at the bottom of the script.
Code:
$game_variables[1] = area
Tells us that we're gonna use variable #1 [0001] to store the area in question. This is the same variable being read in the 'map event' above. If, you change it to:
Code:
$game_variables[23] = area
You'd have to change the variable in the map events to match.

That's pretty much it. The script section creates the rectangle areas (only) and tells us which variable we're gonna use in the conditional branches in the map event above.



FAQ
This script was posted at http://www.phylomortis.com, but had a minor glitch that the 'example' image file (that showed how to set encounters) was missing.

Compatibility
As the CENTRAL portion of this script is a rewrite of Scene_Map's Update routine, any script that rewrites this portion will have problems. IF you're using a script that ALIASes Scene_Map, I recommend pasting this ABOVE that script.

Credits and Thanks
Obviously to RPG Advocate for returning this system to RMXP.

Author's Notes
Sorry, I ain't the author... just the guy who figured it out. :D
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   The Wanderers: The Customizable Encounters System DerVVulfman 0 263 08-24-2024, 07:12 PM
Last Post: DerVVulfman
   Expanded Encounter Areas DerVVulfman 3 4,630 08-09-2020, 03:34 AM
Last Post: DerVVulfman
   Ancient RM2K Isometric Engines? JayRay 1 6,479 02-26-2017, 04:49 PM
Last Post: DerVVulfman
   RM2K Facesets, Inn & Windowskin Colors DerVVulfman 1 10,848 02-05-2013, 10:19 AM
Last Post: hanetzer
   Map : Change Encounters Kain Nobel 0 4,974 02-07-2010, 06:48 PM
Last Post: Kain Nobel
   Battle Message - AKA RM2k battle system message Hako / Lockheart 0 6,351 03-06-2008, 04:58 AM
Last Post: Hako / Lockheart



Users browsing this thread: 1 Guest(s)