[RMXP] MAKING THE "DEFEND" COMMAND GAIN SP BACK.

Posts

Pages: 1
Hi everyone, I'm new to RPG making, and I got a very small problem that I can't seem to be able to fix.

I've been trying to make it so, a character using the DEFEND command will gain 10% of his total SP back. I've been editing the Scene_Battle 4 at the appropriate location, but only had error messages.

Here's the line I added right under line 218 and 219:

self.recover_sp += self.maxsp / 10

I'm not even sure if I'm on right path or anything, so any help would be appreciated! :) Thanks in advance.
"self" is a pointer to the object you are in, i.e. the Scene_Battle.
You probably need to use @active_battler to refer to the character using the guard command, and refer to the Game_Battler scripts to see what functions you can call in it.
Thanks fot the help! It's getting there! I only get a Syntax error message, so I'm must be getting close! My formula looks like this now:


# If guard
if @active_battler.current_action.basic == 1
@active_battler.sp += @maxsp / 10
@help_window.set_text($data_system.words.guard, 1)
return
end


I'll hopefully fix that, but if I'd be honest, I'm ain't much of a scripter so any help is appreciated! ʕ·ᴥ·ʔ
Scratch that, I got some parts right, for now, but still got some issues!


# If guard
if @active_battler.current_action.basic == 1
@active_battler.recover_sp += @active_battler.maxsp / 10
@help_window.set_text($data_system.words.guard, 1)
return
end


I get an undefined method error for "recover_sp". I think I'm getting close! :3
Almost there:

Try this:
@active_battler.sp += @active_battler.maxsp / 10

A thousand thanks! it is now working! :3 I only need to add some fluff around and it will be great (at least for now it's working properly!

Thanks again!
Pages: 1