Override Element of skill, when actor has a certain state

Goldschuss

The creator of Lye Bastion
Veteran
Joined
Dec 4, 2015
Messages
186
Reaction score
68
First Language
German
Primarily Uses
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

The creator of Lye Bastion
Veteran
Joined
Dec 4, 2015
Messages
186
Reaction score
68
First Language
German
Primarily Uses
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
663
Reaction score
373
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

The creator of Lye Bastion
Veteran
Joined
Dec 4, 2015
Messages
186
Reaction score
68
First Language
German
Primarily Uses
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

BCj
Gotta love some gossip :D
Please do not buy games from g2a.com. The sellers have total power over you. The website has many scam sellers. It looks cheap, but the key code didn't work.
A while back I was having fun making my own custom tiles, then I hit carpet... why is it so difficult!? Lol.
Weekend is finally here... what would you like to see (?):
1) Pokemon into zelda minish-cap style
or
2) Pokemon into zelda gbc style
or
3) Zelda into pokemon style

#= Choose ===============#
||__[ Full mockup ]_[ Charset ]__||
#=======================#

Forum statistics

Threads
97,946
Messages
948,074
Members
129,200
Latest member
jakeofblades
Top