Override Element of skill, when actor has a certain state

Goldschuss

A.K.A. Lye
Veteran
Joined
Dec 4, 2015
Messages
202
Reaction score
88
First Language
German
Primarily Uses
RMMV
Hey everyone

I'm currently facing a problem, which I think should be very easy to solve, but I can't figure it out.

I made a skill "Heat infusion" which will apply a state to the user. This state will cause the user to deal fire-elemental attacks, as well as apply a burn with basic attacks and every non-elemental skill. Now, I'm almost there. For basic attacks, this is as easy as giving the state traits of fire element and adding the burn state to the enemies.

For skills, this isn't as simple. I need to insert a specific piece of code into every single non elemental skill to get the desired effect. I'm using much of the Yanfly library, and currently it looks like this:

Code:
<before eval>
if (user.isStateAffected(25)) {
target.addState(16); }
</before eval>
"25" refers to the infusion-status, and 16 is the burn status. So currently what this code does, it checks if the user is fire infused. If so, this skill will burn enemies. Great! Now I just need to add that one line, where the element of this skill is overriden with fire damage instead of physical damage. I had hoped I'd find something in Element Core, but unfortunatly, no.
 

Goldschuss

A.K.A. Lye
Veteran
Joined
Dec 4, 2015
Messages
202
Reaction score
88
First Language
German
Primarily Uses
RMMV
Can anyone help with this?
Or is it so easy that I should've been able to see it the moment I skimmed through the plugin notes?
I can imagine it being a simple line like this.elementOverride("Fire"); but frankly I'm a bit lost.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
781
Reaction score
492
First Language
English
Primarily Uses
RMMV
There's two ways I can see that you could do this, the first is a lot simpler, but might cause problems with the way your system is intended to work. The other is a little more involved to set up, but will probably not cause any issues.

First Method:
Set all of your non-elemental skills to use 'Normal Attack' element, rather than no element. This will set them so that they use whatever element the weapon of the user has on it. This will make your state adding an element to a basic attack also add this element to the skill set this way.

The disadvantage to this is that any skill with this element set will also take it's element from an elemental weapon the actor has equipped. That might not be an issue for your specific use-case though.

Second Method:
Using a <Before Eval> and an <After Eval> you can manually set the element of the skill being used, and then set it back to normal after the attack. This is going to require both of these tags on every skill you want to modify in this way, and you'll have to change some numbers for each one, so like I said above, it's a bit involved to set up.

JavaScript:
<Before Eval>
    if (user.isStateAffected(X)){
        $dataSkills[Y].damage.elementId = Z
    }
</Before Eval>

<After Eval>
    $dataSkills[Y].damage.elementId = 0
</After Eval>
You'd change X to the state Id of your state, and Y to the database ID of the skill being used for each skill. Z is the elementId of the element it's being changed to.

The second option is likely the best, as it doesn't have any weird interactions with weapon elements, but it will need to be pasted onto every skill that can be modified by the state.

Also, I'd like to point out that your method of applying the burning state above is a bit flawed too, as adding a state in that way bypasses resistance to the state. An enemy who is fire type and should be immune to being set on fire will still be set ablaze if you use that. There's a way to bring state resistance into play here.

JavaScript:
<post-damage eval>
if (user.isStateAffected(25) && Math.random() < target.stateRate(16)) {
    target.addState(16);
}
</post-damage eval>
This will add the state after damage has been taken, and only if it passes a stateRate check. Meaning enemies immune to being set on fire will not be set on fire.
 
Last edited:

Goldschuss

A.K.A. Lye
Veteran
Joined
Dec 4, 2015
Messages
202
Reaction score
88
First Language
German
Primarily Uses
RMMV
Ramza himself comes to the rescue? Thank you so much! I'll give number 2 a try. I've been working with js a good bit and it's really not much more work than Number 1 would be.

I do not have fire-immune enemies in my game planned, but I'll keep it in mind.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,047
Messages
1,018,540
Members
137,834
Latest member
EverNoir
Top