The RPG Maker Resource Kit

RMRK RPG Maker Creation => XP => Topic started by: The Omega on August 12, 2010, 11:36:11 PM

Title: {RMXP} How do i... character health regeneration
Post by: The Omega on August 12, 2010, 11:36:11 PM
I want to make a item, if equipped the hero will regain HP with step.
Title: Re: {RMXP} How do i... character health regeneration
Post by: cozziekuns on August 13, 2010, 12:09:23 AM
Turn a switch on as soon as you get the item (or at the start of the game). Make a common event with a variable that tracks your step count. Check if there's a change. If there is, increase the characters HP.
Title: Re: {RMXP} How do i... character health regeneration
Post by: The Omega on August 13, 2010, 02:00:05 AM
im not good with the variable's yet.
Title: Re: {RMXP} How do i... character health regeneration
Post by: Sashikinaroji on August 13, 2010, 03:08:33 AM
variables are real easy... But I don't have XP anymore... So I can't help you through it...

I guess, though, it's easy in the way that math is easy.

That is, when you don't understand it, it seems so daunting, but when you learn how it works, you look back and say, "a DOY! How did I not understand that???"

The point is, just try looking through the variable options a few more times. I think that if you do, you will figure it out before too long.
Title: Re: {RMXP} How do i... character health regeneration
Post by: Kidfox70 on August 13, 2010, 08:54:13 AM
Haha, this is what cozziekuns meant.

Quote
Turn a switch on as soon as you get the item (or at the start of the game). Make a common event with a variable that tracks your step count. Check if there's a change. If there is, increase the characters HP.

I hope...haha

So basicly what is going to happen is the Item will be given to the player. I don't know exactly how you want it happen, but the way I see it, the player goes to the menu, picks the item and applies it to the player like he would a Potion. BUT! The Item triggers a Common Event. Put what I gave you in the Common Event Set it to Parallel Process and then to a Switch that the Code uses (in the Example Switch 1). The player will then be asked if he wants to use it. When he clicks yes, it will then start running the Code for what you want. The game will check the Steps of the player, if it's greater than the Last#Steps Variable then it gives plus ten, then it sets the Last#Steps Variable equal to the number of Steps. This is very important. This Variable has to be put last, or it wouldn't work right. Every step the Player will get health. I put some notes in the spoiler and the code in another. Just so you know, in the Conditional Branch window you can edit it so you don't have an 'Else'. This is good for when you don't need it. Like in this case. It saves time, the Game doesn't need to check for an 'Else' because we wouldn't put anything in there anyway. To edit it, uncheck the box at the bottom of the window. The Set Handling bow.

Notes:
Spoiler for:
-If you do it the way I gave you. Then you could also put in a Conditional Branch checking the HP of the Player, when it reaches the MAX HP the Player has, you could have the Switch turn OFF, then remove the Item from the Player, and therefore ending the step checking Code and Item.

-You could have it where the Player can turn it ON, have the Step/HP Code run, then if he wanted, turn it OFF.

-Instead of having the Player go through the Menu, you could have a Common Event always running and Checking to see if the Item is in the Player Items, if so, it runs the Step/HP Code. Once the Health is full, it removes the Item.

-OR, you could have the Item give health every step, like you want. But after a certain amount of Steps, it is removed from the Player and stops giveing health.


Code:
Spoiler for:
Code: [Select]
Conditional Branch: Switch[0001] == ON
Control Variable: [0001: Steps] = Player's Steps
Contional Branch: Variable [0001: Steps] > Variable [0002: Last#Steps]
Change HP: +10 [Player]
End
Control Variable: [0002: Last#Steps] = Variable: [0001:Steps]

Else
Show Choices: Use item, Never mind
When [Use Item]
Control Switch: [0001] = ON

When [Never mind]

Brand End
End

I hope I helped! If you need anything just ask. I actually came up with this for someone else. Well not exactly, he wanted to control the Steps of NCP's. Meaning he wanted them to move ONLY when the Player moved. I've been working on my project for while. It's a collection of Tutorial all in a little Demo. The Step System is in the Demo. I also have a written guide for each Event System or Element I'm covering. It will only be a little while before I post the Demo. I'm telling you this so you check it out if you have any questions on this, Variables and other things. Again I hope it helps, good luck. ;D
Title: Re: {RMXP} How do i... character health regeneration
Post by: The Omega on August 13, 2010, 09:13:05 PM
Im trying it out with alittle of my own. stuff, what exactly I am trying to do is an accessory, 'Chakra Band', when I character equips it, they gain 'x' amount of hp while walking.
Title: Re: {RMXP} How do i... character health regeneration
Post by: Kidfox70 on August 13, 2010, 10:04:47 PM
Well to be honest it would make sense for it to be an Item, cause you're going to be on the map (it's the only time you'd be taking steps). But since you want it as an accessory, you have a few Options. But I think the easiest way would be doing what I suggested in the notes.

Quote
-Instead of having the Player go through the Menu, you could have a Common Event always running and Checking

Have the Conditional Branch check to see if the Player has it Equiped.
Title: Re: {RMXP} How do i... character health regeneration
Post by: The Omega on August 13, 2010, 10:25:40 PM
I suck at this, I cant get it to work for crap :'(

What I got :/
Spoiler for:
@>Controle Variable: [0001:Steps] = 0
@>Conditional Branch: [xxxx] is [xxxxx] equipped
  @>Conditional Branch: Variable [0001: Steps] == 0
     @>Conditional Branch: Variable [0001: Steps] > Variable [0002: Steps2]
         @>Change HP [xxxx] +2
         @>
      :  Else
         @>
      : Branch End
      @>
    :  Else
      @>
    :  Branch End
   @>
 : Else
   @>
 : Branch End
@>

Hope someone can help me
Title: Re: {RMXP} How do i... character health regeneration
Post by: cozziekuns on August 13, 2010, 11:28:09 PM
Code: [Select]
@>Control Variables: [0001:Steps] = Steps (You can find this in the "other" section of Control Variables).
@>Conditional Branch: [XXXX] is [XXXXX] Equipped
  @>Conditional Branch: [0001:Steps] != [0002:Steps2]
    @>Change HP [XXXX], + 2
    @>
  @>Branch End
  @>Control Variables: [0002:Steps2] = [0001:Steps]
  @>
@>Branch End

There ya go...
Title: Re: {RMXP} How do i... character health regeneration
Post by: The Omega on August 13, 2010, 11:35:20 PM
whats the "!" in there for?
Title: Re: {RMXP} How do i... character health regeneration
Post by: cozziekuns on August 13, 2010, 11:36:22 PM
Not equal to.
Title: Re: {RMXP} How do i... character health regeneration
Post by: The Omega on August 13, 2010, 11:39:55 PM
got it! Thanks :)