Slight Default Battle System + Random Encounter Tweaks

Hello!

I'm making what I hope is a fairly simple request. Everything I'm asking for should be edits/just little snippets, so it shouldn't be anything too intensive. (But what would I know? I'm the requester!)

Note that the only script I'm using is Dubleaux's Advanced Message System. These are all changes to default systems.

Battle changes
  • I would like agility to be absolute. What I mean by this is I'd like to have the character with the highest Agility ALWAYS hit first. By default the system is very random, so just because you have a higher speed value, doesn't mean you go first. I want a character with 21 Agility to always hit before one with 20 rather than most of the time. Also, I don't know if there are any factors in battle other than Agility that affect who goes first, but if there are, I'd like it to be just Agility-based instead. Extra- If two characters have the same Agility, I'd like it to randomly choose one of the characters to move first. However, I would also like it if after that, the random order stayed the same every turn until the end of that battle so long as no-one's Agility changes. This isn't necessary though.
  • I would like the player to have a 100% chance of escaping battle if they try to run away. If the player has been blocked from running away in a battle, however, give them a 0% chance.

Random encounter changes
  • This is an odd one. This is probably the hardest request here, but it might be fairly simple. What I want is a code snippet I can use to add or remove Troops in the Random encounters list during play(preferably through an event). So, for instance, if there is a troop of “Ghost *2” in the list, I want to be able to make that troop stop appearing when I tell it to. I also want to be able to, say, add “Ghost *3” to the troop list during the course of the game. Being able to remove them is more important than being able to add them.
  • I’d like to be able to mess around with the number of steps before an encounter(also preferably through an event). So, for instance, if it’s 30 steps before an encounter, during play I want to be able to change it to 40. I would also like to be able to add and subtract(and multiply and divide, if it wouldn’t be any extra trouble) the number of steps per encounters. What I mean is, I won’t always know what number of steps the encounter rate is at, so the ability to “subtract 6 from it” or “multiply it by 2” would be useful, rather than just having to set it.


That’s it!

What I have to offer
My endless gratitude and a credit in my game.
The steps one is easy. Its in the map options.
Darth J wrote:
The steps one is easy. Its in the map options.

Yes, that allows you to set it, but I'm looking to be able to change it during the course of the game.
Here you go. The rondom encounter changes. Simple to alter and simple to add to your game.

What you have to do to make it work is put the parralel procces event on every map that you will fight a monster and change the monsters accordingly. To change the steps change the 300 number. The monster removel was tricker but done as well. You can have the switch a self switch if you want. If you need help understanding it just ask away.
Or, use a script :P
  1. class Game_Map
  2.  
  3.   def stop_encounter(id)
  4.     if id.nil? or id > $data_troops.size
  5.       $game_temp.message_text = "Error: No such troop"
  6.       return
  7.     end
  8.     @map.encounter_list.delete(id)
  9.   end
  10.  
  11.   def add_encounter(id)
  12.     if id.nil? or id > $data_troops.size
  13.       $game_temp.message_text = "Error: No such troop"
  14.       return
  15.     end
  16.     @map.encounter_list.push(id)
  17.   end
  18.  
  19.   def set_steps(x)
  20.     @map.encounter_step = x
  21.     $game_player.make_encounter_count
  22.   end
  23.  
  24. end
  25.  
  26. class Interpreter
  27.  
  28.   def add_troop(troop)
  29.     id = (troop.is_a?(String) ? get_troop_id(troop) : troop)
  30.     $game_map.add_encounter(id)
  31.   end
  32.  
  33.   def remove_troop(troop)
  34.     id = (troop.is_a?(String) ? get_troop_id(troop) : troop)
  35.     $game_map.stop_encounter(id)
  36.   end
  37.  
  38.   def get_troop_id(name)
  39.     for id in 1...$data_troops.size
  40.       troop = $data_troops[id]
  41.       return id if troop.name == name
  42.     end
  43.     return nil
  44.   end
  45.  
  46.   def set_steps(x)
  47.     $game_map.set_steps(x)
  48.   end
  49.  
  50. end
  51.  
Expand to see the code.

in a script command, use:
- set_steps(x) << replace x with any number.
- remove_troop(x)
- add_troop(x)
where x is the troop's name or number, ie: 1, 3, 'Ghost*2'
Thank you so much for this! I'll try it out when I'm on my laptop. Looks pretty good, though!
Okay, silver wind, I tried it out, and it works perfectly! Easy to use and no errors thus far. Thanks so much!

How would I go about adding or subtracting from the step count rather than setting it?

~
Waiting on the second request...
Add this in line 23 of my script:
  1. def add_steps(x)
  2.     @map.encounter_step  += x
  3.     $game_player.make_encounter_count
  4.   end
Expand to see the code.


To add/remove x steps do:
  1. $game_map.add_steps(x)
Expand to see the code.

(use -x to reduce steps)
Remember if the steps are reduced to 0, RMXP will think the map has no enemy encounters.
Thanks so much!

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=71309