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.

[RESOLVED] Random Monster Groups

Yin

Member

Script Request Template
This is a request for a compatibility fix

RMXP or RMVX:
XP

Detailed Description:
Is there any way that this (down there) can work with ACBS - Atoa Custom Battle System 2.0 Beta?

http://rmvxp.co.cc/thread-340.html?

Code:
# Random Monster Groups  

# by RPG Advocate

 

 

#==============================================================================

# ** Game_Enemy

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

#  This class handles enemies. It's used within the Game_Troop class

#  ($game_troop).

#==============================================================================

 

class Game_Enemy < Game_Battler

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

  # * Object Initialization

  #     troop_id     : troop ID

  #     member_index : troop member index

  #     random_index : random troop index

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

  alias rmg_initialize initialize

  def initialize(troop_id, member_index, random_index = -1)

    rmg_initialize(troop_id, member_index)

    @random_index = member_index

    @random_index = member_index

    if random_index >= 0

      @random_index = random_index

    end

  end

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

  # * Get Battle Screen X-Coordinate

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

  def screen_x

    return $data_troops[@troop_id].members[@random_index].x

  end

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

  # * Get Battle Screen Y-Coordinate

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

  def screen_y

    return $data_troops[@troop_id].members[@random_index].y

  end

end

 

 

 

#==============================================================================

# ** Game_Troop

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

#  This class deals with troops. Refer to "$game_troop" for the instance of

#  this class.

#==============================================================================

 

class Game_Troop

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

  # * Setup

  #     troop_id : troop ID

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

  def setup(troop_id)

    # Set array of enemies who are set as troops

    @enemies = []

    troop = $data_troops[troop_id]

    # Split array name for random troop system

    first = troop.name[0]

    second = troop.name[1]

    third = troop.name[2]    

    # Create troop error messages

    error1 = "Error: Minimum size for random groups "

    error2 = "must not exceed maxmimum size."

    error3 = error1 + error2

    error4 = "Error: There must be at least as many "

    error5 = "monsters in the monster group as "

    error6 = "the maximum number of monsters that can "

    error7 = "appear in the random monster group."

    error8 = error4 + error5 + error6 + error7

    error9 = "Error: Number of monsters to use in "

    error10 = "random generation is greater than "

    error11 = "the size of the monster group."

    error12 = error9 + error10 + error11

    # Compare troop data and apply accordingly

    if first >= 49 && first <= 56

      if second >= 49 && second <= 56

        if third >= 49 && third <= 56

          min = first - 48

          max = second - 48

          used = third - 48

          difference = second - first

          if min > max

            print(error3)

            exit

          end

          if max > troop.members.size

            print(error8)

            exit

          end

          if used > troop.members.size

            print(error12)

            exit

          end

        if difference != 0

          troop_size = rand(difference + 1) + min

        else

          troop_size = min

        end

        for j in 0..troop_size - 1

           enemy_number = rand(used)

           @enemies.push(Game_Enemy.new(troop_id, enemy_number, j))

        end

           return

        end

      end

    end

    # Apply troop data

    for j in 0...troop.members.size

      enemy = $data_enemies[troop.members[j].enemy_id]

      if enemy != nil

        @enemies.push(Game_Enemy.new(troop_id, j))

      end

    end    

  end

end

I get an error when trying to attack.
Line 4017 NoMethodError occurred.
Undefined method 'dmg_mirror=' for nilClass

I think it has something to do with the indices of the enemies.

I am not using the SDK. These are the only two conflicting scripts.

If someone has any specific questions, please ask.
 

Yin

Member

It's under everything. It won't give an error unless your fighting a random monster group, regular groups are fine. Should I make a demo?
Also, another issue is that sometimes the enemies stack.

Edit:
Note this is the demo with no changes at all. No additional scripts. While taking these screenshots, I encountered the error again, it seems that the error only happens SOMETIMES.
Exampleofsometimeyerror.jpg
Here is the enemy stacking.
Stacking.jpg
Here is the cursor pointing at the wrong enemy.
Exampleofwrongenemy.jpg
And the cursor pointing at nothing.
Exampleofwrongspot.jpg

Is it just me getting these weird glitches???

I have 3 monsters there. Flan, Hell Demon, and Ghost. I named it 133. They are randomized, but they will stack on top of each other if there's more than one of the same thing and the cursor will point to the wrong person or even an empty area while the help window says the correct name of the person targetted.
 

Atoa

Member

The stacking is caused by the fact that you didn't set the right postion for enemies.
You must change the enemies graphics to the enemy position model.

I didn't get the damage mirror error any time, maybe it's because i'm using an updated version (wich i will relase soon).

And I dunno what can be causing the cursor glitch. Let's see if thats occur with the next version.
 

Yin

Member

I did set the right positions. Here's a screenshot of the editor with the postion models in for the phantom, hell demon, and the flan.
Exampleofmysetupinthedatabaseusingp.jpg

The damage mirror error only happens sometimes, so I can't really pinpoint the source. As for the cursor, I think that's an issue with the indices.
I will wait for the updated version and try it again.
 

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