Warm Fireplace Constantly Restores HP?

Hi, would it be possible to setup an event that slowly restores your HP (+1hp/sec or something like that) while you stand next to it? Like a fireplace.

I setup a player touch restore hp event, but it doesnt work like I have it imagined. I want the player to be slowly restoring HP as he stands by the fire, not jogging around it cheesing HP points.

thanks
You could use yanfly's common event tiles script and make a parallel process common event so if your standing on the event turn the switch on and when you step off it shuts off. 🙂
or just make a parallel process event which checks the position of your character
and how would i do the 1hp per second thing? thanks btw
conditional branch I think and check the players HP if it does not equal max +1hp every 60 frames.

(I'm like half asleep so I'm thinking off the top of my head)
and how would i do the 1hp per second thing? thanks btw
It would be a loop with a 60 frame wait in between HP increasing.
ok genius alert going off right now

thx guys, never used a loop before, cant wait
No, don't use a loop. Parallel processes loop by default. He just means (hopefully) to add a Wait for 60 frames into the (existing, default) loop.

You could do something like this, on a parallel process:

Code:
Script: sx = $game_map.events[@event_id].distance_x_from($game_player.x).abs        sy = $game_map.events[@event_id].distance_y_from($game_player.y).abs        $game_switches[1] = (sx + sy < 3)Conditional Branch: Switch [0001: Warm Player] is ON  Change HP (Entire Party) + 1Branch EndWait 60 Frames
Now, whatever switch you're using, you will have to set twice in that - once in the conditional branch, and once on the last line of the script call - $game_switches[1] says to set switch 1, so you need to put whatever switch number you want to use instead.
Shaz, I am formally requesting an English to English translation.

What you posted is much more genius than I am. Can you be a tad bit more descriptive at what I am looking at to help me understand it?

I make a parallel process event, and place what you wrote in there and ...?

I replace @event_id with ?

I tried it...

Script 'Game_Interpreter' line 1409: Argument Error occurred.

wrong number of arguments (0 for 1)
In your event commands, there is one called Script (last command on the last page). You use that command and type in the text I've put on the first 3 lines (you don't type the word Script: though).


Everything else is just event commands. Here is what your event will look like after it's finished (this time I'll use switch 23 so you can see where you have to make changes). I've also added line breaks to the script, in case you're using the earlier version of the engine that doesn't allow for long lines. If you DO have the later version with a wide input box for the scripts, you can put each command on a single line as I've shown above.


PlayerProximity_zpse3150b20.jpg
Ok, here's the issue (thanks btw) the fire is already an event that does something...Is that going to make this impossible?

The issue above^^ still applies, but it totally works 🙂 (I was having a line break issue, as you pointed out)

Actually, I just realized I can change the graphic to none and increase the tilesize and then place it next to the fireplace, FIXED! SOLVED

SHAZ FOR PRESIDENT!
Yeah, it sounds like you've figured it out anyway, but just in case ...


You're right - you can't have an event that does one thing on a parallel process and another thing when the player interacts with it. I think there IS a script (by Tsukihime) that will allow several event pages to be active at once, but to have a no-script solution, I'd just remove the sprite from the parallel process event, put it a tile higher than the fireplace event, and increase the range by one or two tiles.


This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
Reopened for further troubleshooting
Right, so Shaz, the event works perfectly, but I had to customize it because the actual fire I use is already an event, so I decided to just increase the tilesize affected (the pic says 2 but i tested it with other high numbers so disregard that). When I use the parallel process only, it works perfectly. When I add a blank page and have it switch onto the parallel process (because the fire in my game has to be lit, which has its own independent significance), the parallel process appears for about a frame or two then disappears. There is nothing turning the switch off, though (how could there be? after all, the event works perfectly when its just the parallel process). So if someone can figure out why this setup does not work, but just the 1 event page parallel process DOES work, that's appreciated.

wi9etl.png


ipobpu.png
Yeah, that's exactly what I said in my PM. You're using the same switch to condition the page, and within the checks on the page. That script call says as soon as you are two or more tiles away, turn off the switch. I expect if your fire is conditioned by this switch as well, then as soon as you are 2 or more tiles away, the fire will also go out.


You need to have one switch for the page condition, but use another one in the event commands. The first one is saying "the fire is on and when the player is near, they will be warmed". The second one is saying "the player is near the fire and needs to be warmed RIGHT NOW".


Also, you don't need to have the first page. If the only page of an event has a condition, and that condition is not met, the event will just not display/run. As soon as the switch is turned on, the event will become active. So delete the first page.
Done and done, works perfectly. Nicely done, Shaz.

Original thread: https://forums.rpgmakerweb.com/threads/warm-fireplace-constantly-restores-hp.24529/