Multiplying Enemies

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
Done for a request here.

This seems to be a fun script so i am sharing it here for anyone else that needs it.

This script allows the making of multiplying enemies. (enemy that splits and multiplies)

eg.

Slimes that kept multiplying at each turn's end until the original slime is killed.

Features:

Multiply or Clone enemy on a script call.

Limit to 8 enemies max per battle to prevent exp/item cheating.

Stop multiplying when the original version is dead.

Screenshot:



How to Use:

[1] Paste this script below Material and above Main

[2] Use this script call to Multiply or Clone an enemy

$game_troop.clone_enemy(N)where N = the troop member's id. (starting from 0)

Compatibility:

This script is using only new method.

So it should work with other custom scripts without any problem.

Terms of Use:

Free for use in both commercial and non-commercial games.

Script:

#==============================================================================# ■ Meow Face Clone Enemy#------------------------------------------------------------------------------# Clone/Multiply Enemy in Battle#==============================================================================# How to Use:# [1] Put this script below Material and above Main# [2] Use this script call in troop event to clone an exisiting enemy.#        $game_troop.clone_enemy(N)#      Where N is the troop member's id (0~number in party)# P/S: Please note that there is a max limit of enemy troop (up to 8 max)#==============================================================================class Spriteset_Battle  def add_new_enemies    meow_troop = @enemy_sprites.collect {|m| m.battler }    meow_army = $game_troop.members - meow_troop    meow_army.each do |enemy|      @enemy_sprites.insert(0, Sprite_Battler.new(@viewport1, enemy))    end  endendclass Game_Troop < Game_Unit  def clone_enemy(clone)    member = $game_troop.members[clone]    return if !member.alive?    return if members.size >= 8    enemy = Game_Enemy.new(@enemies.size, member.enemy_id)    members.push(enemy)    enemy.screen_x = member.screen_x + ((rand(50) + 50) - rand(100))    enemy.screen_y = member.screen_y + ((rand(10) + 10) - rand(20))    enemy.on_battle_start    make_unique_names    SceneManager.scene.update_enemy_sprites  endendclass Scene_Battle < Scene_Base  def update_enemy_sprites    @spriteset.add_new_enemies    @enemy_window.refresh  endend
Enemy Sprite Random Flip Add-On:

This add-on includes random flip of battler's sprite.

Put this add-on below the main Meow Face Clone Enemy script.

#==============================================================================# ■ Meow Face Clone Enemy (Flip Battler Graphic Add-on)#------------------------------------------------------------------------------# Random flip cloned enemy#==============================================================================# Require:# Meow Face Clone Enemy Script# How to Use:# [1] Put this script below Meow Face Clone Enemy Script#==============================================================================class Sprite_Battler < Sprite_Base  alias meow_sp_update update  def update    self.mirror = battler.flip if @battler    meow_sp_update  endendclass Game_Battler < Game_BattlerBase  attr_accessor :flip  alias meow_bat initialize  def initialize    meow_bat    @flip = false  endendclass Game_Troop < Game_Unit  def clone_enemy(clone)    member = $game_troop.members[clone]    return if !member.alive?    return if members.size >= 8    enemy = Game_Enemy.new(@enemies.size, member.enemy_id)    members.push(enemy)    enemy.screen_x = member.screen_x + ((rand(50) + 50) - rand(100))    enemy.screen_y = member.screen_y + ((rand(10) + 10) - rand(20))    enemy.on_battle_start    make_unique_names    SceneManager.scene.update_enemy_sprites    enemy.flip = (rand(2) == 0 )  endend

Updated:

25/10/2015 - It's now possible to have the newly cloned enemy show up with a flipped sprite (50% random chance of flip).

Just add that add-on script below the main script if you wish to use this feature.

11/10/2015 - Script released
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Very nice. Does it have (or could you change it to have) the ability to make a single enemy of one kind turn into two enemies of different kinds?


For instance - a rider mounted on a horse would be battled as a single enemy, but at some point they split, and become a human enemy, and a horse enemy.


I have a situation in my game just like that, and was wondering what the easiest way would be to make that happen.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
hmm, i was thinking about that too when making the script. it's actually possible to spawn any enemy within the default troop member. so if i script it to take in 2 id, it will be able to spawn id A on id B.

but after pondering a bit, that can actually be done by hidden enemy alone. so i base the script on mass multiplying type instead (up to 8). :p
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Yeah, I guess so. I may have been thinking along the lines of the new enemies would only have x% of hp, based on what had been knocked off them by the time they split. But it was a while ago - I can't think of any reason now why I couldn't do it with hidden enemies, except by default I think there's a maximum troop size in the editor.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
yup 8. need to rewrite the window and name handlers to make it show more than 8, so i leave that as it is. :p

transfer old hp to new form can be done using transformation i think. but the "other part" will have to be hidden enemy with full hp, probably troop event can help you start it off with X hp.

this script reads from current troop party. so if you have those hidden in the background, you can actually spawn them on the screen using this script. but that is simply multiplying the hidden enemy and make them show. so it will be easier to "unhide" those 2 than cloning them. and the 8 enemies limit can be a bit harsh there too.
 
Joined
Sep 9, 2015
Messages
297
Reaction score
29
First Language
English
Primarily Uses
WoWoWeeeeeee!!! This is pretty neat! Daaamit, too bad I can't use this, LMAO! ;)
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
WoWoWeeeeeee!!! This is pretty neat! Daaamit, too bad I can't use this, LMAO! ;)
Well, you sacrificed a lot for Schala Battle System. And this is one of it. :p

You will need one tailor-made for Schala but, no, i am not going to touch that script. lol!
 
Joined
Sep 9, 2015
Messages
297
Reaction score
29
First Language
English
Primarily Uses
I know right! XAS was like, "hell nah I aint making friends. What for? I am a 'one man' army" ;D
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
Thanks! Glad you find it useful! ;)
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
Updated 25/10/2015

It's now possible to have the newly cloned enemy show up with a flipped sprite (50% random chance of flip).

Just add that add-on script below the main script if you wish to use this feature.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
The script in the top post is being messed up due to the recent V3 to V4 forum migration.


Please use this alternative version until the web staff is able to find a way to fix the top post.


Main Script:


#==============================================================================
# ■ Meow Face Clone Enemy
#------------------------------------------------------------------------------
# Clone/Multiply Enemy in Battle
#==============================================================================
# How to Use:
# [1] Put this script below Material and above Main
# [2] Use this script call in troop event to clone an exisiting enemy.
# $game_troop.clone_enemy(N)
# Where N is the troop member's id (0~number in party)
# P/S: Please note that there is a max limit of enemy troop (up to 8 max)
#==============================================================================
class Spriteset_Battle
def add_new_enemies
meow_troop = @enemy_sprites.collect {|m| m.battler }
meow_army = $game_troop.members - meow_troop
meow_army.each do |enemy|
@enemy_sprites.insert(0, Sprite_Battler.new(@viewport1, enemy))
end
end
end
class Game_Troop < Game_Unit
def clone_enemy(clone)
member = $game_troop.members[clone]
return if !member.alive?
return if members.size >= 8
enemy = Game_Enemy.new(@enemies.size, member.enemy_id)
members.push(enemy)
enemy.screen_x = member.screen_x + ((rand(50) + 50) - rand(100))
enemy.screen_y = member.screen_y + ((rand(10) + 10) - rand(20))
enemy.on_battle_start
make_unique_names
SceneManager.scene.update_enemy_sprites
end
end
class Scene_Battle < Scene_Base
def update_enemy_sprites
@spriteset.add_new_enemies
@enemy_window.refresh
end
end




Add-On:

Code:
#==============================================================================
# ■ Meow Face Clone Enemy (Flip Battler Graphic Add-on)
#------------------------------------------------------------------------------
# Random flip cloned enemy
#==============================================================================
# Require:
# Meow Face Clone Enemy Script
# How to Use:
# [1] Put this script below Meow Face Clone Enemy Script
#==============================================================================
class Sprite_Battler < Sprite_Base
  alias meow_sp_update update
  def update
    self.mirror = battler.flip if @battler
    meow_sp_update
  end
end
class Game_Battler < Game_BattlerBase
  attr_accessor :flip
  alias meow_bat initialize
  def initialize
    meow_bat
    @flip = false
  end
end
class Game_Troop < Game_Unit
  def clone_enemy(clone)
    member = $game_troop.members[clone]
    return if !member.alive?
    return if members.size >= 8
    enemy = Game_Enemy.new(@enemies.size, member.enemy_id)
    members.push(enemy)
    enemy.screen_x = member.screen_x + ((rand(50) + 50) - rand(100))
    enemy.screen_y = member.screen_y + ((rand(10) + 10) - rand(20))
    enemy.on_battle_start
    make_unique_names
    SceneManager.scene.update_enemy_sprites
    enemy.flip = (rand(2) == 0 )
  end
end
 

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

Latest Threads

Latest Profile Posts

Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:

Forum statistics

Threads
105,854
Messages
1,017,004
Members
137,562
Latest member
tamedeathman
Top