Main Menu
  • Welcome to The RPG Maker Resource Kit.

{RMXP} How do i... character health regeneration

Started by The Omega, August 12, 2010, 11:36:11 PM

0 Members and 1 Guest are viewing this topic.

The Omega

I want to make a item, if equipped the hero will regain HP with step.
Now Your nightmare comes to life.

[RMXP] CRYSTaL KNigHTS: The First Dawn - 20%
[RMXP] White Ruins - 10 %

cozziekuns

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.

The Omega

Now Your nightmare comes to life.

[RMXP] CRYSTaL KNigHTS: The First Dawn - 20%
[RMXP] White Ruins - 10 %

Sashikinaroji

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.
Ok, DON'T EXPECT HELP FROM ME~! I will perhaps rant a bit, but don't expect me to do graphics for you, even if I say I will... I won't.

Kidfox70

Haha, this is what cozziekuns meant.

QuoteTurn 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]-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.[/spoiler]


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

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
I don't say bless you when people sneeze, cause i'm not God. Blessing people is his job. Lolo?

The Omega

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.
Now Your nightmare comes to life.

[RMXP] CRYSTaL KNigHTS: The First Dawn - 20%
[RMXP] White Ruins - 10 %

Kidfox70

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.
I don't say bless you when people sneeze, cause i'm not God. Blessing people is his job. Lolo?

The Omega

#7
I suck at this, I cant get it to work for crap :'(

What I got :/
[spoiler]@>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
@>
[/spoiler]

Hope someone can help me
Now Your nightmare comes to life.

[RMXP] CRYSTaL KNigHTS: The First Dawn - 20%
[RMXP] White Ruins - 10 %

cozziekuns


@>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...

The Omega

#9
whats the "!" in there for?
Now Your nightmare comes to life.

[RMXP] CRYSTaL KNigHTS: The First Dawn - 20%
[RMXP] White Ruins - 10 %

cozziekuns


The Omega

Now Your nightmare comes to life.

[RMXP] CRYSTaL KNigHTS: The First Dawn - 20%
[RMXP] White Ruins - 10 %