privateer Novice
Posts : 253 Thanked : 1 Engine : RMXP Skill : Advanced Type : Scripter
| Subyek: [PSS]DefendRecover 2012-05-06, 11:03 | |
| [PSS]DefendRecover Versi: 1.0 Tipe: Custom Battle Add-on PengenalanIni hasil kerja saya selama 1 jam... Fungsi si script banyak direferensikan oleh KGC Fitur
- Bilinggual Edition
- Restorasi HP/SP jika unit ngedefend
ScreenshotsGak perlu.... DemoGak Perlu... Scripts - Code:
-
#============================================================================== # ** Defend Recover # ** Version : 1.0 # ** Author : privateer #------------------------------------------------------------------------------ # ** Category : Custom Battle Add-on # ** Date Created : 06/05/2012 #------------------------------------------------------------------------------ # * INTRODUCTION # A script based on my curiosity in the world of RGSS # Functions reference by KGC #------------------------------------------------------------------------------ # * FUNCTION # Units who used "Defend" command will recover their HP/SP. # Hero yang nge-defend akan merecover HP/SPnya #------------------------------------------------------------------------------ # * INSTRUCTION # Plug'N'Play, please read the instructions in the comment! # # This work is protected by the following license: # #---------------------------------------------------------------------------- # # # # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported # # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ ) # # # # You are free: # # # # to Share - to copy, distribute and transmit the work # # to Remix - to adapt the work # # # # Under the following conditions: # # # # Attribution. You must attribute the work in the manner specified by the # # author or licensor (but not in any way that suggests that they endorse you # # or your use of the work). # # # # Noncommercial. You may not use this work for commercial purposes. # # # # Share alike. If you alter, transform, or build upon this work, you may # # distribute the resulting work only under the same or similar license to # # this one. # # # # - For any reuse or distribution, you must make clear to others the license # # terms of this work. The best way to do this is with a link to this web # # page. # # # # - Any of the above conditions can be waived if you get permission from the # # copyright holder. # # # # - Nothing in this license impairs or restricts the author's moral rights. # # # #---------------------------------------------------------------------------- # $imported = {} if $imported == nil $imported["PSS_DR"] = true #============================================================================== # ** CONFIGURATION START! START CONFIGURING HERE! #============================================================================== module PSS_DR # Default HP rate percentage value for actors # Persentase default untuk HP aktor DEFAULT_ACTOR_HP_RATE = 10 # Default SP rate percentage value for actors # Persentase default untuk SP aktor DEFAULT_ACTOR_SP_RATE = 10 # Default HP rate percentage value for enemies # Persentase default untuk HP musuh DEFAULT_ENEMY_HP_RATE = 5 # Default SP rate percentage value for enemies # Persentase default untuk SP musuh DEFAULT_ENEMY_SP_RATE = 5 ################################################################################ # Custom Unit HP/SP Restoration Rate ################################################################################ # Don't remove this line! CUSTOM_ACTOR_RESTORATION_RATE = {} CUSTOM_ENEMY_RESTORATION_RATE = {} # Don't remove this line! ############################################################################## # Custom Unit Restoration Rate : # CUSTOM_ACTOR_RESTORATION_RATE[unit_id] = [hp_rate, sp_rate] for actors. # CUSTOM_ENEMY_RESTORATION_RATE[unit_id] = [hp_rate, sp_rate] for enemies. # For unlisted units, they will automatically use the DEFAULT_UNIT_RATE value. ############################################################################## CUSTOM_ACTOR_RESTORATION_RATE[2] = [15, 15] CUSTOM_ENEMY_RESTORATION_RATE[1] = [7, 7] end #============================================================================== # ** CONFIGURATION END! DON'T EDIT FURTHER UNLESS YOU KNOW WHAT YOU ARE DOING! #============================================================================== # #============================================================================== # â– Scene_Battle (part 4) #==============================================================================
class Scene_Battle include PSS_DR #-------------------------------------------------------------------------- # â—Ź Create Basic Action Result #-------------------------------------------------------------------------- alias make_basic_action_result_PSS_DR make_basic_action_result def make_basic_action_result # Perform the original method make_basic_action_result_PSS_DR # Checking the battler's action if @active_battler.current_action.kind == 0 && @active_battler.current_action.basic == 1 # Calculating recovery rate if @active_battler.is_a?(Game_Actor) && CUSTOM_ACTOR_RESTORATION_RATE.include?(@active_battler.id) defend_recover(CUSTOM_ACTOR_RESTORATION_RATE[@active_battler.id][0], CUSTOM_ACTOR_RESTORATION_RATE[@active_battler.id][1]) elsif @active_battler.is_a?(Game_Actor) && !CUSTOM_ACTOR_RESTORATION_RATE.include?(@active_battler.id) defend_recover(DEFAULT_ACTOR_HP_RATE, DEFAULT_ACTOR_SP_RATE) elsif @active_battler.is_a?(Game_Enemy) && CUSTOM_ENEMY_RESTORATION_RATE.include?(@active_battler.id) defend_recover(CUSTOM_ENEMY_RESTORATION_RATE[@active_battler.id][0], CUSTOM_ENEMY_RESTORATION_RATE[@active_battler.id][1]) else defend_recover(DEFAULT_ENEMY_HP_RATE, DEFAULT_ENEMY_SP_RATE) end end end def defend_recover(hp_rate, sp_rate) recover_hp = @active_battler.maxhp * hp_rate / 100 recover_sp = @active_battler.maxsp * sp_rate / 100 @active_battler.damage = "#{$data_system.words.hp} + #{recover_hp} #{$data_system.words.sp} + #{recover_sp}" @active_battler.hp += recover_hp @active_battler.sp += recover_sp # Display the recovered HP/SP @target_battlers |= [@active_battler] end end
Credits | |
|
Kuru Senior
Posts : 985 Thanked : 9 Engine : RMVX Skill : Beginner Type : Writer
Trophies
Awards:
| Subyek: Re: [PSS]DefendRecover 2012-05-06, 14:32 | |
| Wah Keren kayak game "Legend of Dragoon" dong. Defend terus kalau mau recovery, jadi nggak perlu makai potion . Sip | |
|