Maraki Novice
Messages : 39 Date d'inscription : 09/10/2011 Age : 27 Localisation : Marmande
| Sujet: plein d'ennemie contre nous Dim 20 Nov - 14:08 | |
| Script : Enemy summon Skill Auteur : modern algebra Screen : Script : - Spoiler:
#============================================================================== # 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. "=end" 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 = 9999 # 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
Utilisation : créer un compétence avec dans la case commentaire : \SUMMON_ENEMY[enemy_id, x, y, chance] enemy_id = id du monstre à appeler x = position y = idem chance = % de chance que le monstre arrive ex : 3 = 25% note : 1 = 100% Le nombre de monstre appelée peut-être modifier à la ligne : 62 | |
|