Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Closed TopicStart new topic
> Regenerate HP/SP while Defending
Ty
post Jul 31 2007, 12:51 PM
Post #1


Level 38
Group Icon

Group: +Gold Member
Posts: 1,007
Type: Scripter
RM Skill: Undisclosed




What is it?
A simple script that Aliases the make_action_result method of the Scene_Battle so that when you defend a certain percentage of HP and SP will be recovered. Made for a request

Screenshots:
Look at the script, you have yourself a screenshot with extra flavored text.

The Script
Place Above Main.

CODE
#============================================================================
#                          Regenerate when Defend
#----------------------------------------------------------------------------
# Written by Synthesize
# Version 2.00
# August 11, 2007
#============================================================================
#----------------------------------------------------------------------------
# Being Customization Area
#----------------------------------------------------------------------------
# Order = {Actor_id, Percentage}
HP_regen = {1 => 5, 2 => 7}
HP_regen.default = 5
SP_regen = {1 => 10, 2 => 7}
SP_regen.default = 5
#----------------------------------------------------------------------------
# End Customization Area
#----------------------------------------------------------------------------

class Scene_Battle
  alias syn_regen_on_defend make_basic_action_result
  def make_basic_action_result
    syn_regen_on_defend
    hp_restore = ((@active_battler.maxhp * HP_regen[@active_battler.id]) / 100)
    sp_restore = ((@active_battler.maxsp * SP_regen[@active_battler.id]) / 100)
    @temp_value_hp = (@active_battler.maxhp - @active_battler.hp)
    @temp_value_sp = (@active_battler.maxsp - @active_battler.sp)
    if @active_battler.current_action.basic == 1
      if @active_battler.hp != @active_battler.maxhp and @active_battler.sp != @active_battler.maxsp
        syn_restore(hp_restore, 1)
        syn_restore(sp_restore, 0)
        if @temp_value_hp >> hp_restore and @temp_value_sp >> sp_restore
          @help_window.set_text("#{@active_battler.name} #{$data_system.words.hp} increased by #{@temp_value_hp} and #{@active_battler.name} #{$data_system.words.sp} increased by #{@temp_value_sp}", 1)
        end
      elsif @active_battler.hp != @active_battler.maxhp and @active_battler.sp == @active_battler.maxsp
        syn_restore(hp_restore,1)
        if @temp_value_hp >> hp_restore
          @help_window.set_text("#{@active_battler.name} #{$data_system.words.hp} increased by #{@temp_value_hp}", 1)
        else
          @help_window.set_text("#{@active_battler.name} #{$data_system.words.hp} increased by #{hp_restore}", 1)
        end
      elsif @active_battler.hp == @active_battler.maxhp and @active_battler.sp != @active_battler.maxsp
        syn_restore(sp_restore,0)
        if @temp_value_sp >> sp_restore
          @help_window.set_text("#{@active_battler.name} #{$data_system.words.sp} increased by #{@temp_value_sp}", 1)
        else
          @help_window.set_text("@{active_battler.name} #{$data_system.words.sp} increased by #{sp_restore}", 1)
        end
      else
          @help_window.set_text("#{@active_battler.name} is defending", 1)
      end
    end
  end
  
  def syn_restore(amount,stat)
    if stat == 1
      @active_battler.hp += amount
    else
      @active_battler.sp += amount
    end
  end
end



F.A.Q.
Q. How do I call the script?
A. You don't simply install it and let it do it's job.

Q. How do I make it so Current HP is calculated instead of Max HP?
A. If you want the percent of HP/SP to recover to be based on current HP/SP simply change all occurences of .maxhp and .maxsp to only .hp and .sp.

This post has been edited by Synthesize: Aug 11 2007, 01:56 PM


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
jens009
post Jul 31 2007, 04:44 PM
Post #2


L Did you know? Death gods... only eat apples
Group Icon

Group: +Gold Member
Posts: 2,976
Type: Scripter
RM Skill: Skilled




These are the type of scripts I personally like. Short and sweet.

Simple yet effective, nice job syn!


__________________________

My RMXP Project:


Farewell RRR. =]
Go to the top of the page
 
+Quote Post
   
Ty
post Aug 11 2007, 01:56 PM
Post #3


Level 38
Group Icon

Group: +Gold Member
Posts: 1,007
Type: Scripter
RM Skill: Undisclosed




Update, Version 2.00 released. Fixed a big bug. Should work significantly better.


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
darkhalo
post Aug 11 2007, 02:21 PM
Post #4


The RM Warlock
Group Icon

Group: +Gold Member
Posts: 2,178
Type: Developer
RM Skill: Advanced




Im going to add this script right now smile.gif


__________________________

Go to the top of the page
 
+Quote Post
   
Ty
post Aug 15 2007, 12:56 PM
Post #5


Level 38
Group Icon

Group: +Gold Member
Posts: 1,007
Type: Scripter
RM Skill: Undisclosed




Alright, hope you like it.


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
lvarros
post Mar 15 2008, 12:21 PM
Post #6


Level 6
Group Icon

Group: Member
Posts: 86
Type: Event Designer
RM Skill: Advanced




Found a bug I think ohmy.gif
The regen seems to get bugs 50% Hp and down , while the help box says my hp is
increased by 40 or so it only increases 1 point and does that till I die
Go to the top of the page
 
+Quote Post
   
KrzysztofLech
post Jun 14 2008, 02:56 PM
Post #7


Level 1
Group Icon

Group: Member
Posts: 8
Type: None
RM Skill: Beginner




Hi, my name is Chris to tell you the truth i don't know how this script works so I want to ask you. Is it possible to make the Defend command heals not only one or two actors but every battler ( actor or monster ) who use it ?

If you don't know what I'm trying to say just PM me or add reply in this topic.

One last thing, I didn't use English language for 4 years and i forgot some words and grammar rules.


I don't need help any more. I already modify this script by myself.

This post has been edited by KrzysztofLech: Jun 17 2008, 04:38 PM
Go to the top of the page
 
+Quote Post
   
krotchmaster
post Jan 14 2009, 05:06 PM
Post #8


Level 2
Group Icon

Group: Member
Posts: 22
Type: Event Designer
RM Skill: Advanced




this script is excellent. i was wondering...

could it be possible to make the numbers pop instead of shown in a help window?
could it show an animation over the character that is defending?
i also like krzysztoflech's idea of applying this to all battlers, not just actors.
Go to the top of the page
 
+Quote Post
   
Mickadell
post Jan 17 2009, 02:51 AM
Post #9


Level 5
Group Icon

Group: Member
Posts: 71
Type: Event Designer
RM Skill: Masterful




Comments
Rate: Good

I like it. theses scripts are making me really want to use RPG Maker XP.
Go to the top of the page
 
+Quote Post
   
Ndoelicious
post Jul 26 2012, 12:06 AM
Post #10


Level 15
Group Icon

Group: Revolutionary
Posts: 282
Type: Mapper
RM Skill: Intermediate
Rev Points: 50




How can I find this post just now T_T
THanks neway, now off to the project <3


__________________________
One idiot is actually talk more than three geniuses combined!
-Patrick Star-

Go to the top of the page
 
+Quote Post
   
amerk
post Aug 9 2012, 10:37 AM
Post #11


Level 56
Group Icon

Group: Global Mod
Posts: 1,784
Type: None
RM Skill: Undisclosed
Rev Points: 15




Not sure what the post above was asking or saying, but in any case, seeing as this hasn't been touched in well over 3 years, I don't think it needs to be revived unless the OP needs it to be. Ty, please pm me if you'd like this re-opened.

Thanks!


__________________________
Go to the top of the page
 
+Quote Post
   

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 19th May 2013 - 07:20 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker