Random Encounters When Moving

Dacuna

Veteran
Veteran
Joined
Feb 19, 2013
Messages
143
Reaction score
10
First Language
English
Primarily Uses
In one section of my game, I'm making a labyrinth where the character moves on his own, in the direction the player chooses.

For instance, the character moves down, and when he reaches an intersection, the player chooses "Left" or "Right".

The only problem is, I want to add in random encounters, but no monsters show up when the player is moving by Set Move Route.

Is there a way to enable random encounters when setting the move route?

Thanks.
 

Kai Monkey

Veteran
Veteran
Joined
Apr 3, 2012
Messages
166
Reaction score
119
First Language
RGSS3
Primarily Uses
Hey ♫

I have not tested it completely, so their may be some bugs, but try this:

Code:
################# Kaimonkey's Move Route Encounters Snippet################class Game_Player < Game_Character  #--------------------------------------------------------------------------  # * Execute Encounter Processing  #--------------------------------------------------------------------------  def encounter    #return false if $game_map.interpreter.running?    return false if $game_system.encounter_disabled    return false if @encounter_count > 0    make_encounter_count    troop_id = make_encounter_troop_id    #return false unless $data_troops[troop_id]    BattleManager.setup(troop_id)    BattleManager.on_encounter    return true  end  def update_encounter    return if $TEST && Input.press?(:CTRL)    return if $game_party.encounter_none?    return if in_airship?    #return if @move_route_forcing    @encounter_count -= encounter_progress_value  end  def update_nonmoving(last_moving)    if $game_map.interpreter.running?      update_encounter if last_moving    else      if last_moving        $game_party.on_player_walk        return if check_touch_event      end      if movable? && Input.trigger?(:C)        return if get_on_off_vehicle        return if check_action_event      end      update_encounter if last_moving    end  endend 
 
Last edited by a moderator:

Kai Monkey

Veteran
Veteran
Joined
Apr 3, 2012
Messages
166
Reaction score
119
First Language
RGSS3
Primarily Uses
Are you sure that's the script that has the incompatibility issue? I havn't tested it yet, but I read through the whole code and there's no reason the two should interact

EDIT: Tested with the script, and it worked perfectly. Do you have anyother scripts installed?

EDIT EDIT: Wait, nevermind, found the bug, was nothing to do with Yanfly, but was to-do with when you are on a map with no encounters.

Here is the fix

Code:
################# Kaimonkey's Move Route Encounters Snippet################class Game_Player < Game_Character  #--------------------------------------------------------------------------  # * Execute Encounter Processing  #--------------------------------------------------------------------------  def encounter    #return false if $game_map.interpreter.running?    return false if $game_system.encounter_disabled    return false if @encounter_count > 0    make_encounter_count    troop_id = make_encounter_troop_id    return false unless $data_troops[troop_id]    BattleManager.setup(troop_id)    BattleManager.on_encounter    return true  end  def update_encounter    return if $TEST && Input.press?(:CTRL)    return if $game_party.encounter_none?    return if in_airship?    #return if @move_route_forcing    @encounter_count -= encounter_progress_value  end  def update_nonmoving(last_moving)    if $game_map.interpreter.running?      update_encounter if last_moving    else      if last_moving        $game_party.on_player_walk        return if check_touch_event      end      if movable? && Input.trigger?(:C)        return if get_on_off_vehicle        return if check_action_event      end      update_encounter if last_moving    end  endend  
 
Last edited by a moderator:

Dacuna

Veteran
Veteran
Joined
Feb 19, 2013
Messages
143
Reaction score
10
First Language
English
Primarily Uses
Oh yeah, that was it...

Well, thanks a lot for the fix!
 

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

Latest Threads

Latest Profile Posts

I stumbled upon 2 articles about why time goes faster as we age, and how to "slow down time".
Check them out, very interesting read. :D
Faster Time
Slower Time
Anyone can recommend a good gaming mouse? My mouse wheel has given up. Last mouse was steel series diablo iii edition (I know, it's been a while)
And then I figured out a way to doing a "regular animation" that's affected by PIXI particles. So now each frame of the animation gets particle effects. Soon my dreams of a world without QSprite will be realized. :kaopride:
Currently every NPC in my RPG gets a name, its kinda useless to name all, but Its also cool, somehow.
Biggest prob is to come up with different names. xD
I'm back from my visit to my family. Was really great to see them again after a year even if I had to get tested for covid for the visit.

Forum statistics

Threads
104,268
Messages
1,005,127
Members
135,780
Latest member
kajohac685
Top