Healing over time while touching event

Hello,
I'm trying to create an Ogre Battle-like game where players and enemies walk around a map and capture cities. I figured the best way of accomplishing this was by making each city is a parallel event with conditional branches depending on who touches the event (player or enemy event).

So, when the player is standing on a city, I'd like the party's HP to regenerate over time (+1% per second), a process that stops when the player walks away from that tile.

What would be the most efficient way of accomplishing this? Should this system be part of each city's parallel event or should I use region Ids and one global parallel event?

I can provide more info on how the cities are currently set up if needed. Thanks
I'd definitely use common events in some form, since you have multiple cities. Anytime there's a chance I'll end up needing to update identical code in multiple places to make inevitable adjustments, it's time for a common event! But that could be a 'healing' common event that you add inline and call from the city event itself, or it could be a more complex persistent location tracking/region ID approach like you mentioned.

One tricky part would be getting the city to do something when an enemy touches it, since even the Event Touch trigger condition 'starts when the event touches the player'. You'd almost be forced to use coordinate tracking to initiate things if an enemy hits those coordinates.

I'd be curious to see the City event commands to have an idea what all happens on them.
I'd definitely use common events in some form, since you have multiple cities. Anytime there's a chance I'll end up needing to update identical code in multiple places to make inevitable adjustments, it's time for a common event! But that could be a 'healing' common event that you add inline and call from the city event itself, or it could be a more complex persistent location tracking/region ID approach like you mentioned.

One tricky part would be getting the city to do something when an enemy touches it, since even the Event Touch trigger condition 'starts when the event touches the player'. You'd almost be forced to use coordinate tracking to initiate things if an enemy hits those coordinates.

I'd be curious to see the City event commands to have an idea what all happens on them.

You're correct, I cannot use Event Touch so I use parallel events with script calls to track player and enemy coordinates vs city coordinates. Here's a screenshot of what I am working with so far.
Spoiler
2021-04-03 12_19_41-ID_006 - Event Editor.png

This is a very tentative version. I'm basically trying to create a system where a city is either neutral, owned by the player, or owned by the enemy. I'm still not sure if I should be using self-switches (like in this example), regular switches or variables to make this work.

Regarding players healing while touching cities, I agree that common events would be a logical choice. I'm just not sure how to apply healing over time state in these areas.

Any ideas?
Thanks! A common event tracking player location, then flipping a switch if their coords match a city region would be a solid approach, so that it would be entirely separate from the city event, and they'd be getting healed while they decide whether to enter or not. Or, you could call the healing common event on your Self Switch A tab of the city event, so if they don't enter and just stand there it kicks off. That would be less of a resource hog than a persistent tracking common event, in a case where there's a lot going on and you're trying to optimize for efficiency.

As for the healing itself, a simple loop event might do the trick, with a 60 frame (1 second) delay, maybe something like this:

healing.png


Good luck!

EDIT: I misread your original post, I see you wanted 1%/second healing, so you'd just change line 2 in the above to /=100 rather than /=10.
Thanks! A common event tracking player location, then flipping a switch if their coords match a city region would be a solid approach, so that it would be entirely separate from the city event, and they'd be getting healed while they decide whether to enter or not. Or, you could call the healing common event on your Self Switch A tab of the city event, so if they don't enter and just stand there it kicks off. That would be less of a resource hog than a persistent tracking common event, in a case where there's a lot going on and you're trying to optimize for efficiency.

As for the healing itself, a simple loop event might do the trick, with a 60 frame (1 second) delay, maybe something like this:

View attachment 184905

Good luck!

EDIT: I misread your original post, I see you wanted 1%/second healing, so you'd just change line 2 in the above to /=100 rather than /=10.
This solution seems to be working! Thanks for your help! Now I just need to run some tests to see if this will work with the multi-party system I'm trying to implement.
There's always more than one way to do this.

You can check the x/y position of the player with a parallel event and heals small amounts of hp time by time if the position is equal to that one of the tile.

Original thread: https://forums.rpgmakerweb.com/threads/healing-over-time-while-touching-event.135111/