Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ==============================================================================
- # ▼▼▼▼▼▼ TroyZ - Skill HP Cost ▼▼▼▼▼▼
- # ==============================================================================
- # Script by : Agung Prasetyo(TroyZ)
- # Contact me by : - Email agung.endisnear.xyz@gmail.com
- # - Forum RPGMakerID, username TroyZ
- # - Handphone 085756289121
- # Engine : VXAce
- # Level : Normal
- # Version : 1.0
- # ------------------------------------------------------------------------------
- # Change Logs :
- # 29 Mei 2013 - Rilis script versi 1.0
- # ------------------------------------------------------------------------------
- # How this work :
- # Dengan script ini kamu bisa memasang HP sebagai cost dari sebuah skill. Cocok
- # untuk petarung dengan HP yang tebal yang biasanya kurang mendapatkan MP.
- # ------------------------------------------------------------------------------
- # How to use :
- # Pasang dibawah material dan diatas main. Untuk menggunakan HP sebagai cost dari
- # sebuah skill, tuliskan seperti ini di notetag dari skill tersebut :
- # <hp cost: x>
- # Dimana x adalah cost dari HP itu sendiri. Contohnya :
- # <hp cost: 50>
- # Maka setiap kali menggunakan skill tersebut, 50 HP akan terkuras dari battler
- # tersebut. Jika battler memiliki HP tersisa sama dengan HP cost skill tersebut,
- # skill tersebut tidak bisa digunakan.
- # ------------------------------------------------------------------------------
- # Who to credit :
- # - Allah swt. : Untuk kesempatan ke rahmat yang sudah Dia berikan.
- # - Nabi Muhammad saw. : Yang sudah menjadi pemimpin umat yang menurut saya PERFECT.
- # Saya bangga jadi umatmu. :)
- # - Agung Prasetyo(TroyZ) : Ya saya, yang buat script kan saya. :P
- # - Tio Allin Subiantoro(Theo Allen) : Thankz buat petunjuk notetagnya. :v
- # ------------------------------------------------------------------------------
- # License :
- # - Free Game : Silahkan dengan syarat credit diatas dicantumkan.
- # - Commercial Game : Syarat yang sama dengan Free Game + game komersilnya yang
- # full versi diberikan secara gratis untuk saya. :P
- # ------------------------------------------------------------------------------
- $imported = {} if $imported.nil?
- $imported[:TroyZ_SkillHPCost] = true
- module TROYZ
- module HP_COST
- HP_COST_DEFAULT = 0 # HP Cost skill yang tidak punya notetag <hp cost: x>
- end
- # XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- # BATAS KONFIGURASI. DILARANG MELEWATI GARIS INI
- # XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- module NOTETAGS_HP_COST
- HP_COST = /<(?:HP COST|hp cost):[ ]*(\d+)>/i
- end
- end
- module DataManager
- class << self
- alias x_load_hp_cost_dbase_x load_database
- end
- def self.load_database
- x_load_hp_cost_dbase_x
- x_pake_hp_cost_notetags_x
- end
- def self.x_pake_hp_cost_notetags_x
- [$data_skills].each do |skills|
- skills.each do |obj|
- next unless obj
- obj.x_pake_hp_cost_notetags_x
- end
- end
- end
- end
- class RPG::Skill
- attr_accessor :hp_cost
- alias x_init_x initialize
- def initialize
- x_init_x
- @hp_cost = TROYZ::HP_COST::HP_COST_DEFAULT
- end
- def x_pake_hp_cost_notetags_x
- @hp_cost = TROYZ::HP_COST::HP_COST_DEFAULT
- self.note.split(/[\r\n]+/).each { |baris|
- case baris
- when TROYZ::NOTETAGS_HP_COST::HP_COST
- @hp_cost = $1.to_i
- end
- }
- end
- end
- class Game_BattlerBase
- def skill_hp_cost(skill)
- skill.hp_cost
- end
- def skill_cost_payable?(skill)
- tp >= skill_tp_cost(skill) && mp >= skill_mp_cost(skill) && hp > skill_hp_cost(skill)
- end
- alias x_bayar_skill_x pay_skill_cost
- def pay_skill_cost(skill)
- x_bayar_skill_x(skill)
- self.hp -= skill_hp_cost(skill)
- end
- end
- class Window_SkillList < Window_Selectable
- def draw_skill_cost(rect, skill)
- if @actor.skill_tp_cost(skill) > 0
- change_color(tp_cost_color, enable?(skill))
- draw_text(rect, @actor.skill_tp_cost(skill), 2)
- elsif @actor.skill_mp_cost(skill) > 0
- change_color(mp_cost_color, enable?(skill))
- draw_text(rect, @actor.skill_mp_cost(skill), 2)
- elsif @actor.skill_hp_cost(skill) > 0
- change_color(hp_cost_color, enable?(skill))
- draw_text(rect, @actor.skill_hp_cost(skill), 2)
- end
- end
- end
- class Window_Base < Window
- def hp_cost_color
- text_color(2)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement