O TEMA DO FÓRUM ESTÁ EM MANUTENÇÃO. FEEDBACKS AQUI: ACESSAR

Script de Overkill

Iniciado por LoboShow, 06/12/2012 às 17:17

Script de Overkill

Compativel com: RMVX
Compatibilidade : ?
Facilidade de uso: ?
Lag gerado: ?

[box class=titlebg]
Para que serve o script
[/box]
Esse script, acredito eu, foi baseado num sistema parecido usado no Final Fantasy X.  Quando o jogador tirar mais do que um dano necessário para matar um certo monstro, ele ganha mais EXP.  Exemplo: Para matar o monstro, preciso de um ataque que cause 50HP, mas eu tiro 70, e isso é um Overkill.

[box class=titlebg]
Script
[/box]
###############################################################################
# Script: Overkill
# Version: 1 (28/8/08)
# Author: uresk (AKA 332211)
###############################################################################
#==============================================================================
# ** Module Overkill
#------------------------------------------------------------------------------
# Configuration
#
# Overkill_HP = {enemy_id => negative hp for overkill, ...}
#
# Overkill_text = "message for overkill when enemy dies"
# apears only when you overkill one enemy
#
# Overkill_Bonus_End = "message shown in the battle end before Exp and Gol gain"
#==============================================================================

module Overkill

Overkill_HP = {1 => 500, 2 => 10}

Overkill_text = "OVERKILL!!"

Overkill_Bonus_End = "Gained double Exp and %s for Overkill."
# %s = game currency

end


#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass of the Game_Actor
# and Game_Enemy classes.
#==============================================================================

class Game_Battler
#--------------------------------------------------------------------------
# * aliasing Change HP method
#--------------------------------------------------------------------------
alias overkill_hp hp=
#--------------------------------------------------------------------------
# * Change HP
# hp : new HP
#--------------------------------------------------------------------------
def hp=(hp)
self.dying_hp = hp unless self.actor?
overkill_hp(hp)
end
end


#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
# This class handles enemy characters. It's used within the Game_Troop class
# ($game_troop).
#==============================================================================

class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables (new)
#--------------------------------------------------------------------------
attr_accessor:overkill
attr_accessor:dying_hp
#--------------------------------------------------------------------------
# * aliasing Object Initialization
#--------------------------------------------------------------------------
alias overkill_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
# index : index in troop
# enemy_id : enemy ID
#--------------------------------------------------------------------------
def initialize(index, enemy_id)
overkill_initialize(index, enemy_id)
@overkill = false
@dying_hp = 0
end
end

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================

class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * include module Overkill
#--------------------------------------------------------------------------
include Overkill
#--------------------------------------------------------------------------
# * aliasing display_added_states method
#--------------------------------------------------------------------------
alias overkill_display_added_states display_added_states
#--------------------------------------------------------------------------
# * Show Added State
# target : Target
# obj : Skill or item
#--------------------------------------------------------------------------
def display_added_states(target, obj = nil)
overkill_display_added_states(target, obj = nil)
overkill(target) if target.actor? == false and target.dead?
end
#--------------------------------------------------------------------------
# * Overkill * checks for overkill
# target : Target
#--------------------------------------------------------------------------
def overkill(target)
if Overkill_HP[target.enemy_id] != nil # if there is a set Hp for overkill
dhp = 0
dhp -= target.dying_hp # get dying_hp
required_damage = Overkill_HP[target.enemy_id] # get required Hp for overkill
target.overkill = true if dhp >= required_damage # compare dying_hp with required hp
end
if target.overkill # show overkill in battle message
text = sprintf(Overkill::Overkill_text)
@message_window.add_instant_text(text)
end
end
#--------------------------------------------------------------------------
# * aliasing display_exp_and_gold method
#--------------------------------------------------------------------------
alias overkill_display_exp_and_gold display_exp_and_gold
#--------------------------------------------------------------------------
# * Display Gained Experience and Gold (overwriten)
#--------------------------------------------------------------------------
def display_exp_and_gold
exp = $game_troop.exp_total
gold = $game_troop.gold_total
for enemy in $game_troop.members # check all the enemies
next unless enemy.overkill # if one of the was overkilled
exp *= 2 # gain double exp
gold *= 2 # gain double gold
text = sprintf(Overkill::Overkill_Bonus_End,Vocab.gold) #show overkill
$game_message.texts.push('\|' + text) # bonus message (battle end)
break
end
$game_party.gain_gold(gold)
text = sprintf(Vocab::Victory, $game_party.name)
$game_message.texts.push('\|' + text)
if exp > 0
text = sprintf(Vocab::ObtainExp, exp)
$game_message.texts.push('\.' + text)
end
if gold > 0
text = sprintf(Vocab::ObtainGold, gold, Vocab::gold)
$game_message.texts.push('\.' + text)
end
wait_for_message
end
end


[box class=titlebg]
Imagens
[/box]

[box class=titlebg]
Créditos e Avisos
[/box]
Criador : Uresk