Jump to content


Photo

Encounter Update


  • Please log in to reply
21 replies to this topic

#1 Tsukihime

Tsukihime

    Advanced Member

  • Member
  • 7120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 04 July 2012 - 12:25 PM

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, 20 December 2012 - 10:26 AM.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.pnglogo_instagram40x40.png

Go here for Bugs and Requests.
 
Want to become a beta tester for my plugins before they are released to the public?

#2 Clord

Clord

    Cool title.

  • Member
  • 93 posts
  • RM Skill - Jack of All Trades

Awards Bar:

Users Awards

Posted 19 August 2012 - 06:21 AM

Well your script just got some use. It works fine, thanks. :)

"Only I can live forever." - Voldermont.

letter_log_harry_potter_envelope.png


#3 Shadow

Shadow

    Advanced Member

  • Member
  • 99 posts

Posted 19 August 2012 - 11:34 AM

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 =)

#4 Tsukihime

Tsukihime

    Advanced Member

  • Member
  • 7120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 19 August 2012 - 12:31 PM

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.
All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.pnglogo_instagram40x40.png

Go here for Bugs and Requests.
 
Want to become a beta tester for my plugins before they are released to the public?

#5 dickadowman

dickadowman

    Member

  • Member
  • 12 posts

Posted 18 November 2012 - 03:05 PM

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?

#6 dickadowman

dickadowman

    Member

  • Member
  • 12 posts

Posted 18 November 2012 - 04:51 PM

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:

#7 Tsukihime

Tsukihime

    Advanced Member

  • Member
  • 7120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 18 November 2012 - 04:52 PM

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, 18 November 2012 - 04:53 PM.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.pnglogo_instagram40x40.png

Go here for Bugs and Requests.
 
Want to become a beta tester for my plugins before they are released to the public?

#8 Tsukihime

Tsukihime

    Advanced Member

  • Member
  • 7120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 20 December 2012 - 10:09 AM

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, 20 December 2012 - 10:11 AM.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.pnglogo_instagram40x40.png

Go here for Bugs and Requests.
 
Want to become a beta tester for my plugins before they are released to the public?

#9 MontyDrake

MontyDrake

    Newbie

  • Member
  • 4 posts

Posted 14 May 2013 - 03:02 PM

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.



#10 Tsukihime

Tsukihime

    Advanced Member

  • Member
  • 7120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 15 May 2013 - 06:18 AM

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, 15 May 2013 - 06:19 AM.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.pnglogo_instagram40x40.png

Go here for Bugs and Requests.
 
Want to become a beta tester for my plugins before they are released to the public?

#11 Maliki

Maliki

    Kinda Script Editor

  • Member
  • 456 posts
  • LocationNorthern New Jersey, USA
  • RM Skill - Jack of All Trades

Posted 15 May 2013 - 07:36 AM

This script alone is making me want to impliment a day/night system now!

 

Great job TH! (as always!)



#12 MontyDrake

MontyDrake

    Newbie

  • Member
  • 4 posts

Posted 15 May 2013 - 05:32 PM

Thank you very much Tsukihime! I'll save you having to check anything. It was all my fault.



#13 LazESigma

LazESigma

    Member

  • Member
  • 15 posts

Posted 24 December 2013 - 12:16 AM

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!



#14 Tsukihime

Tsukihime

    Advanced Member

  • Member
  • 7120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 24 December 2013 - 01:49 AM

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)

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.pnglogo_instagram40x40.png

Go here for Bugs and Requests.
 
Want to become a beta tester for my plugins before they are released to the public?

#15 LazESigma

LazESigma

    Member

  • Member
  • 15 posts

Posted 26 December 2013 - 03:45 PM

Hmm, does the rate change only affect custom encounters?

I'm currently not using the add_encounter or set_encounter methods.



#16 LazESigma

LazESigma

    Member

  • Member
  • 15 posts

Posted 26 December 2013 - 04:26 PM

Got it working, thanks!

I did need to combo it with the custom set_encounter.

Thanks for the script!



#17 Glyxis

Glyxis

    Advanced Member

  • Member
  • 103 posts
  • LocationFinland
  • RM Skill - Jack of All Trades

Posted 29 December 2013 - 04:51 AM

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


Edited by Glyxis, 29 December 2013 - 04:52 AM.


#18 Dog_Girl_Kari

Dog_Girl_Kari

    Newbie

  • Member
  • 7 posts

Posted 21 January 2015 - 03:33 PM

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, 21 January 2015 - 03:57 PM.


#19 Tsukihime

Tsukihime

    Advanced Member

  • Member
  • 7120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 21 January 2015 - 03:55 PM

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, 21 January 2015 - 03:58 PM.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.pnglogo_instagram40x40.png

Go here for Bugs and Requests.
 
Want to become a beta tester for my plugins before they are released to the public?

#20 Dog_Girl_Kari

Dog_Girl_Kari

    Newbie

  • Member
  • 7 posts

Posted 21 January 2015 - 04:02 PM

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, 21 January 2015 - 04:12 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users