Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.
Original Source
- Original title: KWeaponDamage XP
- Original author: kyonides
- Original date: May 17, 2023
- Source thread: https://forums.rpgmakerweb.com/threads/kweapondamage-xp.157604/
- Source forum path: Game Development Engines > Ruby Game System (RGSS) Scripts > RGSS Scripts (RMXP)
Summary
KWeaponDamage XP by Kyonides Introduction Did you ever dream about making a weapon heal your comrades instead of hitting the foe?
Archived First Post
KWeaponDamage XP
by Kyonides
by Kyonides
Introduction
Did you ever dream about making a weapon heal your comrades instead of hitting the foe?
Or did you ever want to hit your foes harder than usual?
Now you can do that!
You just need to make a few script calls to bless a specific actor with any of those new abilities.
The Script
Ruby:
# * KWeaponDamage XP * #
# Scripter : Kyonides Arkanthes
# v1.1.0 - 2023-05-19
# This scriptlet allows you to either consume some SP while attacking
# your enemy physically or hit an ally, partially healing him or her
# in the process.
# It also features the vampiric weapons that drain part of your hero's HP
# in order to hit the enemy (way) harder than usual.
# * Script Calls * #
# - First Step: Find an Actor - 2 Methods
# actor = $game_actors[ActorID]
# actor = $game_party.actors[Index]
# - Make a Weapon Consume SP for Extra Damage
# actor.weapon_sp_use(WeaponID, SP, Percent)
# - Weapon No Longer Consumes SP
# actor.weapon_no_sp(WeaponID)
# - Clear All Weapons that Consume SP
# actor.clear_weapon_sp
# - Add a Weapon Blessing
# actor.bless_weapon(WeaponID, Percent)
# - Remove a Weapon Blessing
# actor.unbless_weapon(WeaponID)
# - Clear All Blessed Weapons
# actor.clear_weapon_blessing
# - Add a Vampiric Weapon
# actor.vampire_weapon(WeaponID, HP's, Extra DMG %)
# - Remove a Vampiric Weapon
# actor.no_vampire_weapon(WeaponID)
# - Clear All Vampiric Weapons
# actor.clear_vampire_weapons
class Game_Battler
DMG_MISSED = "Miss"
alias :kyon_weapon_dmg_gm_btlr_attack_fx :attack_effect
def attack_effect(attacker)
result = kyon_weapon_dmg_gm_btlr_attack_fx(attacker)
calculate_new_weapon_damage(attacker)
result
end
def calculate_new_weapon_damage(attacker)
return if @damage == DMG_MISSED
if attacker.weapon_sp_use?
total_sp = attacker.get_weapon_sp_cost
return if @sp < total_sp
attacker.sp -= total_sp
new_damage = @damage * attacker.weapon_sp_percent / 100
@damage += new_damage if @hp > 0
self.hp -= new_damage
return
elsif attacker.weapon_blessing?
@damage = -@damage - @damage * attacker.weapon_blessing / 100
dead_no_damage
self.hp -= @damage
return
elsif attacker.vampire_weapon?
attacker.vampire_weapon_hp_cost
dead_no_damage
self.hp -= @damage * attacker.vampire_weapon_dmg / 100
end
end
def dead_no_damage
@damage = 0 if self.maxhp == @hp
end
end
module GameBattlerTest
def actor?
@actor_id != nil
end
def enemy?
@enemy_id != nil
end
end
class Game_Actor
include GameBattlerTest
alias :kyon_weapon_dmg_gm_act_setup :setup
def setup(actor_id)
kyon_weapon_dmg_gm_act_setup(actor_id)
@weapon_use_sp = {}
@weapon_blessings = {}
@vampire_weapons = {}
@vampire_weapons.default = { :hp => 0, :dmg => 0 }
end
def weapon_sp_use(weapon_id, cost, percent)
@weapon_use_sp[weapon_id] = { :sp => cost, :percent => percent }
end
def weapon_no_sp(weapon_id)
@weapon_use_sp.delete(weapon_id)
end
def weapon_sp_cost
@weapon_use_sp[@weapon_id][:sp]
end
def weapon_sp_percent
@weapon_use_sp[@weapon_id][:percent]
end
def get_weapon_sp_cost
self.weapon_sp_cost * self.maxsp / 100
end
def clear_weapon_sp
@weapon_use_sp.clear
end
def weapon_sp_use?
@weapon_use_sp.has_key?(@weapon_id)
end
def bless_weapon(weapon_id, percent)
@weapon_blessings[weapon_id] = percent
end
def unbless_weapon(weapon_id)
@weapon_blessings.delete(weapon_id)
end
def weapon_blessing
@weapon_blessings[@weapon_id]
end
def clear_weapon_blessing
@weapon_blessings.clear
end
def weapon_blessing?
@weapon_blessings.has_key?(@weapon_id)
end
def vampire_weapon(weapon_id, hp_cost, dmg_percent)
@vampire_weapons[weapon_id] = { :hp => hp_cost, :dmg => dmg_percent }
end
def no_vampire_weapon(weapon_id)
@vampire_weapons.delete(weapon_id)
end
def clear_vampire_weapons
@vampire_weapons.clear
end
def vampire_weapon_hp_cost
self.hp -= @vampire_weapons[@weapon_id][:hp]
end
def vampire_weapon_dmg
@vampire_weapons[@weapon_id][:dmg]
end
def vampire_weapon?
@vampire_weapons.has_key?(@weapon_id)
end
attr_reader :weapon_use_sp, :weapon_blessings, :vampire_weapons
end
class Game_Enemy
include GameBattlerTest
def weapon_sp_use?() nil end
def weapon_blessing?() nil end
end
class Scene_Battle
alias :kyon_weapon_dmg_scn_btl_up_ph3_bsc_comm :update_phase3_basic_command
alias :kyon_weapon_dmg_scn_btl_mk_bsc_action_res :make_basic_action_result
def update_phase3_basic_command
if Input.trigger?(Input::C) and @actor_command_window.index == 0
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
blessed = @active_battler.weapon_blessing?
blessed ? start_actor_select : start_enemy_select
return
end
kyon_weapon_dmg_scn_btl_up_ph3_bsc_comm
end
def make_altered_weapon_attack_result
return unless @active_battler.weapon_blessing?
@animation1_id = @active_battler.animation1_id
@animation2_id = @active_battler.animation2_id
if @active_battler.restriction == 3
target = $game_party.random_target_actor
elsif @active_battler.restriction == 2
target = $game_troop.random_target_enemy
else
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
end
return unless target
target.attack_effect(@active_battler)
@target_battlers = [target]
true
end
def make_basic_action_result
if @active_battler.current_action.basic == 0
if @active_battler.actor?
result = make_altered_weapon_attack_result
return if result
end
end
kyon_weapon_dmg_scn_btl_mk_bsc_action_res
end
end
DOWNLOAD DEMO
Terms & Conditions
Free for use in any game.
Include my nickname in your game credits.
Don't adopt any stray cats or blue squirrels or any kind of pokemon!
That's it!
Downloads / Referenced Files
Log in to download
Log in, then follow the RPG Maker Developers Group to see these download links.
Log in to downloadLicense / Terms Note
Include my nickname in your game credits. Don't adopt any stray cats or blue squirrels or any kind of pokemon! That's it!
Creator Claims / Removal
If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.
Replies (0)
No replies yet.
0
replies
1
view
Topic Summary
Loading summary...