Tsukihime

Encounter Update

22 posts in this topic

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 by Tsukihime

Share this post


Link to post
Share on other sites

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

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

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

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 by Tsukihime

Share this post


Link to post
Share on other sites

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 by Tsukihime

Share this post


Link to post
Share on other sites

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

If you're typing in one region make sure you are typing

[1]

Instead of
1

Though I could check it on my end... Edited by Tsukihime

Share this post


Link to post
Share on other sites

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

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

Heh, I already have couple copied maps if something happen and encounter changes. Maybe use this script for bigger plans. ;)

Edited by Glyxis

Share this post


Link to post
Share on other sites

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 by Dog_Girl_Kari

Share this post


Link to post
Share on other sites

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 by Tsukihime

Share this post


Link to post
Share on other sites

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 by Dog_Girl_Kari

Share this post


Link to post
Share on other sites

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 by Dog_Girl_Kari

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.