Region Common Events

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,294
Reaction score
11,880
First Language
English
Primarily Uses
RMMV

Region Common Events v1.0
Shaz




Introduction
This script lets you paint regions on your map and specify a common event to run when the player walks on or faces a tile with that region id.

Features
- Common event when you walk ON a tile with a region.
- Common event when you are FACING (but not ON) a tile with a region.

Screenshots
n/a

How to Use
Paste script into a new slot in Materials, below other scripts.

Paint regions over the map.
Create common events for each region.
Add map notes in the following format:
regevt: region_id mode common_event_id
where
- region_id is, obviously, the region id you've painted with
- mode is either on or face
- common_event_id is the common event to call when you are on or facing this tile

Mode "on" means the common event will run when you step onto a tile with that region id
Mode "face" means the common event will run when you are facing, but not standing on a tile with that region id

Examples:
regevt: 63 on 15
will call common event when the player walks on a tile with region 63. An example of this would be to play a splash SE when walking in shallow water (paint region 63 all over the water).

regevt: 62 face 12
will call common event 12 when the player is facing a tile with region 62. An example of this would be to do something when the player bumps into a wall (paint region 62 along the base of the wall).

Script


Download from pastebin

FAQ


Credit and Thanks
- credit Shaz

Author's Notes
Okay for use in free and commercial games
 
Last edited by a moderator:

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,030
Reaction score
335
First Language
indonesian
Nice script shaz :D .

Maybe add 'on leave' region common event? It would be perfect :p .

Ex:

Using on region feature. I can create: On the common event there's switch conditional. If switch swim off it will play splash sound entering water. Turn switch swim on. Then change graphic to swimming sprite. (first time enter the region). But if already on. Only play swimming sound.(Moving between region)

But i can't create this one

when exiting water. There's sound like someone exiting water. Turn of switch swim off and change to walking sprite. (Leaving region)
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,294
Reaction score
11,880
First Language
English
Primarily Uses
RMMV
Yeah, not a bad idea.


The other question is, would you want the common event to run for EVERY tile with that region - so if you go from one tile to another and they're both the same region, do you want the common event to run just once, or once for each tile? Is it an "enter/exit region" or a "while in region" activity?


I won't update it today, but I might do something with it in the next couple of days.
 

Kes

Global Moderators
Global Mod
Joined
Aug 3, 2012
Messages
21,405
Reaction score
10,844
First Language
English
Primarily Uses
RMVXA
Thank you for this script.  Coupled with your large collision script, you have reduced the number of my events enormously.  It would be great if you do add the "leave region" feature, but even without it, this is so useful.
 

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,030
Reaction score
335
First Language
indonesian
Yeah 'on enter' and 'while moving in same region' feature would be nice too.

For now I use conditional and switch to simulate that. one common event. Conditional if switch off do the on enter behavior. Then turn switch on. If switch on. Do while moving between same region behavior.

But if there's built in feature it might be easier :p . And less switch usage too.
 

Kes

Global Moderators
Global Mod
Joined
Aug 3, 2012
Messages
21,405
Reaction score
10,844
First Language
English
Primarily Uses
RMVXA
This evening I got round to installing the script.  Put it in in the usual way, set up the common event and map note, went to play test and got

SystemStackError occurred

stack level too deep.

This happened several times.  Deleted the script and play tested, no problem - but of course no region common event either.  Is it something at my end, or something in the script?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,294
Reaction score
11,880
First Language
English
Primarily Uses
RMMV
That sounds strange. I THINK that error may happen if you alias a method too many times, or if you use an alias name that's already been used (so it's calling itself).


Since I prefix all my aliases in this script with shaz_re it's unlikely that a duplicate name is the issue - unless you have pasted the script more than once into your project.


The methods that are aliased are Game_Map.setup, Game_Map.update, Game_Player.update and Game_Player.move_straight - if you have a lot of other scripts, you might check how many times those methods are aliased.


Here is something you could try to narrow it down.


Also, is this script BELOW all your other custom scripts?
 

Kes

Global Moderators
Global Mod
Joined
Aug 3, 2012
Messages
21,405
Reaction score
10,844
First Language
English
Primarily Uses
RMVXA
It is below everything else. 

I used the script you pointed me to, and now when I try to playtest I get the message to look in the debug console.  Trouble is (hangs head in shame and embarrassment) I don't know where that is to look at it and the Help file doesn't tell me.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,294
Reaction score
11,880
First Language
English
Primarily Uses
RMMV
In the editor, Game > check Show Console.


Now when you play, a second window will open. This is the console, and will be where all the details will be displayed.


Can you take a screenshot of your Scripts window, showing the list of custom scripts you have in the Materials section?
 
Last edited by a moderator:

Kes

Global Moderators
Global Mod
Joined
Aug 3, 2012
Messages
21,405
Reaction score
10,844
First Language
English
Primarily Uses
RMVXA
I think I'm going to crawl away into a corner and die of shame.  Twice in one day I've made a stupid error.

I saw that I'd put the script in twice, with slightly different names, so I overlooked it.  I took one copy out and everything now plays fine.

Again, my apologies for troubling you for nothing, and thanks for taking the time.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,294
Reaction score
11,880
First Language
English
Primarily Uses
RMMV
whew! You had me worried there :D
 

wistiecutie

Villager
Member
Joined
May 3, 2015
Messages
17
Reaction score
3
First Language
french
Primarily Uses
Hello , excuse me , I have issues with region common event scripts , I can't use any of them since everytime it displays this message "Script "game_interpreter' line 90 : NoMethodError occured

undefined method 'listt' for nil:NilClass" .

I can't figure out what the heck is wrong , 

it's irking me a little bit , 

Is any of you able to lend a hand :/ ?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
28,990
Reaction score
6,672
First Language
German
Primarily Uses
RMMV
I can't use any of them since everytime it displays this message "Script "game_interpreter' line 90 : NoMethodError occured
Where did you place those scripts?
That error message says that you have used an unidentified command inside an event's script command.


But this script should be placed in the script editor, not in an event...


If you placed it correctly, follow the bughunting methods of the following tutorial:


http://forums.rpgmakerweb.com/index.php?/topic/40589-how-to-use-a-script/
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,294
Reaction score
11,880
First Language
English
Primarily Uses
RMMV
Did you start a new game after installing the script? That's usually the cause of the nil:NilClass errors.


And if it REALLY says listt (with two t's) it means you've made changes to the script.


In fact, this script doesn't even USE Game_Interpreter. Are you sure it's THIS script that's causing your problem?
 

wistiecutie

Villager
Member
Joined
May 3, 2015
Messages
17
Reaction score
3
First Language
french
Primarily Uses
Haha it's actually fine , thank you , I actually just had to start a new game !

Thanks and amazing work by the way !
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
12,502
Reaction score
12,785
First Language
English
Primarily Uses
RMVXA
Shaz, this script is all one line. Is there a version of it anywhere that is in a proper format?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,294
Reaction score
11,880
First Language
English
Primarily Uses
RMMV
@bgillisp - I put it into pastebin and replaced the script with a link.  Let me know if you have any problems using it.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
12,502
Reaction score
12,785
First Language
English
Primarily Uses
RMVXA
Thanks Shaz! Looks pretty self explanatory to use. Now I just have to wait until I'm in a position to start a new game (I'm working on Chapter 9 right now) before installing it.
 

Burgerland

Veteran
Veteran
Joined
Sep 26, 2015
Messages
272
Reaction score
60
First Language
English
Primarily Uses
N/A
I think I screwed up the script. I added the regevt on mode to my map's box, both once withiout < > and once within < >, but neither time worked. The map has multiple region ids, which activate when you push a certain button. But when I try with the script, the regions don't do anything.


Before using the script, I made the common event parallel process and added erase event at the end of each event, but the events kept going regardless when I activated them.

commonevent.PNGmapprop.PNG
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
28,990
Reaction score
6,672
First Language
German
Primarily Uses
RMMV
One problem with the event is that any conditional branch "button pressed" needs to be in a parallel process, because otherwise you need to hit the button at exactly the correct time frame (one frame is 1/60 of a second, only luck can get you to hit that short time), and the erase event after a single frame blocked the parallel as well.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

I swear, the last 3 weeks I haven't felt like helping people at all. No idea why, even if I know the exact solution they need. Might need to harness my inner @Shaz or something. :LZSexcite: :thumbsup-right:
Look, I get that it's illegal, but...
It just happen we got P7 as booth number, so i draw Girls Frontline's P7 in this
Stream will be live shortly! Going to start with some Minecraft spriting, and might switch mid-stream. Depends~ Feel free to drop by!
MushroomCake28 wrote on Finnuval's profile.
Glad to see you're back! I was wondering what you've become! It's been a while since we spoke to each other!

Forum statistics

Threads
93,472
Messages
912,768
Members
123,006
Latest member
josephdevelops
Top