JCeetra

Villager
Member
Joined
May 4, 2018
Messages
7
Reaction score
0
First Language
English
Primarily Uses
RMMV
Hello fellow makers,

I'm trying to get a Fire Mastery-style state working, but I'm having a bit of trouble. The basic idea is that a character in the Pyromancer class gains access to the Fire Mastery class art, which gives them the Fire Mastery buff. When they gain the buff, it starts with 4 "Fire Mastery stacks". One stack erodes at the end of each turn.
When a Pyromancer uses an Art that deals heat damage, its output is increased by an amount based on the number of stacks the Pyromancer has. If they use certain other Pyromancer Arts, it may increase the stack further. (Haven't started on this last bit yet, but it will likely be important for construction purposes later...)

At present, it doesn't seem like my code is doing anything. I set a Fire Bolt spell to deal heat damage, and it is unaffected by Fire Mastery.

I'm using many of Yanfly's plugins. I'll share the relevant pieces I've got already below. Thank you in advance for your time and effort!

<Custom Apply Effect>
// Make sure the stack count exists.
target._fireMastery = target._fireMastery || 0;
// Increase the stack count.
target._fireMastery += 4;
</Custom Apply Effect>

<Custom Confirm Effect>
//Store heat damage type as a variable.
var eId = 7;
//Check if this is an HP damage effect.
if (this.isHPEffect() && value > 0){
//Also check if this is heat damage.
if (this.getItemElements().contains(eId)){
//Is heat damage: multiply.
value *= user._fireMastery;
//Round up.
value = Math.ceil(value);}}
</Custom Confirm Effect>

<Custom Remove Effect>
// Reset the stack count.
target._fireMastery = 0;
</Custom Remove Effect>

<Custom Turn End Effect>
target._fireMastery -= 1;
</Custom Turn End Effect>
 

RCXGaming

Champion of Brightmoon Tor
Veteran
Joined
Jan 4, 2019
Messages
822
Reaction score
1,846
First Language
English
Primarily Uses
RMMV
Interesting concept. Might I suggest using a combination of Victor's Action States, Himeworks's Progressive States and their Overriding States plugin for this?

Example:

#1: Make [x] amount of Fire Mastery States as needed, with each subsequent stack having higher heat damage element rates.

#2: Tag enemies with a <element state: x, type id> tag in their notetag section. This is what those mean:
x : ID of the element.
type : type of change. (add/remove)
id : ID of the state that is applied.

The idea of this is that the enemy, when hit by the element you tag as heat damage, will gain the first heat damage stack state.

#3: Tag the heat damage stack state itself with the <element state> function so when you use another heat attack, it summons another stack.

#4: Overriding States prevents the first stack and subsequent ones from being re-added. For later stacks you should make them "state resist" the previous ones just in case that gets weird for you.

#5: Progressive States is used so the enemy loses stacks by reverting back to the previous states if you keep passing turns.

WARNING: You need Victor Engine's Basic Module. Also, to make Action States work, you need to change

Code:
VictorEngine.getAllElements(subject, item).reduce...etc

to

Code:
VictorEngine.getAllElements(subject, this).reduce...etc
 
Last edited:

JCeetra

Villager
Member
Joined
May 4, 2018
Messages
7
Reaction score
0
First Language
English
Primarily Uses
RMMV
That's a neat idea, it sounds a little different from what I had in mind, though. To clarify, if a state as you described was placed on an enemy, the heat damage would only be multiplied against that enemy, right? My idea was to globally increase a character's heat damage when they have Fire Mastery. So, I use Fire Bolt on a random bat or whatever, I do 20 damage. Then I use Fire Mastery to stack 4, then use Fire Bolt again, but on a different enemy (same defenses). Now the Fire Bolt does 28 damage (if it's 10% per stack, might increase it). The heat damage is multiplied for every heat attack I do regardless of who's getting hit.
I do like the piling on elemental damage on a single enemy idea, it sounds like a good necrotic theme. Maybe that's the Dark Mage skill or something.
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
756
Reaction score
629
First Language
French
Primarily Uses
I see nothing that shouldn't work here in theory.
I suggest debugging it in steps using the console.

First at the end of the apply effect add:
Eval: console.log(target)
Eval: console.log("Mastery:"+target._fireMastery)

This will allow you to be sure that the state applies fire mastery stacks to the actor properly.
Test it by booting up the game applying the state to the actor and bringing up the console with f12.

If this is OK then add console logs at each step through the custom confirm step to see where it goes wrong.

I'd suggest logging the user, the fire mastery stacks, the damage value before and after.
You'll then see if the problem is that stacks are not applied properly or if your condition is not working.

If you have trouble doing any of this please come back with screenshot of the console.


Also, just as a tip, right now you allow firemastery stacks to go below one, making the user deal no damage if they have 0 stacks, or healing the enemies if it goes in the negatives.
If this is not intended behaviour, you might want to add to the end turn step a check if fireMastery is below 1 to set it to 1.
 

TobyYasha

Spaghetti & Coding go hand in hand.
Veteran
Joined
Sep 11, 2019
Messages
181
Reaction score
272
First Language
English
Primarily Uses
RMMZ
Haven't tested, but one thing i've noticed is this:
this.isHPEffect()

It should be this instead:
this.isHpEffect()
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
7,629
Reaction score
5,398
First Language
English
Primarily Uses
RMMV
As a general tip, whenever you're posting code you should put it inside of CODE tags (the </> icon on the edit bar). That will preserve the indentations your post lost, and will also make sure anything inside of brackets displays instead of getting converted to BBCode.

<Custom Apply Effect>
// Make sure the stack count exists.
target._fireMastery = target._fireMastery || 0;
// Increase the stack count.
target._fireMastery += 4;
</Custom Apply Effect>

<Custom Remove Effect>
// Reset the stack count.
target._fireMastery = 0;
</Custom Remove Effect>
These two are a bit unnecessary with each other. If you're removing the fireMastery when the state goes away (and it's better to delete target._fireMastery instead of just setting it to 0), then the first line of the Custom Apply is pointless, unless there's another way for them to have the variable outside of this state.

You could simply say target._fireMastery=4;

if (this.isHPEffect() && value > 0){
As Toby said, this is your problem.

if (this.getItemElements().contains(eId)){
It doesn't hurt anything, but there's no real reason for this to be a separate check. You also don't need to use braces if you're only doing one code statement. So you could streamline this portion a bit to:
Code:
if (this.isHpEffect() && value > 0 && this.getItemElements().contains(eId))
    value*=user._fireMastery;

There's no point in the Math.ceil() call unless you've altered your damage system to allow decimal values in the first place. An integer damage value times an integer number of stacks will always result in an integer.
 

JCeetra

Villager
Member
Joined
May 4, 2018
Messages
7
Reaction score
0
First Language
English
Primarily Uses
RMMV
Thank you for noticing the "p", that's a tough one to remember sometimes. Greatly appreciated! It's now working as intended, though I may need to include a cap on just how many times you can stack this thing :aswt:

On to a new set of questions. I mentioned in my original post that I wanted certain Pyromancer skills to boost the Fire Mastery stacks as well. However, I don't want them to do so quite as potently. This brings me to two problems:

1. I would like to erode one Fire Mastery per turn - that is currently working. But if I simply add more stacks to Fire Mastery, that won't add turns, so eventually it'll run out regardless of how many stacks you've acquired. This means we need to add turns based on what skill is re-applying Fire Mastery to you, which brings me to...
2. How does one add turns to Fire Mastery in specific amounts when your target is a foe? For example, Fire Bolt boosts your Fire Mastery by 2 then strikes a single foe. But from what I've found you can only apply Fire Mastery to the foe in the Skill section. What am I missing there?
 

Latest Threads

Latest Profile Posts

Learn how to do custom face parts with my latest tutorial!
Generatorpartsfromscratch.png
The Legion
T7T0hR2.gif
Made a title screen, and by ''made'' I ofc mean I slapped a simple title on some cool art I bought xD This side project might be fun.

sIMPLE.png
CDF.png

Trying for a Classical RPG with Pokemon Elements. Capture monsters like Zombies and Harpys and use them on your team.
ow28O4A.png

Astarte in her usual demeanor: mocking people.

Forum statistics

Threads
129,872
Messages
1,205,842
Members
171,049
Latest member
Azkaelika
Top