Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Enemy Encounter Rate Display

I was hoping to add a display of the enemy encounter rate in my CMS. Is this even possible using RGSS standards? Basically, I'm requesting a script that would draw a window in Scene_Menu to show an image that refers to your current level of danger in regards to entering a random encounter.

Something like this for example...

IF enemy encounter rate (30 steps) * potential monster troops (let's say 5) / 4 = threat level

So this would mean that 30 * 5 = 150 / 4 = 37.5 (or 38 if you round up)

Then, we define the numerical ranges that correspond to a threat level...

0... No random battles
1-10... Very High
11-20... High
21-30... Normal
31-40... Low
41-99... Very Low

So with other mathematical examples...

10 * 7 = 70 / 4 = 17.5 (18) ..... For every ten steps, you'd enter battle with one of seven monster parties for a threat level of 18, equating to a very low threat level.

This script would equate a threat of 0 to no random battles.

For the sake of my personal preference, let's say the window should be 64 x 64 in width and height, showing an image (or an animated string image would be even better) of 32 x 32 that loops over and over while in the menu.

Anyone interested in tackling this idea? I'll assist in any way I can.
 
Seems like it would make sense to include a comparison of ATK or HP * size of troop in the formula.
E.G. You could be on a map with small encounter rate, with many different enemies, but they're all easy to kill (rats, chickens, bumble bees, etc..).
If you are at level one, this might be a "Medium" threat, but later when you're at level 50, it's so low it's hardly worth bothering with.
On the inverse, you could stumble into a map with one enemy, who only appears very seldom, but is impossible to kill at lower levels.
 
I like that idea as well, but I mainly need it just to visualize the rate at which you'd run into enemies. I've checked Game_Map and Game_Player and found some definitions for encounter information, such as this from Game_Map...

Code:
  #--------------------------------------------------------------------------

  # * Get Encounter List

  #--------------------------------------------------------------------------

  def encounter_list

    return @map.encounter_list

  end

  #--------------------------------------------------------------------------

  # * Get Encounter Steps

  #--------------------------------------------------------------------------

  def encounter_step

    return @map.encounter_step

  end

And this from Game_Player...

Code:
  #--------------------------------------------------------------------------

  # * Get Encounter Count

  #--------------------------------------------------------------------------

  def encounter_count

    return @encounter_count

  end

  #--------------------------------------------------------------------------

  # * Make Encounter Count

  #--------------------------------------------------------------------------

  def make_encounter_count

    # Image of two dice rolling

    if $game_map.map_id != 0

      n = $game_map.encounter_step

      @encounter_count = rand(n) + rand(n) + 1

    end

  end

I just don't know where to start to use this to create this new script. Anyone?
 
I respond because i have created a script of this.

Encounter count is updated every time the game players move. It also works downto 0.

This is a easy system. You have to create a window in scene menu that in his refresh method draws the actual steps converted via your formula/graphics to the indicator you want.

Note that you have to changue the formula changuing the update method in scene map:

Code:
    # If encounter list isn't empty, and encounter count is 0

    if $game_player.encounter_count == 0 and $game_map.encounter_list != []

      # If event is running or encounter is not forbidden

      unless $game_system.map_interpreter.running? or

             $game_system.encounter_disabled

        # Confirm troop

        n = rand($game_map.encounter_list.size)

        troop_id = $game_map.encounter_list[n]

        # If troop is valid

        if $data_troops[troop_id] != nil

          # Set battle calling flag

          $game_temp.battle_calling = true

          $game_temp.battle_troop_id = troop_id

          $game_temp.battle_can_escape = true

          $game_temp.battle_can_lose = false

          $game_temp.battle_proc = nil

        end

      end

    end

 

That works waiting for the encounter rate to become 0, and then launch the combat. The random thing is the number of the encounter rate.

In your formula you describe a different thing. You have to use a increasing value so each added step have more and more % of start the combat.

So, i suppose you will have to remove these code and add in game_player the checking you need so that formula is applied. And then use this code to call the random monster troop in the list:

# Confirm troop
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
# If troop is valid
if $data_troops[troop_id] != nil
# Set battle calling flag
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end

I dont think that calling it in other place it will give you problems, but maybe yes... anyway thats all.
 
I don't think you understand the request gerrtrunk. I don't want to change the encounter rate formula, I just want to display it in a menu using images that will correspond to how often you enter random battles on that map.

A game with a similar feature is Breath of Fire II. Look that up and maybe we can figure this script out. Thank you for trying. I appreciate that.
 
Rubicant":3epq3sqg said:
I don't think you understand the request gerrtrunk. I don't want to change the encounter rate formula, I just want to display it in a menu using images that will correspond to how often you enter random battles on that map.

A game with a similar feature is Breath of Fire II. Look that up and maybe we can figure this script out. Thank you for trying. I appreciate that.

Well. Then its x1000 times easier.

In the window you access step rate in scene map/game map(it have a instance of map inside, or maybe its accesible now )apply the formula you want drawing a different image, text or whatever you need for each difficulty level.

Note to not use the step rate in gameplayer because that changues each step. You need the fixed one, that is located in game map, use $game_map.encounter_step that returns databse one.

Maybe i will do this script tomorrow, is very easy....


pd:canceled it
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top