08-26-2007, 01:00 PM
In-Battle HP/SP Regeneration
legend in his own mind
Aug 26 2007
I've been looking around for this, but I couldn't find any scripts for recovering in-battle... there were plenty for recovering on the map, but that's not what I wanted. (There might be one around but in my lazy searching I didn't find it :P)
Anywho, this script will allow players to recover HP, SP or both, if they use equipment that has that element on it.
i.e. a Shield that has the element 'HP Regen'
Instructions:
Make three elements:
- SP Regeneration
- HP Regeneration
- HP & SP Regeneration
(have to be in that order, but can be called anything)
Add these to the equipment that you want to allow you to regenerate and you're done (having more than one piece of equipment that regenerates doesn't change anything).
Conflict:
Not sure, possibly other Scene_Battle modifying scripts, like CBSs... like I said, I don't use them so I'm not sure. Meh.
Any probs, feel free to ask away, I'll try to get back to you ASAP with some kind of an answer.
Also, I'm working on a way to make this recover different amounts depending on the equipment, but thats just in the pipeline for now...
Cheers,
Jono.
legend in his own mind
Aug 26 2007
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
I've been looking around for this, but I couldn't find any scripts for recovering in-battle... there were plenty for recovering on the map, but that's not what I wanted. (There might be one around but in my lazy searching I didn't find it :P)
Anywho, this script will allow players to recover HP, SP or both, if they use equipment that has that element on it.
i.e. a Shield that has the element 'HP Regen'
Instructions:
Make three elements:
- SP Regeneration
- HP Regeneration
- HP & SP Regeneration
(have to be in that order, but can be called anything)
Add these to the equipment that you want to allow you to regenerate and you're done (having more than one piece of equipment that regenerates doesn't change anything).
Conflict:
Not sure, possibly other Scene_Battle modifying scripts, like CBSs... like I said, I don't use them so I'm not sure. Meh.
Code:
#-------------------------------------------------
#---- Scene_Battle addon : SP/HP regeneration ----
#-------------------------------------------------
# To use this script you need to make three elements, 'SP Regeneration'
# 'HP Regeneration' and 'HP & SP Regeneration'.
# Once you've made them, add them to any equipment that you want to regenerate
# and voila! You've got regenerating equipment!
#-------------------------------------------------
# Place this script below any other Scene_Battle modifying scripts, and the
# SDK, but... of course, above Main.
class Scene_Battle
# Aliases
alias lihom_mv main_variable
alias lihom_up3bc update_phase3_basic_command
def main_variable
# Original
lihom_mv
# New
@turn = []
for turn in 0...$game_party.actors.size
@turn.push(0)
end
end
def update_phase3_basic_command
# Original
lihom_up3bc
# New
unless @active_battler == nil
@actor = @active_battler
@actor_id = @actor.id
@equipment = []
@equipment.push($data_weapons[@actor.weapon_id]) if @actor.weapon_id != 0 #Weapon
@equipment.push($data_armors[@actor.armor1_id]) if @actor.armor1_id != 0 #Shield
@equipment.push($data_armors[@actor.armor2_id]) if @actor.armor2_id != 0 #Helm
@equipment.push($data_armors[@actor.armor3_id]) if @actor.armor3_id != 0 #Body
@equipment.push($data_armors[@actor.armor4_id]) if @actor.armor4_id != 0 #Accessory
for equip in @equipment
if equip.is_a?(RPG::Armor)
if equip.guard_element_set.include?(10) # change 10 to the SP regeneration element ID
if @turn[@actor_id-1] == $game_temp.battle_turn
@actor.sp = [(@actor.sp + (@actor.maxsp * 0.1).to_i), @actor.maxsp].min if not @actor.dead?
@status_window.refresh
@turn[@actor_id-1] += 1
end
elsif equip.guard_element_set.include?(11) # change 11 to the HP regeneration element ID
if @turn[@actor_id-1] == $game_temp.battle_turn
@actor.hp = [(@actor.hp + (@actor.maxhp * 0.05).to_i), @actor.maxhp].min if not @actor.dead?
@status_window.refresh
@turn[@actor_id-1] += 1
end
elsif equip.guard_element_set.include?(12) # change 12 to the HP & SP regeneration element ID
if @turn[@actor_id-1] == $game_temp.battle_turn
@actor.hp = [(@actor.hp + (@actor.maxhp * 0.05).to_i), @actor.maxhp].min if not @actor.dead?
@actor.sp = [(@actor.sp + (@actor.maxsp * 0.1).to_i), @actor.maxsp].min if not @actor.dead?
@status_window.refresh
@turn[@actor_id-1] += 1
end
end
elsif equip.is_a?(RPG::Weapon)
if equip.element_set.include?(10) # change 10 to the SP regeneration element ID
if @turn[@actor_id-1] == $game_temp.battle_turn
@actor.sp = [(@actor.sp + (@actor.maxsp * 0.1).to_i), @actor.maxsp].min if not @actor.dead?
@status_window.refresh
@turn[@actor_id-1] += 1
end
elsif equip.element_set.include?(11) # change 11 to the HP regeneration element ID
if @turn[@actor_id-1] == $game_temp.battle_turn
@actor.hp = [(@actor.hp + (@actor.maxhp * 0.05).to_i), @actor.maxhp].min if not @actor.dead?
@status_window.refresh
@turn[@actor_id-1] += 1
end
elsif equip.element_set.include?(12) # change 12 to the HP & SP regeneration element ID
if @turn[@actor_id-1] == $game_temp.battle_turn
@actor.hp = [(@actor.hp + (@actor.maxhp * 0.05).to_i), @actor.maxhp].min if not @actor.dead?
@actor.sp = [(@actor.sp + (@actor.maxsp * 0.1).to_i), @actor.maxsp].min if not @actor.dead?
@status_window.refresh
@turn[@actor_id-1] += 1
end
end
end
end
end
end
end
Any probs, feel free to ask away, I'll try to get back to you ASAP with some kind of an answer.
Also, I'm working on a way to make this recover different amounts depending on the equipment, but thats just in the pipeline for now...
Cheers,
Jono.