Defining Actor's Max HP with a Formula

Exlo

Villager
Member
Joined
Nov 22, 2015
Messages
13
Reaction score
1
First Language
English
Okay I've been trying to figure this out all day, from simple trial and error to slogging through internet searches and forum posts. How can I, in the script box for a Common Event, use a formula to define an actor's Max HP (and MP, but I assume the process is identical)? Basically, what I'm trying to do is make the Defence stat influence how much HP is received per level. I'm trying out Hime's Level Up Events ( http://himeworks.com/2015/10/level-up-events/ ) to run the event at level up.

Basically, this is what I'm trying to accomplish  =>  this.mhp = this.mhp + (this.def * 1.5)

It seems like such a simple concept. :'c
I appreciate any help - maybe I can grasp some Javascript after having this one explained.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,425
Reaction score
7,710
First Language
German
Primarily Uses
RMMV
in the script box for a Common Event, use a formula to define an actor's Max HP
That is the part you can't do - the script box is sandboxed and anything defined inside will be erased as soon as the script box is closed.
You need to provide a method defined outside the script box but that can be called inside it, and that means you need a fully functional plugin to allow this.


That plugin needs to redirect the parameter formulae to its own area, and then can give you a script command to enable changes to that area from inside a script box or a plugin command.
 
Last edited by a moderator:

kiriseo

Veteran
Veteran
Joined
Oct 27, 2015
Messages
245
Reaction score
82
First Language
German
That is the part you can't do - the script box is sandboxed and anything defined inside will be erased as soon as the script box is closed.

You need to provide a method defined outside the script box but that can be called inside it, and that means you need a fully functional plugin to allow this.

That plugin needs to redirect the parameter formulae to its own area, and then can give you a script command to enable changes to that area from inside a script box or a plugin command.
Actually, you can do something like the op wants with the linked plugin.

But you have to create a Common Event for every actor.

@Exlo

Here's a screenshot from my Common Event for the plugin as an example. For your entire party you'll need the Common Event Queue plugin from HimeWorks too.

In this shot, the first actor in the database (by default it's Herold) gets his defense value as additional mhp, BUT it includes the defense values of equipement, too.

I would suggest that you think about some other values for this BD

 
Last edited by a moderator:

Exlo

Villager
Member
Joined
Nov 22, 2015
Messages
13
Reaction score
1
First Language
English
Thanks for the quick reply. c:

Any advice on how to accomplish this? Or how to work up to being able to, I suppose? I've also tried looking at plugins I thought would be similar, but I suddenly feel even more out of my element haha

Edit: Oops ninja'd there. This looks more challenging than I originally thought, huh? I actually intended to have every actor have their own event for level-up. I wasn't even thinking about values added by equipment... Hm. I'm at a loss. I wanted the skills to have more depth, have more than one effect. There was going to be a system to distribute points into these base stats... but maybe I could do the same thing, but store all the player added numbers in a variable and call on that for how much HP/MP is added per-level. I set all the stats to be the same number on their curves, so it would just be a matter of adding the base value after that. I'll have to poke around, see what I can figure out. I appreciate the help!
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,425
Reaction score
7,710
First Language
German
Primarily Uses
RMMV
Actually, you can do something like the op wants with the linked plugin.
Yes and no - that only works for additive formulae, because it only let's you decide what to add for each level - it doesn't let you set complete level formulae that are non-additive.

Any advice on how to accomplish this? Or how to work up to being able to, I suppose?


Edit: Oops ninja'd there. This looks more challenging than I originally thought, huh?
Basically you need to determine the mathematical formulae what to add where for yourself, and then use control variables to calculate the value before adding it.


It can be done with those events if you're using simple additions based on other values, but there are two points that you have to take care of:


1) recursive additions: your additions should only go in one direction, for example adding to HP based on DEF values. If you give every parameter an add based on other parameters, then you'll create a recursive effect that can easily skyrocket and is one hell of a balancing problem.


2) If you ever re-initialize the actor, all additions will be lost. To keep them after reinit the data would have to be in the base formula, and that needs the plugin I described above.
 

kiriseo

Veteran
Veteran
Joined
Oct 27, 2015
Messages
245
Reaction score
82
First Language
German
Yes and no - that only works for additive formulae, because it only let's you decide what to add for each level - it doesn't let you set complete level formulae that are non-additive.
And that is exactly what the example from the opening post does B)
 

Exlo

Villager
Member
Joined
Nov 22, 2015
Messages
13
Reaction score
1
First Language
English
When do characters initialize, then? (Sorry, I'm awful new at all this.) I think I should be able to do what I want to do in the scope of the Maker's event commands anyways. Players will be able to add points to stats through another Common Event anyways, so I can just store the number of player added values in a variable as they place them, and increase parameters through the Change Parameters doo-hickey on level up. This also circumvents the equipment issue. However, this doesn't solve the dilemma if characters re-initializing overwrites parameter changes that way too. Though I'm not sure why it would, though, that sounds pretty restrictive. 
 

kiriseo

Veteran
Veteran
Joined
Oct 27, 2015
Messages
245
Reaction score
82
First Language
German
Honestly, I can't think of a scenario where you would re-initilize your actors in a running game.

The parameters from your actors will be stored in the savefile, so even loading a savegame wouldn't overwrite it.
 
Last edited by a moderator:

Exlo

Villager
Member
Joined
Nov 22, 2015
Messages
13
Reaction score
1
First Language
English
That's a relief. I was worried there would be times I would want to or something and just didn't know it yet! I'm sure I'll learn the ins and outs in time, though. Thanks again you guys, I at least have a feasible game-plan now. c:
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,018
Messages
1,018,357
Members
137,803
Latest member
andrewcole
Top