I was just wondering if anybody has a script that whenever a character defends it would regenerate a certain amount of SP. Thanks in advance.
Give me about 10-15 minutes and I should have something that works.
Put this above main and below Scene_Battle. Change 0.1 to whatever decimal you want to be restored. The default is 10% aka 0.1
class Scene_Battle
alias shinami_make_basic_action_result make_basic_action_result
def make_basic_action_result
if @active_battler.current_action.basic == 1
sp_regain = $game_actors[@active_battler.id].maxsp * 0.1
$game_actors[@active_battler.id].sp += sp_regain.to_i
end#of "if @active_battler.current_action.basic == 1"
shinami_make_basic_action_result
end#of aliased "def make_basic_action_result"
end
If you were make the code:
class Scene_Battle
alias shinami_make_basic_action_result make_basic_action_result
def make_basic_action_result
if @active_battler.current_action.basic == 1
sp_regain = $game_actors[@active_battler.id].maxsp * $game_variables[id#]
$game_actors[@active_battler.id].sp += sp_regain.to_i
end#of "if @active_battler.current_action.basic == 1"
shinami_make_basic_action_result
end#of aliased "def make_basic_action_result"
end
Where you change "id#" with the ID number of a variable, would it take that and use it as a multiplier? If so, you can use it so you change the variable and the amount of SP recovered increases when you raise the variable so quests = more SP regen. ;D
Thanks.
Quote from: Jae Young on May 27, 2007, 12:19:15 AM
Where you change "id#" with the ID number of a variable, would it take that and use it as a multiplier? If so, you can use it so you change the variable and the amount of SP recovered increases when you raise the variable so quests = more SP regen. ;D
You would probably have to use a call script command to make that work because I don't think RMXP allows decimals to be stored in $game_variables with the variable event command.
That can be fixed
Just use this code instead ^_^
class Scene_Battle
alias shinami_make_basic_action_result make_basic_action_result
def make_basic_action_result
if @active_battler.current_action.basic == 1
sp_regain = $game_actors[@active_battler.id].maxsp * ($game_variables[id#] / 100.0)
$game_actors[@active_battler.id].sp += sp_regain.to_i
end#of "if @active_battler.current_action.basic == 1"
shinami_make_basic_action_result
end#of aliased "def make_basic_action_result"
end
The number in $game_variables[id#] is now the percentage ^_^
You still need to change the "id#"
Lower the 100.0 if you want finer distinction. You can also raise it. Just remember to make it a float. (100 wrong, 100.0 correct)
*slaps forehead* It seems the most simple solutions escape me sometimes. ;9
Quote from: Shinami on May 27, 2007, 10:47:42 PM
*slaps forehead* It seems the most simple solutions escape me sometimes. ;9
The problem with the simplest solutions is that they often can be the most difficult to come up with.
All you can do is learn and remember till next time ^_^