Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> 


———
Before you ask! Read! ;)

You must have 30+ Posts to create a topic here!

Thanks for reading!
———

 
Reply to this topicStart new topic
> Two minor script requests (solved), MP Recover visuals and HP Regen per turn
LostSamurai
post Jan 23 2012, 03:18 PM
Post #1


Atrius
Group Icon

Group: Revolutionary
Posts: 144
Type: Musician
RM Skill: Advanced




I'm not sure if these are even script-necessary, but regardless, I am not sure how to do them.

Game engine: RMXP

Script #1: MP Recover Visual.
There was a script for this. I found it.


Script #2: HP Regen per turn.
I am creating a status similar to the Regen status from Final Fantasy. I would like to have hit points regenerate when the person has this status (at a 10% rate, or at a modifiable rate) every time their turn comes up.

If anyone can help me out with these, I would greatly appreciate it smile.gif

This post has been edited by LostSamurai: Feb 17 2012, 04:34 PM


__________________________
Oh dear... it seems I may have one more project left in me before I retire... more info soon.

My Website

Ikode: The World of Infinity
Ikode 2: The Supreme Dragon
Ikode 3: Broken Mirror

The Two Moons (Joke RPG)
Go to the top of the page
 
+Quote Post
   
Jens of Zanicuud
post Feb 17 2012, 06:50 AM
Post #2


Dark Jentleman
Group Icon

Group: Local Mod
Posts: 904
Type: Scripter
RM Skill: Skilled
Rev Points: 120




Though I'm a bit late (haven't seen this topic b4), here you are something which should fulfill request #2

CODE
#==============================================================================
#=#============================================================================
# #** Jens of Zanicuud rigene in battle script v 1.0
# #   -free use, just credit
# #   -free customization, however, posting on RRR the modified version is
# #    mandatory
# #   -you can find me on www.rpgrevolution.com
#=#============================================================================
#==============================================================================

#==============================================================================
# ** Game_Battler
#==============================================================================
  class Game_Battler
  #--------------------------------------------------------------------------
  # ** constants
  #--------------------------------------------------------------------------
  RIGENE_STATES       = []        #put here rigene stati - example:
                                  #RIGENE_STATES = [2,3]
                                  #means status 2 and 3 give the battler rigene
  RIGENE_PERCENTAGE   = 10.0      #percentage of life recovered each turn
                                  #(1.0 -> 100.0)
  #--------------------------------------------------------------------------
  # ** rigene?
  #--------------------------------------------------------------------------
  def rigene?
    for i in @states
      if RIGENE_STATES.include?(i)
        return true
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  # ** rigene_effect
  #--------------------------------------------------------------------------
  def rigene_effect
    # calculate rigene value (10% maxhp by default)
    self.damage = self.maxhp * RIGENE_PERCENTAGE / 100.0
    # check damage != 0
    if self.damage.abs > 0
      amp = [self.damage.abs * 15 / 100, 1].max
      self.damage = rand(amp+1) + rand(amp+1) - amp
    end
    # increase HP
    self.hp += self.damage
        #set damage < 0 in order to display the correct colour in damage_pop
        self.damage = -self.damage
    # return true
    return true
  end
end

#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  # ** aliases
  #--------------------------------------------------------------------------
  alias joz3_rigene_update_phase4_step1 update_phase4_step1
  #--------------------------------------------------------------------------
  # ** update_phase4_step1
  #--------------------------------------------------------------------------
  def update_phase4_step1
    joz3_rigene_update_phase4_step1
    if @active_battler.hp > 0 and @active_battler.rigene?
      @active_battler.rigene_effect
      @active_battler.damage_pop = true
    end
  end
  
end


Ask for troubleshooting anytime.
I hope this can help...

Jens

This post has been edited by Jens of Zanicuud: Feb 17 2012, 08:55 AM


__________________________
"Thorns are the rose's sweetest essence..."
-Jens of Zanicuud


Games I'm working on:
>

official website: TryAdIne eFfeCt

>

Games I worked on (mainly as a scripter):
>
(Warning: it's a 3rr3's project and it's in Italian!)


Awards

Go to the top of the page
 
+Quote Post
   
LostSamurai
post Feb 17 2012, 09:42 AM
Post #3


Atrius
Group Icon

Group: Revolutionary
Posts: 144
Type: Musician
RM Skill: Advanced




Thank you very much! This will be very helpful.

Is this supposed to be added into Scene Battle? Or is it a standalone script? I posted it above main, and it crashes at end of turn when someone has the Regen status if @active_battler.hp > 0 and @active_battler.rigene? (line 67, undefined method hp)


__________________________
Oh dear... it seems I may have one more project left in me before I retire... more info soon.

My Website

Ikode: The World of Infinity
Ikode 2: The Supreme Dragon
Ikode 3: Broken Mirror

The Two Moons (Joke RPG)
Go to the top of the page
 
+Quote Post
   
Jens of Zanicuud
post Feb 17 2012, 12:36 PM
Post #4


Dark Jentleman
Group Icon

Group: Local Mod
Posts: 904
Type: Scripter
RM Skill: Skilled
Rev Points: 120




Ok, reissuing...

Just delete that Scene_Battle section of the previous script (from class Scene_Battle to the end) and simply paste this:

CODE
if @active_battler.hp > 0 and @active_battler.rigene?
      @active_battler.rigene_effect
      @active_battler.damage_pop = true
    end


in Scene_Battle 4, line 134.

This should work (or I hope so...).
If not, reply and I'll try fixing it.

Jens

EDIT: I tested it, but found no problems...
Place the old script above your custom battle script and it will work.

Jens



This post has been edited by Jens of Zanicuud: Feb 17 2012, 12:46 PM


__________________________
"Thorns are the rose's sweetest essence..."
-Jens of Zanicuud


Games I'm working on:
>

official website: TryAdIne eFfeCt

>

Games I worked on (mainly as a scripter):
>
(Warning: it's a 3rr3's project and it's in Italian!)


Awards

Go to the top of the page
 
+Quote Post
   
Jens of Zanicuud
post Feb 17 2012, 01:17 PM
Post #5


Dark Jentleman
Group Icon

Group: Local Mod
Posts: 904
Type: Scripter
RM Skill: Skilled
Rev Points: 120




That's the correct one:

CODE
#==============================================================================
#=#============================================================================
# #** Jens of Zanicuud rigene in battle script v 1.0
# #   -free use, just credit
# #   -free customization, however, posting on RRR the modified version is
# #    mandatory
# #   -you can find me on www.rpgrevolution.com
#=#============================================================================
#==============================================================================

#==============================================================================
# ** Game_Battler
#==============================================================================
  class Game_Battler
  #--------------------------------------------------------------------------
  # ** constants
  #--------------------------------------------------------------------------
  RIGENE_STATES       = []        #put here rigene stati - example:
                                  #RIGENE_STATES = [2,3]
                                  #means status 2 and 3 give the battler rigene
  RIGENE_PERCENTAGE   = 10.0      #percentage of life recovered each turn
                                  #(1.0 -> 100.0)
  #--------------------------------------------------------------------------
  # ** rigene?
  #--------------------------------------------------------------------------
  def rigene?
    for i in @states
      if RIGENE_STATES.include?(i)
        return true
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  # ** rigene_effect
  #--------------------------------------------------------------------------
  def rigene_effect
    # calculate rigene value (10% maxhp by default)
    self.damage = self.maxhp * RIGENE_PERCENTAGE / 100.0
    # check damage != 0
    if self.damage.abs > 0
      amp = [self.damage.abs * 15 / 100, 1].max
      self.damage = rand(amp+1) + rand(amp+1) - amp
    end
    # increase HP
    self.hp += self.damage
        #set damage < 0 in order to display the correct colour in damage_pop
        self.damage = -self.damage.to_i
    # return true
    return true
  end
end

#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  # ** aliases
  #--------------------------------------------------------------------------
  alias joz3_rigene_update_phase4_step1 update_phase4_step1
  #--------------------------------------------------------------------------
  # ** update_phase4_step1
  #--------------------------------------------------------------------------
  def update_phase4_step1
    joz3_rigene_update_phase4_step1
       if @active_battler != nil
    if @active_battler.hp > 0 and @active_battler.rigene?
      @active_battler.rigene_effect
      @active_battler.damage_pop = true
    end
        end
  end
  
end


Now it should work properly.
I apologise for my mistakes...

Jens


__________________________
"Thorns are the rose's sweetest essence..."
-Jens of Zanicuud


Games I'm working on:
>

official website: TryAdIne eFfeCt

>

Games I worked on (mainly as a scripter):
>
(Warning: it's a 3rr3's project and it's in Italian!)


Awards

Go to the top of the page
 
+Quote Post
   
LostSamurai
post Feb 17 2012, 01:29 PM
Post #6


Atrius
Group Icon

Group: Revolutionary
Posts: 144
Type: Musician
RM Skill: Advanced




It doesn't crash anymore, but it's not giving me 10% of my max HP. It's recovering, or damaging me, a random number lower than 50, including decimals, and the Hit points get decimal values.

EDIT: I fixed that myself, calculations, which I believe you were doing to create randomness, were leaving something out. I removed the randomness so it currently recovers a flat percentage. I will try to implement the randomness again.

EDIT: I added a randomness. It's sloppy, because I'm not a scripter, but now it regens 9-11% of your hit points each turn if the percentage is set to 10%. It still works if the percentage is modified.

I'm satisfied with this script now, it works perfectly for what I needed. Thank you very much smile.gif

CODE
#==============================================================================
#=#============================================================================
# #** Jens of Zanicuud rigene in battle script v 1.0
# #   -free use, just credit
# #   -free customization, however, posting on RRR the modified version is
# #    mandatory
# #   -you can find me on www.rpgrevolution.com
#=#============================================================================
#==============================================================================

#==============================================================================
# ** Game_Battler
#==============================================================================
  class Game_Battler
  #--------------------------------------------------------------------------
  # ** constants
  #--------------------------------------------------------------------------
  RIGENE_STATES       = []        #put here rigene stati - example:
                                  #RIGENE_STATES = [2,3]
                                  #means status 2 and 3 give the battler rigene
  RIGENE_PERCENTAGE   = 10.0      #percentage of life recovered each turn
                                  #(1.0 -> 100.0)

  #--------------------------------------------------------------------------
  # ** randomizer
  #--------------------------------------------------------------------------                                  
  def lsrandomval
    end
  #--------------------------------------------------------------------------
  # ** rigene?
  #--------------------------------------------------------------------------
  def rigene?
    for i in @states
      if RIGENE_STATES.include?(i)
        return true
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  # ** rigene_effect
  #--------------------------------------------------------------------------
  def rigene_effect
    # calculate rigene value (10% maxhp by default)
    self.damage = self.maxhp * RIGENE_PERCENTAGE / -100.0
    lsrandomval = self.damage / -10
    self.damage = self.damage - lsrandomval + rand(lsrandomval) + rand(lsrandomval)
    self.damage = self.damage.round
    # increase HP
    self.hp -= self.damage
    # return true
    return true
  end
end

#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  # ** aliases
  #--------------------------------------------------------------------------
  alias joz3_rigene_update_phase4_step1 update_phase4_step1
  #--------------------------------------------------------------------------
  # ** update_phase4_step1
  #--------------------------------------------------------------------------
  def update_phase4_step1
    joz3_rigene_update_phase4_step1
       if @active_battler != nil
    if @active_battler.hp > 0 and @active_battler.rigene?
      @active_battler.rigene_effect
      @active_battler.damage_pop = true
    end
        end
  end
  
end


This post has been edited by LostSamurai: Feb 17 2012, 02:25 PM


__________________________
Oh dear... it seems I may have one more project left in me before I retire... more info soon.

My Website

Ikode: The World of Infinity
Ikode 2: The Supreme Dragon
Ikode 3: Broken Mirror

The Two Moons (Joke RPG)
Go to the top of the page
 
+Quote Post
   

Reply to this 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 - 10:52 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker