RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[RESOLVED] Regain 5-10% SP whenever you defend script?

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 87
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.
« Last Edit: May 27, 2007, 07:13:20 PM by wiiman »

***
Rep:
Level 90
Skilled Scripter, Shitty Mapper, Decent Writer.
Give me about 10-15 minutes and I should have something that works.

***
Rep:
Level 90
Skilled Scripter, Shitty Mapper, Decent Writer.
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

Code: [Select]
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

*
A Random Custom Title
Rep:
Level 96
wah
If you were make the code:

Code: [Select]
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

**
Rep: +0/-0Level 87

***
Rep:
Level 90
Skilled Scripter, Shitty Mapper, Decent Writer.
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.

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
That can be fixed
Just use this code instead ^_^

Code: [Select]
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)

***
Rep:
Level 90
Skilled Scripter, Shitty Mapper, Decent Writer.
*slaps forehead* It seems the most simple solutions escape me sometimes.  ;9

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
*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 ^_^