Chaos Project

RPG Maker => Event Systems => Event System Requests => Topic started by: Jek on March 26, 2010, 04:26:09 pm

Title: [RMXP]Auto Regenrate Health
Post by: Jek on March 26, 2010, 04:26:09 pm
What I am trying to do is to regenerate health based on the characters level. So, every minute, your health regenerates by 1 if you are level 1. Once you are level 2, you regenerate 2 health. How might I go about doing this when there is no conditional branch for it? Im guessing it would involve the script option in the conditional branch?
Title: Re: [RMXP]Auto Regenrate Health
Post by: G_G on March 26, 2010, 04:57:07 pm
Okay 20 frames = 1 second.
1200 frames = 1 minute. The example below is for 30 seconds though.
The example also includes healing the entire party.

Spoiler: ShowHide
(http://img25.imageshack.us/img25/7562/regenz.png)


Tell me if this is what you wanted.
Title: Re: [RMXP]Auto Regenrate Health
Post by: Jek on March 26, 2010, 05:41:23 pm
What I wanted was to have the amount of health regenerated be more for each level. An example would be:
Level 1 - 100 health generated per minute
Level 2 - 110 health generated per minute
Level 3 - 120 health generated per minute
In the Conditional Branch, there is no way to check for the heros level.
Title: Re: [RMXP]Auto Regenrate Health
Post by: Wizered67 on March 26, 2010, 05:56:55 pm
you can check with variables.......
Title: Re: [RMXP]Auto Regenrate Health
Post by: G_G on March 26, 2010, 06:07:08 pm
Okay this does what you wanted.

Spoiler: ShowHide
(http://img532.imageshack.us/img532/7007/hpregen.png)


level 1: 100
level 2: 110

It does it for the entire party according to the actor's level.
Change 600 frames to 1200 frames. However you may need to use multiple wait commands for that.
Title: Re: [RMXP]Auto Regenrate Health
Post by: Jek on March 26, 2010, 06:09:43 pm
Thank you.
Title: Re: [RMXP]Auto Regenrate Health
Post by: Tyril132 on March 27, 2010, 07:09:21 am
Don't mind me, since I'm not much of a scripter (yet) myself, but it seems like you could stand to improve it by tying it to a simple counting loop instead of sequenced /wait commands, as well.

What I mean is, consider structuring your event like this:

Spoiler: ShowHide
@>Loop
    @>Conditional Branch: Variable [XXXX: Time] == 60
         @>Script: $game_party.actors.each {|i| i.hp += i.level}
         @>Control Variables: [XXXX: Time] = 0
         @>Wait: 20 frame(s)
    Else
         @>Wait: 20 frame(s)
         @>Control Variables: [XXXX: Time] += 1
   : Branch End
@>
: Repeat Above
@>


Doing this would serve two pretty useful purposes:

Title: Re: [RMXP]Auto Regenrate Health
Post by: G_G on March 27, 2010, 07:38:43 am
It would work, but my way is shorter. Making it only 2 or three lines depending on how long you want the regeneration.
Title: Re: [RMXP]Auto Regenrate Health
Post by: Fantasist on March 27, 2010, 07:46:10 am
You know, one could make a "Time-based slip-damage" script, so that effects like poison act based on time rather than steps taken. Then add the regeneration effect to the gallery. *hint to G_G (would be awesome for Tons of Addons)*
Title: Re: [RMXP]Auto Regenrate Health
Post by: Tyril132 on March 27, 2010, 08:10:03 am
Quote from: Hellfire's G_G on March 27, 2010, 07:38:43 am
It would work, but my way is shorter. Making it only 2 or three lines depending on how long you want the regeneration.


Simpler usually is better, true.
Title: Re: [RMXP]Auto Regenrate Health
Post by: G_G on March 27, 2010, 08:47:35 am
Quote from: Mad Scientist Fantasist on March 27, 2010, 07:46:10 am
You know, one could make a "Time-based slip-damage" script, so that effects like poison act based on time rather than steps taken. Then add the regeneration effect to the gallery. *hint to G_G (would be awesome for Tons of Addons)*


Maybe I will. :D
Title: Re: [RMXP]Auto Regenrate Health
Post by: (Hexamin) on March 27, 2010, 08:51:05 am
Only issue is how does the event proc when you reenter a map?  If you're only on a map for 45 seconds, you'll miss out on the hp heal.  Using the loop would at least make it so you hold on to the seconds you've waited for the heal.

? Just a thought ?

I could be wrong.
Title: Re: [RMXP]Auto Regenrate Health
Post by: Tyril132 on March 27, 2010, 08:55:31 am
Being brand new to ruby, I'm trying to error-proof as many of my scripts/events as I can.

That's why I like using game variables for stuff like this... you can easily quantify them while testing through F9 and it's easy to control or modify them for reasons exactly like the one you bring up. lol
Title: Re: [RMXP]Auto Regenrate Health
Post by: G_G on March 27, 2010, 10:13:55 am
Quote from: (Hexamin) on March 27, 2010, 08:51:05 am
Only issue is how does the event proc when you reenter a map?  If you're only on a map for 45 seconds, you'll miss out on the hp heal.  Using the loop would at least make it so you hold on to the seconds you've waited for the heal.

? Just a thought ?

I could be wrong.


If its setup in a common event on a parallel process it'll still work.
Title: Re: [RMXP]Auto Regenrate Health
Post by: (Hexamin) on March 27, 2010, 10:21:00 am
Will common events continued to process through menus too?  Provided they're set up on PP?
Title: Re: [RMXP]Auto Regenrate Health
Post by: G_G on March 27, 2010, 10:47:05 am
No common events wont work unless the menu is updating the interpreter.