Party "Energy" tracking Mechanic

gizmo214

Villager
Member
Joined
Apr 5, 2021
Messages
17
Reaction score
0
First Language
english
Primarily Uses
RMMV
Hello All,

I'm making a unique Army building, strategy, RPG game and I am running into a little issue with a mechanic I'm working on. I'm still relatively new to the forums and RPG Maker, So please consider this while answering; anyway to my question:

Is there a way to make a mechanic where my party has a limited "energy" capacity that depletes when my main actor orders them to do certain tasks, like chop this tree for resources, march this far on the map, etc but recovers when the party "rests" at an encampment or Inn?

Side note: I'd like each actor to have a specific amount of energy, that ultimately adds up to the overall energy of the party. But, I also want to activate a certain state like "tired" or "exhausted" that is checked against the party's current energy levels.

What i've tried so far:
1.Making a key item that I equip to each actor and have it get adjusted when the actor executes a command on the map
This seems simpliest.

2.I was trying to make a common event that can get referenced constantly, but I dont know how to reference an "energy" stat if it does not exist.


I really hope this is making sense to those reading. If not i'll elaborate more. But as I said, I'm new to RPG Maker and am not too familiar with how it fully works.

Finally, I'm ok with criticism, but please do not tell me to try and do something easier first, I am posting to this forum to seek help to answer my questions, not to guide me to learn the engine. I will do this over time. Sorry to come off brash, but I've already had one experience in this forum and I ended up looking elsewhere and finding the answer there.

Thank you.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,355
Reaction score
8,081
First Language
German
Primarily Uses
RMMV
simple: you need to use variables to store the energy value.

if you don't know how to use variables, I suggest you follow the link to the starting point in my signature, then look for the link to the "variables guide" in that tutorial.
the variables guide is a game that you can play to learn what you can do with variables
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,957
Reaction score
5,583
First Language
English
Primarily Uses
RMVXA
Yeah, the way I understand what you're trying to do, you will need to use Variables (unless you want to create a new plugin to specifically handle Energy for actors, but this is much more technically sophisticated than the Variables approach).

At the beginning of the game, "initialize" a bunch of Variables by running an event - use Control Variables, and assign one variable to each Actor's Energy. For example, Reid's current energy is Variable #41, and Priscilla's current energy is Var #42. Set each of those variables to 100 (or whatever the max amonut of energy you can have is).

Whenever you assign the actor a task, you can check first to see how much Energy they have using a Conditional Branch that checks the value of the Variable assigned to that actor - for example, if Chopping a Tree requires 25 energy, and you've chosen Reid to do it, you'll be checking whether Var #41 >= 25. If it is, then do the Tree Chop stuff (animation, gain Wood, whatever), and also subtract the required energy (25) from that actor's Variable using Control Variables. If it isn't (the "Else" branch), have Reid say he's too exhausted to do that right now.

You'll obviously want ways to restore actors' energy. One easy way would be at Inns - use a custom Inn event (instead of the premade one), where if you choose to stay there and pay the required Gold, a Recover All command is run (this fully heals all actors, as with current RPG Maker behavior) and then also sets all those Variables back to 100 (or, if you don't want all 100 Energy to be restored, then increases them by a certain amount, like +40, checks to see if they're greater than 100, and sets them back to 100 if so).
 

gizmo214

Villager
Member
Joined
Apr 5, 2021
Messages
17
Reaction score
0
First Language
english
Primarily Uses
RMMV
Yeah, the way I understand what you're trying to do, you will need to use Variables (unless you want to create a new plugin to specifically handle Energy for actors, but this is much more technically sophisticated than the Variables approach).

At the beginning of the game, "initialize" a bunch of Variables by running an event - use Control Variables, and assign one variable to each Actor's Energy. For example, Reid's current energy is Variable #41, and Priscilla's current energy is Var #42. Set each of those variables to 100 (or whatever the max amonut of energy you can have is).

Whenever you assign the actor a task, you can check first to see how much Energy they have using a Conditional Branch that checks the value of the Variable assigned to that actor - for example, if Chopping a Tree requires 25 energy, and you've chosen Reid to do it, you'll be checking whether Var #41 >= 25. If it is, then do the Tree Chop stuff (animation, gain Wood, whatever), and also subtract the required energy (25) from that actor's Variable using Control Variables. If it isn't (the "Else" branch), have Reid say he's too exhausted to do that right now.

You'll obviously want ways to restore actors' energy. One easy way would be at Inns - use a custom Inn event (instead of the premade one), where if you choose to stay there and pay the required Gold, a Recover All command is run (this fully heals all actors, as with current RPG Maker behavior) and then also sets all those Variables back to 100 (or, if you don't want all 100 Energy to be restored, then increases them by a certain amount, like +40, checks to see if they're greater than 100, and sets them back to 100 if so).
Thanks alot wavelength!
Yet again you've assisted me and I'm grateful for that! :) I have a question here though, I feel like a lot of the mechanics I want to have can be accomplished with a variety of variables. Although tedious and probably not the best way to make a game. But my question is, Can I just have an empty map that no player will see and have all variables running and checking throughout the game on that one map? Like how you said "initialize" a bunch of variables. Can I just have a map that is a master controller of all variables while my characters are not on it? or do I have to add a bunch of empty variables every map?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,355
Reaction score
8,081
First Language
German
Primarily Uses
RMMV
Can I just have an empty map that no player will see and have all variables running and checking throughout the game on that one map?
no, for two reasons:
1) only the map with the player will be loaded, all other maps will be ignored and only run when the player enters them.
2) too many parallels in the background will lag your game to hell.

instead, there are two other mechanics that will help you, both centered around the common events in the database.
1) a common event on parallel will run on all maps, so you can use one or two to handle those calculations that really need to be parallel.
2) common events can be called from other events, so you can make common events to handle the calculations and simply call them whenever or whereever the data needs to be checked. For example have a common event "chop tree" that is called from all tree events on all maps, checking if enough energy is available and changing energy and items as neccessary without having to enter the commands everywhere - and if you need to balance the required energy you'll only have to change the common event without going into the 200+ tree events.
 

gizmo214

Villager
Member
Joined
Apr 5, 2021
Messages
17
Reaction score
0
First Language
english
Primarily Uses
RMMV
no, for two reasons:
1) only the map with the player will be loaded, all other maps will be ignored and only run when the player enters them.
2) too many parallels in the background will lag your game to hell.

instead, there are two other mechanics that will help you, both centered around the common events in the database.
1) a common event on parallel will run on all maps, so you can use one or two to handle those calculations that really need to be parallel.
2) common events can be called from other events, so you can make common events to handle the calculations and simply call them whenever or whereever the data needs to be checked. For example have a common event "chop tree" that is called from all tree events on all maps, checking if enough energy is available and changing energy and items as neccessary without having to enter the commands everywhere - and if you need to balance the required energy you'll only have to change the common event without going into the 200+ tree events.
Thanks Andar!
I've been trying to wrap my head around how common events work and this cleared it up for me,
Thank you!
 

Latest Threads

Latest Profile Posts

A good way to practice writing is to write "flash fiction"; very short stories. Link
[CM]
5VaUMjAFpz1I6fSsgDrfJc.jpg

Title is star.
Dam, does the night get to me, I sound and look like a monster. Its 3:54 am right now...I need sleep...or...coffee.
It has nothing to do with my project, but I'm in love with voxels
If you feel like your story isn't that great, just look at final fantasy.

Forum statistics

Threads
110,484
Messages
1,053,634
Members
143,576
Latest member
hsytrggfsdb
Top