[RMXP] Help with changing encounter steps?

Noln

Warper
Member
Joined
Nov 15, 2020
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMXP
I've been toying with RMXP for a couple of weeks now, and I'm trying to make an event that changes the frequency of encounters with a script, I already have the code written down ($game_map.map.encounter_step = number of steps), but there's one problem. It doesn't actually register the code and change the encounter rate until you have an encounter. Which means if I change the rate to never, I'll get an encounter, and then it'll change to never. Then if I want to change it back to common, it won't actually change back to common until I get an encounter, which sucks.
 

MobiusXVI

Game Maker
Veteran
Joined
Mar 20, 2013
Messages
383
Reaction score
91
First Language
English
Primarily Uses
How are you calling the code? Are you calling it when the player gets into battle? Then yea you can't change it back. But there are other ways/times you could be calling the code to change the encounter rate.
 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
281
Reaction score
106
First Language
English
Primarily Uses
RMXP
Game_Map#map isn't even defined in the vanilla scripts, so you're clearly trying to edit the scripts. What is your true purpose anyways? Are you trying to make a "repel" item? If so, you should use the Change Encounter event command instead.
 

Noln

Warper
Member
Joined
Nov 15, 2020
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMXP
I want an item that lets the player control the spawn rate of the monsters, as well as what monsters will spawn. Right now I have it hooked up to an npc through a script event.
 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
281
Reaction score
106
First Language
English
Primarily Uses
RMXP
How does it work if the player changes maps? Does the item behave differently for each map, or does it work the same across all of them? And I assume the effect will still be in place when the player saves and reloads the game (this is the biggest concern I have with your system).

To address your original problem, you need to call $game_player.make_encounter_count after setting the new encounter rate.
 

Noln

Warper
Member
Joined
Nov 15, 2020
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMXP
That worked like a charm! Thank you very much!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,090
Members
137,587
Latest member
Usagiis
Top