Tsukihime 1,489 Posted July 4, 2012 (edited) Encounter Update -Tsukihime Overview This script provides functionality for changing a map's encounters using script calls. Currently you can only add new encounters and remove the custom encounters. Example Perhaps when a certain switch has been activated, a certain monster is supposed to be roaming a certain map. You can use this script to add a new encounter using events that activate when the switch is ON No need to create an extra map just for that new encounter Usage To add an encounter to a map, use the script call set_encounter(encounter_id, troop_id, weight, region_set, map_id) where -encounter ID is an ID used to refer to this encounter -troop_id is the ID of the troop from the database -weight is the probability of encountering that troop -region_set is an array of regions that the troop appears -map_id is the ID of the map To remove an encounter from the map, use the script call remove_encounter(encounter_id, map_id) To remove all custom encounters on a map, use the script call remove_encounters(map_id) This will revert the map's encounters back to their original settings. You can change the encounter rate as well using the following calls change_encounter_rate(rate, map_id) # increase/decrease encounter rate restore_encounter_rate(map_id) # set the modifier rate back to 0 Download Script: http://db.tt/kSQbqMmg Edited December 20, 2012 by Tsukihime Share this post Link to post Share on other sites
Clord 14 Posted August 19, 2012 Well your script just got some use. It works fine, thanks. Share this post Link to post Share on other sites
Shadow 6 Posted August 19, 2012 Nice script!! In my game, u can choose difficult mode (normal, difficult, god mode, for example) I want to use this script in the way that if u select hard or god mode, the rate changes for all map, but is so bored to add 1 by 1, can u do something? well, I found a way I think, just this: while $game_variables[1] < X (max number of maps u have) change_encounter_rate(20, $game_variables[1] $games_variables[1] =+ 1 end and u can add this to your script with a method =) Share this post Link to post Share on other sites
Tsukihime 1,489 Posted August 19, 2012 I don't think the difficulty of a game should be measured by how frequent you run into encounters though. It just means fighting the same boring battle 5x as many times. Share this post Link to post Share on other sites
dickadowman 0 Posted November 18, 2012 Please Help! I'm using this script with RPG maker VX Ace 1.0 It says this in the box in my "about" tab Ruby Version 1.9.2 Copyright © 1993-2010 Yukihiro Matsumoto Scintilla Version 2.22 Copyright © 1998-2003 Neil Hodgson libogg Version 1.2.2 Copyright © 2002 Xiph.Org Foundation libvorbis Version 1.3.2 Copyright © 2002-2008 Xiph.Org Foundation libtheora Version 1.1.1 Copyright © 2002-2009 Xiph.Org Foundation libtheoraplayer Version 1.0 Copyright © 2008-2009 Kresimir Spes I believe I understand the script, The weight needs to = 100 at any given time and all my tilesets are currently set to 0 for region tile. I use the script call. add_encounter(1, 100, [0], 1) on an npc I talk to. but after I talk to him, I don't get into any battles! What am I doing wrong? I need this script for my day/night cycle. Does this script have a dependency? It doesn't seem like it should. Or do I not actually HAVE those versions of RPGmaker, and the script requires ruby? Share this post Link to post Share on other sites
dickadowman 0 Posted November 18, 2012 http://imgur.com/POXXh I talk to the guy and run around but nothing happens, the avg steps for battle on the map is 1. When I run it I get a no method error from the game interpreter, undefine method, it says line 1411. It says add_encounter is an undefined method D: Share this post Link to post Share on other sites
Tsukihime 1,489 Posted November 18, 2012 (edited) There is only one version of RPG Maker VX Ace. Well, maybe two (if you consider the english version to be different from the japanese version). Did you add the script to the new project? I created a new project with the same event and script call and it works fine for me. Upload that project I'm not sure what is wrong with it. Edited November 18, 2012 by Tsukihime Share this post Link to post Share on other sites
Tsukihime 1,489 Posted December 20, 2012 (edited) The current method for adding new encounters that is exposed to the interpreter is add_encounter(troop_id, weight=10, regions=[], map_id=current_map_id) Problem is, there's no way to reference this encounter afterwards. I have added a new method for adding encounters: set_encounter(encounter_id, troop_id, weight, regions, map_id) This is basically the same as before, except you must specify an encounter ID. You can use refer to custom encounters by ID in the future, such as removing a specific encounter remove_encounter(encounter_id, map_id) You may still use the add_encounter method, but that is deprecated. For backwards compatibility, I have assigned all unindexed custom encounters to -1. You can call remove_encounter(-1, map_id) to remove all unindexed encounters on a map. Which can be convenient I guess if you don't really care about the ID. Edited December 20, 2012 by Tsukihime Share this post Link to post Share on other sites
MontyDrake 0 Posted May 14, 2013 I've used this script and I find my game crashing, and this message popping up: Script 'Game_Interpreter' line 1411: TypeError occurred. can't clone Fixnum It's something i've done wrong, or is it a bug? Ask me any info you need. Share this post Link to post Share on other sites
Tsukihime 1,489 Posted May 15, 2013 (edited) If you're typing in one region make sure you are typing [1] Instead of1 Though I could check it on my end... Edited May 15, 2013 by Tsukihime Share this post Link to post Share on other sites
Maliki 33 Posted May 15, 2013 This script alone is making me want to impliment a day/night system now! Great job TH! (as always!) Share this post Link to post Share on other sites
MontyDrake 0 Posted May 15, 2013 Thank you very much Tsukihime! I'll save you having to check anything. It was all my fault. Share this post Link to post Share on other sites
LazESigma 0 Posted December 24, 2013 Hello, I could use some assistance and I think this script is what I need, however, I don't think I'm implementing it correctly. I have a single map with an Step Rate of 15. I want a very specific area. (Region 5) to have an Step Rate of 1. (monster every step or there about) I downloaded the large script file and placed in in the Materials (insert here) area. Then I'm having the character walk on a tile that will trigger the step change. I have that set to this in the event: change_encounter_rate(-14, map_id) Am I using this correctly? Do I just leave map_id as "map_id" or do I have to hunt down the actual ID of the map I'm in? Any help would be appreciated! Share this post Link to post Share on other sites
Tsukihime 1,489 Posted December 24, 2013 You pass in the ID of the map you want to change, but by default if you don't specify a number it will just be the current map change_encounter_rate(-14) Share this post Link to post Share on other sites
LazESigma 0 Posted December 26, 2013 Hmm, does the rate change only affect custom encounters? I'm currently not using the add_encounter or set_encounter methods. Share this post Link to post Share on other sites
LazESigma 0 Posted December 26, 2013 Got it working, thanks! I did need to combo it with the custom set_encounter. Thanks for the script! Share this post Link to post Share on other sites
Glyxis 5 Posted December 29, 2013 (edited) Heh, I already have couple copied maps if something happen and encounter changes. Maybe use this script for bigger plans. Edited December 29, 2013 by Glyxis Share this post Link to post Share on other sites
Dog_Girl_Kari 0 Posted January 21, 2015 (edited) Okay, I think i answered my own question from before, you set your own Encounter_ID as this only works with Custom added encounters, not the ones that are added through the map. However, I have all the fields filled out and at no point does it add the encounters to the map. set_encounter(['PirateScallywag'],[18],[3],[1],[24]) set_encounter(['Pirate'],[20],[10],[1],[24]) set_encounter(['Scallywag2'],[19],[4],[1],[24]) How I have it set up currently. What am I doing wrong? Edited January 21, 2015 by Dog_Girl_Kari Share this post Link to post Share on other sites
Tsukihime 1,489 Posted January 21, 2015 (edited) For the encounter ID just count the list from top to bottom. First encounter is ID 1, second encounter is ID 2 region ID sets are not necessarily. They behave the same way as the default region sets you see in the editor. Although now that I look at the script, you can't remove default encounters, you can only remove "custom encounters", which requires you to enable the custom encounter switch which is also kind of questionable since "custom encounters" by default is empty... I will update the script to make it more intuitive. This script is pretty old so I'm not surprised that it's unfriendly. Edited January 21, 2015 by Tsukihime Share this post Link to post Share on other sites
Dog_Girl_Kari 0 Posted January 21, 2015 (edited) For the encounter ID just count the list from top to bottom. First encounter is ID 1, second encounter is ID 2 region ID sets are not necessarily. They behave the same way as the default region sets you see in the editor. Although now that I look at the script, you can't remove default encounters, you can only remove "custom encounters", which requires you to enable the custom encounter switch which is also kind of questionable since "custom encounters" by default is empty... I will update the script to make it more intuitive. This script is pretty old so I'm not surprised that it's unfriendly. Okay, I have it now set up remove_encounter([1,2,3], [24]) and it's still not removing the encounters. EDIT- I will come back to this later then. Thanks for the help Edited January 21, 2015 by Dog_Girl_Kari Share this post Link to post Share on other sites
Tsukihime 1,489 Posted January 29, 2015 I have made a number of changes to the script and have decided it would be better to release it as a new version in case anyone is using the old version. Use this script instead: http://himeworks.com/2015/01/custom-map-encounters/ 2 Share this post Link to post Share on other sites
Dog_Girl_Kari 0 Posted February 6, 2015 (edited) Thank you so much BTW for updating this! It's been a huge help! You rock Hime! It appears that defining multiple encounters in an array doesn't work for default map encounters. Needed to add each removal as a separate line. Not a big deal. Edited February 6, 2015 by Dog_Girl_Kari Share this post Link to post Share on other sites