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.

Multiple Enemy Battlers

This is a simple script and you can use it anyway you want, I originally wrote it to allow me/other people to give non-boss enemies more than one pose and for other people to change the colour of an enemy if they wanted.

Here's the short script, which should be placed above main and below game_enemy.
Code:
class Game_Enemy < Game_Battler
  alias old_initialize initialize
  def initialize(troop_id, member_index)
    old_initialize(troop_id, member_index)
    if (rand(100) + 1) > 50 #50%
      case @enemy_id
      when 1 #enemy 1 in the database
        @battler_name = '052-Undead02' #example of a differant battler entirely
      when 2
        @battler_hue = 124 #example of a differant coloured enemy (range is 0 - 360)
      end
    end
  end
end

First you might want to change is the probability, it is set to 50%.
For each enemy you want to have more than one battler give them a when statement and edit the examples.

Versions I can forsee being requested:
Just copy and base the outline:
Code:
    if (rand(100) + 1) > 50 #50%
      case @enemy_id
      when 1 #enemy 1 in the database
        @battler_name = '052-Undead02' #example of a differant battler entirely
      when 2
        @battler_hue = 124 #example of a differant coloured enemy (range is 0 - 360)
      end
    end
And change the probability for that section and then only include the id in the section that has the probability for that enemy that you want.
You're crazy...*just wanted to say it*
This isn't too hard...
First say you wanted 4 alternate poses for all enemies, i'd set the percentage to 75% then replace
Code:
        @battler_name = '052-Undead02' #example of a differant battler
with something that looks something like:
Code:
x = (rand(75) + 1)
if x > 50
  @battler_name = '052-Undead02' #example of a differant 
elsif x > 25
  @battler_name = '053-Undead03' #example of a differant 
else
  @battler_name = '054-Undead04' #example of a differant 
end
If it's not too clear I can offer more advice/guidence.

There are other things you can do with this if you are a scripter you could have rare versions that when you see some random guy rewards you or something. Bad example but it's to show that this can be built on if you wanted, you could have a character that learns skills from seeing rare enemies or you could give them rarer items to drop, but you would need to be able to script to add such things. I may take a few of these requests provided the're not too time consuming (I don't have a great amount of free time at the moment, hopefully that will change in a week or two).

Ok that's all from me for the moment enjoy.

Oh and as far as compatability goes I'm pretty sure this will work with anything, if it doesn't...I'll try to help.
 

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