Main Menu
  • Welcome to The RPG Maker Resource Kit.

Enemy Summon Skill

Started by modern algebra, May 08, 2010, 02:33:07 PM

0 Members and 1 Guest are viewing this topic.

modern algebra

Enemy Summon Skill
Version: 1.0
Author: modern algebra
Date: May 8, 2010

Version History




  • <Version 1.0> 05.08.2010 - Original Release

Description



This script allows you to make skills for enemies where they can summon or call additional enemies to the battlefield. This is NOT a summon skill that can be used by actors - it can ONLY be used by enemies.

Features


  • Allows you to create skills that allow enemies to summon extra enemies to the battlefield
  • Fairly easy to configure with lots of options for use.
  • Can make the same skill summon different kinds of enemies.

Screenshots



Instructions

Please see the header for instructions on how to use.

Script




#==============================================================================
#    Enemy Summon Skill
#    Version: 1.0
#    Author: modern algebra (rmrk.net)
#    Date: May 8, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This script allows you to make skills for enemies where they can summon or
#   call additional enemies to the battlefield. This is NOT a summon skill that
#   can be used by actors - it can ONLY be used by enemies.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Place this script above Main and below Materials in its own slot in the
#   Script Editor (F11).
#
#    You can set up some basic configuration options at line 52. Please see the
#   surrounding comments to see what each does.
#
#    To create a summoning skill (again, this skill can ONLY be used by
#   enemies), all you need to do is put the following code (can be changed at
#   line 69 if you desire):
#
#      \SUMMON_ENEMY[enemy_id, x, y, chance]
#        enemy_id : the ID of the enemy it can summon
#        x : the additional pixels along the axis the summoned creature is from
#          its summoner. If omitted, it defaults to the value at line 64.
#        y : the additional pixels along the axis the summoned creature is from
#          its summoner. If omitted, it defaults to the value at line 67.
#        chance: of the potential candidates for summoning, how likely this one
#          will be chosen over the others. If omitted, this defaults to 1.
#
#    As you can probably tell, you can place a number of these codes in the
#   same notebox and thus you can make the same skill potentially summon
#   different enemies, and you can control that through the chance.
#
#  EXAMPLES:
#
#    A skill with its notebox set up like this:
#      \summon_enemy[1, 35, 45, 3]
#      \summon_enemy[2, 25, 35, 1]
#
#  Would, when it succeeds (which is governed directly by the hit ratio of the
# skill) summon the enemy with ID 1 (Default: Slime) 75% of the time and the
# enemy with ID 2 (Default: Bat) 25% of the time, and the position, if it is
# a slime would be 35 pixels to the right of the summoner and 45 pixels down,
# or if it is the bat, then 25 pixels to the right of the summoner and 35
# pixels down. The chances are 75-25 because 3 + 1 = 4, which means that 3/4
# times the slime will be summoned and 1/4 times the bat will be summoned.
#==============================================================================
#  CONFIGURATION
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new constant - MAES_VOCAB_SUMMON_FAILURE; MAES_MAX_TROOP_SIZE;
#      MAES_DEFAULT_X_PLUS; MAES_DEFAULT_Y_PLUS; MAES_NOTECODE
#==============================================================================
# Message shown when a summon skill fails.
MAES_VOCAB_SUMMON_FAILURE = "%s failed to summon ally!"
# The maximum number of enemies in a troop (caps number of summons permitted)
MAES_MAX_TROOP_SIZE = 8
# The default x offset for a summoned enemy from its summoner. If you manually
#  set this in the note box, this value will not be used.
MAES_DEFAULT_X_PLUS = 35
# The default y offset for a summoned enemy from its summoner. If you manually
#  set this in the note box, this value will not be used.
MAES_DEFAULT_Y_PLUS = 25
# This is the label code you need to put into a notebox. It is RegExp
MAES_NOTECODE = "\\SUMMON_ENEMY"

#==============================================================================
#  ** RPG::Skill
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new methods - ma_call_ally?; ma_call_ally
#==============================================================================

class RPG::Skill
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # * Call Ally Skill?
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 def ma_call_ally?
   return self.note[/#{MAES_NOTECODE}\[\d+.*?\]/i] != nil
 end
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # * Call Ally Stats
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 def ma_call_ally
   miss = rand (100)
   return nil if self.hit < miss
   possibilities = []
   note = self.note.dup
   note.gsub! (/#{MAES_NOTECODE}\[(\d+)[,;]?\s*(-?\d*)[,;]?\s*(-?\d*)[,;]?\s*(\d*)\]/i) { |match|
     id = $1.to_i
     x = $2.empty? ? MAES_DEFAULT_X_PLUS : $2.to_i
     y = $3.empty? ? MAES_DEFAULT_Y_PLUS : $3.to_i
     percent = $4.empty? ? 1 : $4.to_i
     (percent).times do possibilities.push ([id, x, y]) end
     ""
   }
   return *possibilities[rand(possibilities.size)]
 end
end

#==============================================================================
# ** Game Enemy
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    attr_accessor - summon_count
#    aliased method - initialize, skill_can_use?
#==============================================================================

class Game_Enemy
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # * Public Instance Variables
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 attr_accessor :ma_summon_count
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # * Object Initialization
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 alias moda_clally_intz_7uj2 initialize
 def initialize (*args)
   @ma_summon_count = 0
   moda_clally_intz_7uj2 (*args) # Run Original Method
 end
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # * Skill Can Use?
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 alias moral_caly_skllcnuse_6yh1 skill_can_use?
 def skill_can_use? (skill, *args)
   return false if skill.ma_call_ally? && $game_troop.members.size >= MAES_MAX_TROOP_SIZE
   return moral_caly_skllcnuse_6yh1 (skill, *args)
 end
end

#==============================================================================
# ** Game_Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - skill_can_use?
#==============================================================================

class Game_Actor
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # * Skill Can Use?
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 alias modbr_ess_skcnuse_7uj2 skill_can_use?
 def skill_can_use? (skill, *args)
   return false if skill.ma_call_ally?
   return modbr_ess_skcnuse_7uj2 (skill, *args)
 end
end

#==============================================================================
# ** Game Troop
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - ma_call_ally
#==============================================================================

class Game_Troop
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # * Call Ally
 #    user     : the enemy using the skill
 #    enemy_id : the ID of the enemy being summoned
 #    x, y     : screen coordinates to display enemy
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 def ma_call_ally (user, enemy_id, x, y)
   user.ma_summon_count += 1
   enemy = Game_Enemy.new (@enemies.size, enemy_id)
   good_position = false
   while !good_position
     enemy.screen_x = user.screen_x + (x*user.ma_summon_count)
     enemy.screen_y = user.screen_y + (y*user.ma_summon_count)
     good_position = true
     @enemies.each { |baddie|
       if baddie.screen_x == enemy.screen_x && baddie.screen_y == enemy.screen_y
         user.ma_summon_count += 1
         good_position = false
       end
     }
   end
   @enemies.push(enemy)
   make_unique_names
   return enemy
 end
end

#==============================================================================
# ** Spriteset_Battle
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - ma_call_enemy
#==============================================================================

class Spriteset_Battle
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # * Call Enemy
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 def ma_call_enemy (battler)
   @enemy_sprites.push(Sprite_Battler.new(@viewport1, battler))
 end
end

#==============================================================================
# ** Scene_Battle
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - execute_action_skill
#==============================================================================

class Scene_Battle
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # * Execute Action Skill
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 alias malb_callally_exactsk_5hy1 execute_action_skill
 def execute_action_skill (*args)
   skill = @active_battler.action.skill
   if skill.ma_call_ally?
     enemy_id, x, y = skill.ma_call_ally
     if enemy_id.nil?
       text = sprintf (MAES_VOCAB_SUMMON_FAILURE, @active_battler.name)
       @message_window.add_instant_text(text)
       wait (30)
       return
     else
       target = $game_troop.ma_call_ally (@active_battler, enemy_id, x, y)
       @spriteset.ma_call_enemy (target)
       display_animation([target], skill.animation_id)
     end
   end
   malb_callally_exactsk_5hy1 (*args) # Run Original Method
 end
end


Credit




  • modern algebra

Thanks


  • Skies of Arcadia, for the idea

Support



Please post in this topic at RMRK for support.

Known Compatibility Issues

No currently known incompatibility issues, but I suspect it will be incompatible with most custom battle scenes that deviate significantly from the default.

Demo



Please see attached demo.

Author's Notes



Just playing Skies of Arcadia, and liked this ability that some enemies would have. Also, I realize that this effect can be done with events, but I figure it is a lot easier to do with a script and can be a little more random as well, which is a good thing.

Zylos

Uh oh, monster breeding. o_o *flees*




Cascading Dragon

Just wondering, but if I edited this script to make it compatible with Yanfly's Melody Battle System, should I send you the edit for you to post on here?

Zero2008

OMG Modern this looks PERFECT!
This will go perfectly with my EarthBound game! Thanks!

modern algebra

Quote from: redyugi on May 08, 2010, 04:06:29 PM
Just wondering, but if I edited this script to make it compatible with Yanfly's Melody Battle System, should I send you the edit for you to post on here?

No, you don't need to. I would appreciate if you posted it in this thread so that other people could find it, but no, you can do with it as you like.

LuKo

great Algebra, another cool and uncommon script^^

This give an really coll addiction to the battle.

Nice job^^

cozziekuns

This script looks awesome, though I thought the script could allow you to change the hue of the monster summoned -.-

It's still cool.

Grafikal

You could always summon the same monsters with a different hue. The only difference is that you'd have to make it a separate enemy in the database instead of coping an existing one and changing the color via the script.

cozziekuns

That would work, but it'd clog up some monster space. Oh well, the give us 1000 spaces, so I guess making hue recolours wouldn't hurt.



Grafikal

Quote from: cozziekuns on May 09, 2010, 11:30:16 PM
That would work, but it'd clog up some monster space. Oh well, the give us 1000 spaces, so I guess making hue recolours wouldn't hurt.

lol. I generally make hue adjustments to enemies for new monsters. So instead of having 100 different monsters, it's much easier to have only 50, then having 50 recolors of them all representing a 'more powerful' version of the one before it - or something similar.

thanatos2k1

Ok, so this looks like its nearly what I need, especially what I saw with the slimes..  Now, what I want to do is if an actor uses slash or pierce weapons to a slime it splits and the hp of the original is halfed with the new one.

So, if Slime A has 62 HP and an actor hits it:

"The slime has split in half, spawning a new slime!"

Now there is 2 slimes, A + B and they both have 31HP.

Can this be done with this script?

Mr G W

theres a small issue, if the summoner keeps summoning new monsters they eventually start appearing offscreen, even if you kill the older ones.

bdcam

Can this be used with ABS 9?

DoctorTodd

I know your new so you should probably read the rules first because that was a pretty big necropost. Any way I positive it won't unless you basically rewrote it.
Quote from: modern algebra on May 08, 2010, 02:33:07 PM
Known Compatibility Issues
No currently known incompatibility issues, but I suspect it will be incompatible with most custom battle scenes that deviate significantly from the default.



modern algebra

It's actually OK to necro resource topics when it's on topic, but DoctorTodd is right that it won't work with any ABS. Depending on the nature of the ABS though, I would suspect that it would be possible to do something similar through eventing.

pacdiggity

Hey MA, would it be cool with you if I ported this to VXA? It seems like a pretty easy port, I'm bored, and it's a cool script.
I know that you're gradually converting some of your scripts, but I thought you could use a hand in the process :D
it's like a metaphor or something i don't know

modern algebra


Darkrai1276

very nice, coud defently get some use out of this, very good for enemy's that can multiply and is excellent move for my fina boss
i give it a 9/10= perfect

The last supper, depicted as said in the pokebible