Galv 1,386 Posted September 15, 2012 Region Effects - Version 1.7 By Galv Introduction I created this script for myself as a "learning ruby" project. It was designed to activate effects when the player stands on designated regions so there's no need to spam events across the ground to do things.Features Specify effects you want to happen on designated region tiles. Region effects can include: -- A sound effect (automatically varies volume and pitch so not to be repetitive) -- An event that appears at the player's location (for example, footprints. These events are stored on a designated map) -- Activating a common event I figure with access to these three things (and some eventing knowledge), you can create a region effect that does nearly anything you want so you don't have to spam events everywhere. Included in the demo are some basic pre-made effects as examples - footprints, water splashes, fire trap, dust trail, bushes rustling, footstep sounds on different surfaces.Screenshot A screenshot of just a few of the pre-made effects in the demo:How to Use Place script under Materials and above Main. See top of the script for instructions and settings.To transfer pre-made effects to your game: 1. Copy image from /Graphics/Characters/!Other-specials.png to your project (into same folder) 2. Copy the "EFFECTS TO SPAWN" map from this demo into your game. (Ctrl+C on the map and Ctrl+V into your game maps is quickest) -- this map has events set up for the pre-made effects 3. Check the map ID of the copied map as it appears in your game 4. Change the SPAWN_MAP_ID number to this map ID 5. Change REGION_EFFECT_SWITCH to a switch you are not using in your game. 6. Add some regions to your map to test. 7. Make sure you start a new game. It will not work loading a pre-script save file.ScriptGet it hereFAQ None yet.Credit and Thanks - Galv - Yanfly and Quack for the method to spawn an eventAuthor's NotesUpdates 2012-11-15 Version 1.7 - made the effects work during forced move routes 2012-11-15 Version 1.6 - fixed a major bug that caused events to disappear 2012-11-04 Version 1.5 - bug fix and efficiency updates suggested by Quack 2012-10-24 Version 1.4 - updating alias naming to be compatible with my own scripts... heh. 2012-10-19 Version 1.3 - re-wrote some of the code make it more effecient when using large amounts of effects. 2012-10-09 Version 1.2 - fixed up some dumb code that should reduce lag on low-end pc's 2012-09-16 Version 1.1 - now works with Yanfly's spawn event script 5 Wren, Neverward, EternalShadow and 2 others reacted to this Share this post Link to post Share on other sites
Tsukihime 1,487 Posted September 15, 2012 (edited) Footsteps in the snow and shallow water. Small things that makes your game much more realistic. Edited September 15, 2012 by Tsukihime Share this post Link to post Share on other sites
Falcao 88 Posted September 15, 2012 (edited) The effects looks very nice I asked myself how did add those effect sprites (cuz in the script there is not sprite class defined) then i noticed that you spawn events from another maps, very good idea Edited September 15, 2012 by Falcao Share this post Link to post Share on other sites
EternalShadow 28 Posted September 16, 2012 (edited) A very nice script, and easy to edit too. However, I tested it by walking over dust and got this: I'm sure I followed all the steps correctly, so what could be happening? EDIT: Upon re-reading the scripts, it's based on regions. These regions are not tied to the tile itself, but rather, the regions in the region editor. Could this be occuring because I have 9 regions on my world map and am (testing) with region 5 on another map? Currently, the regions are there for determining the location of monster encounters... If this is not the case, then can you enlighten me? Thanks. Edited September 16, 2012 by HotfireLegend Share this post Link to post Share on other sites
Galv 1,386 Posted September 16, 2012 I see, thanks for telling me. I'll add a step. You need to start a new game. I am guessing you loaded a save file? 1 EternalShadow reacted to this Share this post Link to post Share on other sites
EternalShadow 28 Posted September 16, 2012 (edited) I see, thanks for telling me. I'll add a step. You need to start a new game. I am guessing you loaded a save file? Yes, I loaded. Good catch. Let me go try a new game. EDIT: Works beautifully now. Kudos! Edited September 16, 2012 by HotfireLegend Share this post Link to post Share on other sites
Kegasaur 0 Posted September 18, 2012 I believe I have followed the steps properly but this error message comes up when i try to launch the game I have started a new game also Line 92 : class Game_Player < Game_Character I hope you can help Share this post Link to post Share on other sites
Galv 1,386 Posted September 18, 2012 I haven't seen this one before. I'm not sure how it could happen on new game or launching a game. Double check that you copied the entire script. If you can upload your project somewhere I will happily check if you've done it correctly. 1 Kegasaur reacted to this Share this post Link to post Share on other sites
Kegasaur 0 Posted September 18, 2012 I'm quite sure I copied the entire script, just to be safe i tried again on a new project but the same error occurs Here is a link to the .exe of the project http://www.mediafire.com/?cxxacijq4hamux5 I hope you can help Share this post Link to post Share on other sites
Galv 1,386 Posted September 18, 2012 I see what you've done - you have pasted the script at the top of them all. You need to paste it below the "Materials" heading and above the "Main" heading. That's where all scripts you try will go. 1 Kegasaur reacted to this Share this post Link to post Share on other sites
Kegasaur 0 Posted September 18, 2012 (edited) Thank you, i guess I'm shit at reading, i just found where it says to put it in materials It launches now so thanks again. I noticed that the water you used can be walked through but not on mine,I was wondering how you change that Edited September 18, 2012 by Kegasaur Share this post Link to post Share on other sites
Galv 1,386 Posted September 18, 2012 You can change the passability in the tileset. Go to the database and the Tilesets" tab to find that 1 Kegasaur reacted to this Share this post Link to post Share on other sites
Kegasaur 0 Posted September 18, 2012 Thanks man, Iv'e been using RPG maker for a while but only just got into RPG maker Ace You've been a great help Share this post Link to post Share on other sites
Caveras 39 Posted September 18, 2012 Ah, I'm never going to finish my project when people like you post fine stuff like this every other day! ... but I was really looking for something like that, and it's pretty sweet! Nice & thanks! Share this post Link to post Share on other sites
Snake 4 Posted September 18, 2012 Thats a very nice script! Kudos to you. Share this post Link to post Share on other sites
Galv 1,386 Posted October 9, 2012 (edited) Just an FYI - Updated to v.1.2. I found that low-end PC's lagged a bit while event effects were happening. A small change to the code reduces that significantly. At least... my old dodgy test laptop likes areas using this in Pirate Rush a whole lot better now haha. EDIT: And another efficiency update to v.1.3 to run better when using large amounts of effects. EDIT: 1.4... heh. Edited October 24, 2012 by Galv Share this post Link to post Share on other sites
Jinjo 2 Posted November 2, 2012 It's great, but I'd only use it if there were an option to use BGS instead of SEs...that'd be a good feature. Share this post Link to post Share on other sites
Galv 1,386 Posted November 2, 2012 What are you wanting to do that requires changing BGS with every step? Share this post Link to post Share on other sites
Jinjo 2 Posted November 2, 2012 (edited) Well, here's what I mean. (Forget using BGS, I have a better idea.) There are X different SEs for each region, instead of just 1 as in your script at the moment. With each step the character takes, it randomly plays one of the X SEs. This would vary the sound of the footstep, making it far more realistic + enjoyable. Edited November 2, 2012 by Jinjo Share this post Link to post Share on other sites
Quack 34 Posted November 2, 2012 Nice script, love it. However, the way you choose ids for the events you spawn make it kind of incompatible with Spawn Event script. Also, using Yanflys method of loading the data for a whole map everytime you spawn an event just sounds very inefficient to me. Share this post Link to post Share on other sites
Galv 1,386 Posted November 2, 2012 Well, here's what I mean. (Forget using BGS, I have a better idea.) There are X different SEs for each region, instead of just 1 as in your script at the moment. With each step the character takes, it randomly plays one of the X SEs. This would vary the sound of the footstep, making it far more realistic + enjoyable. The sound effect played varies pitch and volume to try to add that "realistic and enjoyable" feel. But if you want to use multiple SE's, you could use the common event part of the effect to do it instead and not use the normal SE for it. Nice script, love it. However, the way you choose ids for the events you spawn make it kind of incompatible with Spawn Event script. Also, using Yanflys method of loading the data for a whole map everytime you spawn an event just sounds very inefficient to me. Still learning scripting. Don't know how to make it any more efficient. I use this in my own game with no issues. Which spawn event script is in incompatible with? Share this post Link to post Share on other sites
dbchest2 11 Posted November 2, 2012 this is a nice aesthetic. Share this post Link to post Share on other sites
∑-sigma- 16 Posted November 3, 2012 Not sure if anyone else's noticed, but when using Yami's Overlay script, the region effects won't appear visually when you use a ground layer, unless it's transparent. (Meaning basically, the effect is still occuring, it's just occuring under the ground so you can't see it, not so bad if you only want the sound effects though.) Share this post Link to post Share on other sites
Quack 34 Posted November 3, 2012 Still learning scripting. Don't know how to make it any more efficient. I use this in my own game with no issues. Which spawn event script is in incompatible with? I'm new to scripting too. And I never said it wasn't efficient enough, it just sounds to me like it would be pretty slow to load the data for a whole map everytime you want to spawn an event. But if it works it works. As for the possible icompatibility, you calculate the new id for an event this way: if @effect_var == 0 key_id = Region_Effects::START_ID @effect_var = Region_Effects::START_ID + 1 elsif @effect_var <= Region_Effects::MAX_EFFECTS + Region_Effects::START_ID - 1 key_id = @effect_var @effect_var = @effect_var + 1 else key_id = Region_Effects::START_ID @effect_var = Region_Effects::START_ID + 1 end If the id is already in use you overwrite the old event. The way Yanflys and Kals Spawn Event scripts choose a new id is this way: id = @events.keys.max + 1 So if for example you are on a map and one ore or more events are spawned by your script, and an event is then spawned by Yanflys Spawn Event script. The next time an event is spawned by your script, that new event will overwrite the event spawned by Yanflys script (assuming the amount of events that were spawned by your script before an event was spawned by Yanflys script was lower than the MAX_EFFECTS constant in your script). Share this post Link to post Share on other sites
Galv 1,386 Posted November 3, 2012 Not sure if anyone else's noticed, but when using Yami's Overlay script, the region effects won't appear visually when you use a ground layer, unless it's transparent. (Meaning basically, the effect is still occuring, it's just occuring under the ground so you can't see it, not so bad if you only want the sound effects though.) The region effect spawned events are just normal events - nothing special about them. Unrelated to this script - in my game I changed the z value for the ground layer in yami's script as it was displaying above events for me, too. I wasn't sure if that was intentional or why nobody had commented on that, I thought it was just me haha. Still learning scripting. Don't know how to make it any more efficient. I use this in my own game with no issues. Which spawn event script is in incompatible with? I'm new to scripting too. And I never said it wasn't efficient enough, it just sounds to me like it would be pretty slow to load the data for a whole map everytime you want to spawn an event. But if it works it works. As for the possible icompatibility, you calculate the new id for an event this way: if @effect_var == 0 key_id = Region_Effects::START_ID @effect_var = Region_Effects::START_ID + 1 elsif @effect_var <= Region_Effects::MAX_EFFECTS + Region_Effects::START_ID - 1 key_id = @effect_var @effect_var = @effect_var + 1 else key_id = Region_Effects::START_ID @effect_var = Region_Effects::START_ID + 1 end If the id is already in use you overwrite the old event. The way Yanflys and Kals Spawn Event scripts choose a new id is this way: id = @events.keys.max + 1 So if for example you are on a map and one ore or more events are spawned by your script, and an event is then spawned by Yanflys Spawn Event script. The next time an event is spawned by your script, that new event will overwrite the event spawned by Yanflys script (assuming the amount of events that were spawned by your script before an event was spawned by Yanflys script was lower than the MAX_EFFECTS constant in your script). This was what I came up with to solve a lag issue and also to make it compatible with yanfly's event spawning script. (Using the same method as yanfly's script didn't seem to see each other and the events overwrote the last when used together.) I chose to have a start ID (which you can set to whatever you want... to thousands if you are going to have that many events...) and then it will only use from the START_ID to the MAX_EFFECTS IDs... for example, START ID = 1000, MAX_EFFECT = 10... then the script will only ever use event ID's 1000 - 1010 and will keep cycling through those so as not to infinitely generate events and lag it up. I originally had it working as Yanfly did, but every region effect event spawned would remain on the map and would cause lag after a while if so many have been generated. Share this post Link to post Share on other sites