Change skill conditional on state

Im struggling to find a way to change the skill used to another or have its effect based on state applied to enemy.

I found this but its RGSS3
http://himeworks.com/2013/05/skill-change/

Basically im trying to do 2 things.
Example:
Player casts Ice=Enemy gets frostbitten state (which is the Ice stack)
Player casts Ice->Ice(2 consecutive skills from Ice magic)= Enemy loses frostbite and gains chilled and the second Ice skill deals damage at 125%
Player casts Ice->Ice->Ice= Enemy loses chilled and becomes frozen, 3rd Ice skill deals damage at 125% value and increased crit chance by 10%.
Next cast of Ice restarts the stack from beginning.

Example 2:
Player casts Ice= Enemy has frostbite
Player casts Ice->Fire= Frostbite removed, Damage is reduced to 75% but deals the fire spell as AoE and changes fire attribute to Steam type of damage.
Next cast of Ice restarts the stack from beginning.

Each element inflicts a condition that the skills interact with. Some Ice skills will deal bonus damage if the target suffers from frostbite state. Additionally the skill should check if the state is on the enemy if it is and its the same element (like example 1), it then gains overwrites that state with a more potent state.
Secondly what im really trying to find is if I cast Fire on an enemy with the frostbite state, the skill transforms into another skill called Steam which does (fire's damage x .75) in an aoe (using Yanfly aoe skills plugin)
Ultimately I can't seem to find anything that checks the enemy state so that my skills can interact with each state on the enemy. My whole system is based on the interaction between skills and the states, I want to create multiple effects that happen based on the current state inflicted on enemy, ranging from increased damage, debuffs, to triggering and replacing the skill with a completely new one for that use.
for the stacking states, I managed to achieve something like it, but for actors not enemies.
it can be done directly with plain eventing/state-ing, you don't need a plugin, but I never tried it for enemies.

you can alternatively just translate the Ruby into JS, it's not a mystery.
you'll have to get clearance from Hime, and get any modules or core plugins that they use.
for the stacking states, I managed to achieve something like it, but for actors not enemies.
it can be done directly with plain eventing/state-ing, you don't need a plugin, but I never tried it for enemies.

you can alternatively just translate the Ruby into JS, it's not a mystery.
you'll have to get clearance from Hime, and get any modules or core plugins that they use.

Stacking I dont know how to do that...
In formula bar: Im using
'if (b.isStateAffected(12)) b.addState(13); if (b.isStateAffected(11)) b.addState(12); a.atk * 4'
It seems to be working but is kind of clunky and this is for just one state, ill have to add each interaction in the so this can be rather long. Im using a plugin in the note section: <Hit Reward: Add State 11> from Yanfly lunatic states.

For translating ruby into JS I have no idea how thats why im looking for some help or pointed in the right direction.
If you know how to do Javascript to make your formula the way you want to, you can actually make the formula's much larger and maybe force code stuff to happen. I could easily set up something for your example 1, but its the example 2 where things get a bit tricky... I've never tried changing scope or element in a formula, so I might give it a shot and see what I can find (if anything) when I get a free moment today.
If you know how to do Javascript to make your formula the way you want to, you can actually make the formula's much larger and maybe force code stuff to happen. I could easily set up something for your example 1, but its the example 2 where things get a bit tricky... I've never tried changing scope or element in a formula, so I might give it a shot and see what I can find (if anything) when I get a free moment today.

I found this plugin
https://forums.rpgmakerweb.com/index.php?threads/ve-replace-actions.58561/
It should do what im looking for but for some reason it does not work. I tried disabling plugins and the basic attack change works if I disable YEP_BattleEngineCore.
I cannot seem to figure out how to get it to change skills however
Did you happen to get the required plugin for that one as well? Asking just in case 🙂

https://victorenginescripts.wordpress.com/rpg-maker-mv/basic-module/

As for my earlier comment, I cannot help with the changing of the scope or element in a formula, so yeah... def gonna need a good plugin if you can find one for the whole of what you're needing... sorry I couldn't help more :|
Did you happen to get the required plugin for that one as well? Asking just in case 🙂

https://victorenginescripts.wordpress.com/rpg-maker-mv/basic-module/

As for my earlier comment, I cannot help with the changing of the scope or element in a formula, so yeah... def gonna need a good plugin if you can find one for the whole of what you're needing... sorry I couldn't help more :|

Yes downloaded the basic module but a big problem is it does not seem to be compatible with Yanfly battle engine which I need to use just as much as this plugin 🙁
OK, I did some testing in a new clean project and it does work, but it took me a minute to realize that these notetags aren't in the skill notes... as soon as I realized that, it was working fine. If you want to use it with YEP stuff, place it under the Battle Engine Core.
upload_2018-6-13_20-2-9.png


Then in the case I how I tested, I set the basic attack skill that did 100 damage to have a chance to be replaced by another skill that did 200 damage, so when I was attacking there was a 50% chance for 100 or 200 damage, and it was working without issue like this:
upload_2018-6-13_20-4-0.png


This note was put into Actor 1's box, with 100% hit chance so that it would be easier to test, but it does work with Yanfly 😀
Hopefully you will be able to take this info and get it working for yourself and achieve your goal in the skill settings 😀
OK, I did some testing in a new clean project and it does work, but it took me a minute to realize that these notetags aren't in the skill notes... as soon as I realized that, it was working fine. If you want to use it with YEP stuff, place it under the Battle Engine Core.
View attachment 92035

Then in the case I how I tested, I set the basic attack skill that did 100 damage to have a chance to be replaced by another skill that did 200 damage, so when I was attacking there was a 50% chance for 100 or 200 damage, and it was working without issue like this:
View attachment 92036

This note was put into Actor 1's box, with 100% hit chance so that it would be easier to test, but it does work with Yanfly 😀
Hopefully you will be able to take this info and get it working for yourself and achieve your goal in the skill settings 😀

Yeah lol I was testing this all day and figured out as well it does not work in skills, I got it working in equipment or actor. It says it works in states but im sure it only works if the state is applied to the character. So unless there is a way to code it with the custom action replace so that it checks if the state is on the enemy, it does me no good.

It does not at all do what I thought it did, it mainly just gives a chance to proc a stronger skill randomly. I need something that is not random but conditional.
Btw your pics arent showing but I got the jist of how the plugin works.
Feeling super discouraged, wasted 2 days on this and seems like no solution.
Never give up 😀 When I was making some of my skills and formula's I had some severe issues with setting up, testing, and balancing. Some of the things I tried seemed impossible cause no matter how hard I tried it just didn't seem to work... eventually I solved all of my issues, but the idea to fix it would hit me when I was working on something else... one of those "HEY! Try this <blah>!" while in the middle of working on other things or dealing with real life.

While my spells and attacks don't change effects based on buffs(like how you are wanting it to cast a different spell), I do have them deal increased damage or reduced damage when certain buffs are on me, and ill show you a few of my very odd spells and how I coded them... maybe give you an idea.

Spoiler: Spell Coding
Spoiler: Physical Attack
Code:
Game_Battler.prototype.attack = function(a, b) {
    if (a.isActor()) {
        damage  = (((a.atk+Math.pow((a.atk/10), 2)))*(100/(100.00+b.def))+((a.atk-b.def)/2))
        fi = $gameVariables.value( 8)
        wi = $gameVariables.value( 9)
        wa = $gameVariables.value(10)
        ea = $gameVariables.value(11)
        damage *= ((fi+wi+wa+ea)*0.0025)+1.00
        if (a.isStateAffected(40)) { damage *= 1.25 }
        if (a.isStateAffected(47)) { damage *= 0.75 }
        if (b.isStateAffected(46)) { damage *= 0.75 }
        if (b.isStateAffected(54)) { damage *= 1.25 }
        if (damage <= 0) { damage = 1 }
        damage = parseInt(damage*a.pdr)
        console.log(a._name+": Melee ("+(parseInt(damage*0.8))+"-"+(parseInt(damage*1.2)+")"))
        return damage
    }
    else {
        a._mp += a.mmp/10
        damage  = (((a.atk+Math.pow((a.atk/10), 2)))*(100/(100.00+b.def))+((a.atk-b.def)/2))*1.50
        damage *= (b.level*0.05)+1.00
        if (a.isStateAffected(40)) { damage *= 1.25 }
        if (a.isStateAffected(47)) { damage *= 0.75 }
        if (b.isStateAffected(46)) { damage *= 0.75 }
        if (b.isStateAffected(54)) { damage *= 1.25 }
        if (damage <= 0) { damage = 1 }
        damage = parseInt(damage*a.pdr)
        console.log(a.originalName()+": Melee ("+(parseInt(damage*0.8))+"-"+(parseInt(damage*1.2)+")"))
        return damage
    }
}
In this example it first determines if its an actor or enemy using the skill, if its an actor base damage is 100%, if enemy its 150% (the x1.50).

My game revolves around mastering 4 elements for spells, but if you're spells got too far ahead of the melee attacks then no one would ever use a melee attack, so all my variables are from each element and slowly boost physical damage so that it remains an option for killing without using magic constantly.

The next section with all the "isStateAffected" stuff is where I buff or debuff damage if certain states are inflicted, I never did like the way the default engine handled buffing/debuffing or the Physical Damage/Magical Damage Rates, so I reworked them in different ways.

The next line is where I absolutely hate seeing "Miss" of nothing at all when damage is 0, so I made it so you will always do at least 1 damage.

The Math.parseInt part turns it back into a whole number using the Physical or Magical Damage Rate. The console part sends the potential damage range to the console with the 20% variance calculated already. And the final line send the final result into battle to hit the target.

Spoiler: Flame Spell
Code:
Game_Battler.prototype.flame = function(a, b) {
    if (a.isActor()) {
        damage  = (((a.mat+Math.pow((a.mat/10), 2)))*(100/(100.00+b.mdf))+((a.mat-b.mdf)/2))*1.50
        damage *= 1.40
        damage *= ($gameVariables.value(8)*0.02)+1.00
        if (a.isStateAffected(40)) { damage *= 1.25 }
        if (a.isStateAffected(47)) { damage *= 0.75 }
        if (b.isStateAffected(46)) { damage *= 0.75 }
        if (b.isStateAffected(54)) { damage *= 1.25 }
        if (damage <= 0) { damage = 1 }
        damage = parseInt(damage*a.mdr)
        console.log(a._name+": Flame ("+(parseInt(damage*0.8))+"-"+(parseInt(damage*1.2)+")"))
        return damage
    }
    else {
        damage  = (((a.mat+Math.pow((a.mat/10), 2)))*(100/(100.00+b.mdf))+((a.mat-b.mdf)/2))*2.25
        damage *= 1.40
        damage *= (b.level*0.05)+1.00
        if (a.isStateAffected(40)) { damage *= 1.25 }
        if (a.isStateAffected(47)) { damage *= 0.75 }
        if (b.isStateAffected(46)) { damage *= 0.75 }
        if (b.isStateAffected(54)) { damage *= 1.25 }
        if (damage <= 0) { damage = 1 }
        damage = parseInt(damage*a.mdr)
        console.log(a.originalName()+": Flame ("+(parseInt(damage*0.8))+"-"+(parseInt(damage*1.2)+")"))
        return damage
    }
}
As you can see, this is very much like the Physical Attack, but follows a slightly different setup and only uses one variable. The "damage *= 1.4" is where the spell gets a majority of its oomph when compared to melee hits.

Spoiler: Recover Spell
Code:
Game_Battler.prototype.recover = function(a, b) {
    if (a.isActor()) {
        damage  = a.mat*5
        damage *= 4.20
        damage *= ($gameVariables.value(10)*0.02)+1.00
        if (a.isStateAffected(40)) { damage *= 1.25 }
        if (a.isStateAffected(47)) { damage *= 0.75 }
        if (b.isStateAffected(46)) { damage *= 0.75 }
        if (b.isStateAffected(54)) { damage *= 1.25 }
        if (damage <= 0) { damage = 1 }
        damage = parseInt(damage*a.mdr)
        console.log(a._name+": Recover ("+(parseInt(damage*0.8))+"-"+(parseInt(damage*1.2)+")"))
        return damage
    }
    else {
        damage  = a.mat*5
        damage *= 4.20
        damage *= (a.mat*0.01)+1.00
        if (a.isStateAffected(40)) { damage *= 1.25 }
        if (a.isStateAffected(47)) { damage *= 0.75 }
        if (b.isStateAffected(46)) { damage *= 0.75 }
        if (b.isStateAffected(54)) { damage *= 1.25 }
        if (damage <= 0) { damage = 1 }
        damage = parseInt(damage*a.mdr)
        console.log(a.originalName()+": Recover ("+(parseInt(damage*0.8))+"-"+(parseInt(damage*1.2)+")"))
        return damage
    }
}
In this example the formula is very simple, as it is just a healing spell. Once again the effect can be boosted or lowered by states.

Spoiler: Expose Spell
Code:
Game_Battler.prototype.expose = function(a, b) {
    base  = 10000
    if ($gameSwitches.value(15) == true) { base += 20000 }
    chance = Math.randomInt(base)
    if (a.isActor()) {
        if (a.luk >= 100) {
            if (b.isStateAffected(56)) {
                // Nothing!
            }
            else {
                if (chance <= a.luk *  1) { b.addState( 1) }
                if (chance <= a.luk *  2) { b.addState( 3) }
                if (chance <= a.luk *  3) { b.addState(45) }
                if (chance <= a.luk *  4) { b.addState(15) }
                if (chance <= a.luk *  5) { b.addState(11) }
                if (chance <= a.luk *  6) { b.addState( 9) }
                if (chance <= a.luk *  7) { b.addState( 7) }
                if (chance <= a.luk *  8) { b.addState(13) }
                if (chance <= a.luk *  9) { b.addState( 5) }
                if (chance <= a.luk * 10) { b.addState(17) }
                b.addState(56)
            }
        }
        else {
            if (b.isStateAffected(56)) {
                // Nothing!
            }
            else {
                if (chance <=  100) { b.addState( 1) }
                if (chance <=  200) { b.addState( 3) }
                if (chance <=  300) { b.addState(45) }
                if (chance <=  400) { b.addState(15) }
                if (chance <=  500) { b.addState(11) }
                if (chance <=  600) { b.addState( 9) }
                if (chance <=  700) { b.addState( 7) }
                if (chance <=  800) { b.addState(13) }
                if (chance <=  900) { b.addState( 5) }
                if (chance <= 1000) { b.addState(17) }
                b.addState(56)
            }
        }
        damage  = (((a.mat+Math.pow((a.mat/10), 2)))*(100/(100.00+b.mdf))+((a.mat-b.mdf)/2))*1.50
        damage *= 5.00
        damage *= 0.75 // Status
        damage *= ($gameVariables.value(10)*0.02)+1.00
        if (a.isStateAffected(40)) { damage *= 1.25 }
        if (a.isStateAffected(47)) { damage *= 0.75 }
        if (b.isStateAffected(46)) { damage *= 0.75 }
        if (b.isStateAffected(54)) { damage *= 1.25 }
        if (damage <= 0) { damage = 1 }
        damage = parseInt(damage*a.mdr)
        console.log(a._name+": Scan ("+(parseInt(damage*0.8))+"-"+(parseInt(damage*1.2)+")"))
        return damage
    }
    else {
        if (b.isStateAffected(56)) {
            // Nothing!
        }
        else {
            if (chance <=  100 + a.luk *  1) { b.addState( 1) }
            if (chance <=  200 + a.luk *  2) { b.addState( 3) }
            if (chance <=  300 + a.luk *  3) { b.addState(45) }
            if (chance <=  400 + a.luk *  4) { b.addState(15) }
            if (chance <=  500 + a.luk *  5) { b.addState(11) }
            if (chance <=  600 + a.luk *  6) { b.addState( 9) }
            if (chance <=  700 + a.luk *  7) { b.addState( 7) }
            if (chance <=  800 + a.luk *  8) { b.addState(13) }
            if (chance <=  900 + a.luk *  9) { b.addState( 5) }
            if (chance <= 1000 + a.luk * 10) { b.addState(17) }
            b.addState(56)
        }
        damage  = (((a.mat+Math.pow((a.mat/10), 2)))*(100/(100.00+b.mdf))+((a.mat-b.mdf)/2))*2.25
        damage *= 5.00
        damage *= 0.75 // Status
        damage *= (a.mat*0.01)+1.00
        if (a.isStateAffected(40)) { damage *= 1.25 }
        if (a.isStateAffected(47)) { damage *= 0.75 }
        if (b.isStateAffected(46)) { damage *= 0.75 }
        if (b.isStateAffected(54)) { damage *= 1.25 }
        if (damage <= 0) { damage = 1 }
        damage = parseInt(damage*a.mdr)
        console.log(a.originalName()+": Scan ("+(parseInt(damage*0.8))+"-"+(parseInt(damage*1.2)+")"))
        return damage
    }
}
This is one of the hardest ones I had to make... it takes the users Luck into account and rolls for many effects and damage. If this roll returns effective, then it will forcibly adds states to targets, even if they are normally immune to them (instant death to final boss anyone?), and making them immune to this effect from being re-tried again and again. In order to make sure this effect wont be applied to bosses as often, I have made it so its roughly 3 times harder when in a boss fight, as determined by a simple switch being turned on. At max values, my actors can have up to a 10% chance for instant death on the target, and if its a boss fight its about 3.25%.

That may have been a bit long winded, but its to help motivate you to keep trying! Eventually you, or someone else who attempts to help you will get what you're looking for 😀

Note: If you are wondering why I chose the base damage formula I did, it is in order to make spells and attacks deal damage much longer than your average RPG... normally with RPG maker you will start seeing 0 damage very fast using the common "atk*4-def*2" and my formula makes it so even if you have 500 more Defense than your Attackers Attack, then they might stand a chance of causing some damage. I really didn't want damage to drop off fast in my game and make old areas trivial too soon.
Never give up 😀 When I was making some of my skills and formula's I had some severe issues with setting up, testing, and balancing. Some of the things I tried seemed impossible cause no matter how hard I tried it just didn't seem to work... eventually I solved all of my issues, but the idea to fix it would hit me when I was working on something else... one of those "HEY! Try this <blah>!" while in the middle of working on other things or dealing with real life.

While my spells and attacks don't change effects based on buffs(like how you are wanting it to cast a different spell), I do have them deal increased damage or reduced damage when certain buffs are on me, and ill show you a few of my very odd spells and how I coded them... maybe give you an idea.

Spoiler: Spell Coding
Spoiler: Physical Attack
Code:
Game_Battler.prototype.attack = function(a, b) {
    if (a.isActor()) {
        damage  = (((a.atk+Math.pow((a.atk/10), 2)))*(100/(100.00+b.def))+((a.atk-b.def)/2))
        fi = $gameVariables.value( 8)
        wi = $gameVariables.value( 9)
        wa = $gameVariables.value(10)
        ea = $gameVariables.value(11)
        damage *= ((fi+wi+wa+ea)*0.0025)+1.00
        if (a.isStateAffected(40)) { damage *= 1.25 }
        if (a.isStateAffected(47)) { damage *= 0.75 }
        if (b.isStateAffected(46)) { damage *= 0.75 }
        if (b.isStateAffected(54)) { damage *= 1.25 }
        if (damage <= 0) { damage = 1 }
        damage = parseInt(damage*a.pdr)
        console.log(a._name+": Melee ("+(parseInt(damage*0.8))+"-"+(parseInt(damage*1.2)+")"))
        return damage
    }
    else {
        a._mp += a.mmp/10
        damage  = (((a.atk+Math.pow((a.atk/10), 2)))*(100/(100.00+b.def))+((a.atk-b.def)/2))*1.50
        damage *= (b.level*0.05)+1.00
        if (a.isStateAffected(40)) { damage *= 1.25 }
        if (a.isStateAffected(47)) { damage *= 0.75 }
        if (b.isStateAffected(46)) { damage *= 0.75 }
        if (b.isStateAffected(54)) { damage *= 1.25 }
        if (damage <= 0) { damage = 1 }
        damage = parseInt(damage*a.pdr)
        console.log(a.originalName()+": Melee ("+(parseInt(damage*0.8))+"-"+(parseInt(damage*1.2)+")"))
        return damage
    }
}
In this example it first determines if its an actor or enemy using the skill, if its an actor base damage is 100%, if enemy its 150% (the x1.50).

My game revolves around mastering 4 elements for spells, but if you're spells got too far ahead of the melee attacks then no one would ever use a melee attack, so all my variables are from each element and slowly boost physical damage so that it remains an option for killing without using magic constantly.

The next section with all the "isStateAffected" stuff is where I buff or debuff damage if certain states are inflicted, I never did like the way the default engine handled buffing/debuffing or the Physical Damage/Magical Damage Rates, so I reworked them in different ways.

The next line is where I absolutely hate seeing "Miss" of nothing at all when damage is 0, so I made it so you will always do at least 1 damage.

The Math.parseInt part turns it back into a whole number using the Physical or Magical Damage Rate. The console part sends the potential damage range to the console with the 20% variance calculated already. And the final line send the final result into battle to hit the target.

Spoiler: Flame Spell
Code:
Game_Battler.prototype.flame = function(a, b) {
    if (a.isActor()) {
        damage  = (((a.mat+Math.pow((a.mat/10), 2)))*(100/(100.00+b.mdf))+((a.mat-b.mdf)/2))*1.50
        damage *= 1.40
        damage *= ($gameVariables.value(8)*0.02)+1.00
        if (a.isStateAffected(40)) { damage *= 1.25 }
        if (a.isStateAffected(47)) { damage *= 0.75 }
        if (b.isStateAffected(46)) { damage *= 0.75 }
        if (b.isStateAffected(54)) { damage *= 1.25 }
        if (damage <= 0) { damage = 1 }
        damage = parseInt(damage*a.mdr)
        console.log(a._name+": Flame ("+(parseInt(damage*0.8))+"-"+(parseInt(damage*1.2)+")"))
        return damage
    }
    else {
        damage  = (((a.mat+Math.pow((a.mat/10), 2)))*(100/(100.00+b.mdf))+((a.mat-b.mdf)/2))*2.25
        damage *= 1.40
        damage *= (b.level*0.05)+1.00
        if (a.isStateAffected(40)) { damage *= 1.25 }
        if (a.isStateAffected(47)) { damage *= 0.75 }
        if (b.isStateAffected(46)) { damage *= 0.75 }
        if (b.isStateAffected(54)) { damage *= 1.25 }
        if (damage <= 0) { damage = 1 }
        damage = parseInt(damage*a.mdr)
        console.log(a.originalName()+": Flame ("+(parseInt(damage*0.8))+"-"+(parseInt(damage*1.2)+")"))
        return damage
    }
}
As you can see, this is very much like the Physical Attack, but follows a slightly different setup and only uses one variable. The "damage *= 1.4" is where the spell gets a majority of its oomph when compared to melee hits.

Spoiler: Recover Spell
Code:
Game_Battler.prototype.recover = function(a, b) {
    if (a.isActor()) {
        damage  = a.mat*5
        damage *= 4.20
        damage *= ($gameVariables.value(10)*0.02)+1.00
        if (a.isStateAffected(40)) { damage *= 1.25 }
        if (a.isStateAffected(47)) { damage *= 0.75 }
        if (b.isStateAffected(46)) { damage *= 0.75 }
        if (b.isStateAffected(54)) { damage *= 1.25 }
        if (damage <= 0) { damage = 1 }
        damage = parseInt(damage*a.mdr)
        console.log(a._name+": Recover ("+(parseInt(damage*0.8))+"-"+(parseInt(damage*1.2)+")"))
        return damage
    }
    else {
        damage  = a.mat*5
        damage *= 4.20
        damage *= (a.mat*0.01)+1.00
        if (a.isStateAffected(40)) { damage *= 1.25 }
        if (a.isStateAffected(47)) { damage *= 0.75 }
        if (b.isStateAffected(46)) { damage *= 0.75 }
        if (b.isStateAffected(54)) { damage *= 1.25 }
        if (damage <= 0) { damage = 1 }
        damage = parseInt(damage*a.mdr)
        console.log(a.originalName()+": Recover ("+(parseInt(damage*0.8))+"-"+(parseInt(damage*1.2)+")"))
        return damage
    }
}
In this example the formula is very simple, as it is just a healing spell. Once again the effect can be boosted or lowered by states.

Spoiler: Expose Spell
Code:
Game_Battler.prototype.expose = function(a, b) {
    base  = 10000
    if ($gameSwitches.value(15) == true) { base += 20000 }
    chance = Math.randomInt(base)
    if (a.isActor()) {
        if (a.luk >= 100) {
            if (b.isStateAffected(56)) {
                // Nothing!
            }
            else {
                if (chance <= a.luk *  1) { b.addState( 1) }
                if (chance <= a.luk *  2) { b.addState( 3) }
                if (chance <= a.luk *  3) { b.addState(45) }
                if (chance <= a.luk *  4) { b.addState(15) }
                if (chance <= a.luk *  5) { b.addState(11) }
                if (chance <= a.luk *  6) { b.addState( 9) }
                if (chance <= a.luk *  7) { b.addState( 7) }
                if (chance <= a.luk *  8) { b.addState(13) }
                if (chance <= a.luk *  9) { b.addState( 5) }
                if (chance <= a.luk * 10) { b.addState(17) }
                b.addState(56)
            }
        }
        else {
            if (b.isStateAffected(56)) {
                // Nothing!
            }
            else {
                if (chance <=  100) { b.addState( 1) }
                if (chance <=  200) { b.addState( 3) }
                if (chance <=  300) { b.addState(45) }
                if (chance <=  400) { b.addState(15) }
                if (chance <=  500) { b.addState(11) }
                if (chance <=  600) { b.addState( 9) }
                if (chance <=  700) { b.addState( 7) }
                if (chance <=  800) { b.addState(13) }
                if (chance <=  900) { b.addState( 5) }
                if (chance <= 1000) { b.addState(17) }
                b.addState(56)
            }
        }
        damage  = (((a.mat+Math.pow((a.mat/10), 2)))*(100/(100.00+b.mdf))+((a.mat-b.mdf)/2))*1.50
        damage *= 5.00
        damage *= 0.75 // Status
        damage *= ($gameVariables.value(10)*0.02)+1.00
        if (a.isStateAffected(40)) { damage *= 1.25 }
        if (a.isStateAffected(47)) { damage *= 0.75 }
        if (b.isStateAffected(46)) { damage *= 0.75 }
        if (b.isStateAffected(54)) { damage *= 1.25 }
        if (damage <= 0) { damage = 1 }
        damage = parseInt(damage*a.mdr)
        console.log(a._name+": Scan ("+(parseInt(damage*0.8))+"-"+(parseInt(damage*1.2)+")"))
        return damage
    }
    else {
        if (b.isStateAffected(56)) {
            // Nothing!
        }
        else {
            if (chance <=  100 + a.luk *  1) { b.addState( 1) }
            if (chance <=  200 + a.luk *  2) { b.addState( 3) }
            if (chance <=  300 + a.luk *  3) { b.addState(45) }
            if (chance <=  400 + a.luk *  4) { b.addState(15) }
            if (chance <=  500 + a.luk *  5) { b.addState(11) }
            if (chance <=  600 + a.luk *  6) { b.addState( 9) }
            if (chance <=  700 + a.luk *  7) { b.addState( 7) }
            if (chance <=  800 + a.luk *  8) { b.addState(13) }
            if (chance <=  900 + a.luk *  9) { b.addState( 5) }
            if (chance <= 1000 + a.luk * 10) { b.addState(17) }
            b.addState(56)
        }
        damage  = (((a.mat+Math.pow((a.mat/10), 2)))*(100/(100.00+b.mdf))+((a.mat-b.mdf)/2))*2.25
        damage *= 5.00
        damage *= 0.75 // Status
        damage *= (a.mat*0.01)+1.00
        if (a.isStateAffected(40)) { damage *= 1.25 }
        if (a.isStateAffected(47)) { damage *= 0.75 }
        if (b.isStateAffected(46)) { damage *= 0.75 }
        if (b.isStateAffected(54)) { damage *= 1.25 }
        if (damage <= 0) { damage = 1 }
        damage = parseInt(damage*a.mdr)
        console.log(a.originalName()+": Scan ("+(parseInt(damage*0.8))+"-"+(parseInt(damage*1.2)+")"))
        return damage
    }
}
This is one of the hardest ones I had to make... it takes the users Luck into account and rolls for many effects and damage. If this roll returns effective, then it will forcibly adds states to targets, even if they are normally immune to them (instant death to final boss anyone?), and making them immune to this effect from being re-tried again and again. In order to make sure this effect wont be applied to bosses as often, I have made it so its roughly 3 times harder when in a boss fight, as determined by a simple switch being turned on. At max values, my actors can have up to a 10% chance for instant death on the target, and if its a boss fight its about 3.25%.

That may have been a bit long winded, but its to help motivate you to keep trying! Eventually you, or someone else who attempts to help you will get what you're looking for 😀

Note: If you are wondering why I chose the base damage formula I did, it is in order to make spells and attacks deal damage much longer than your average RPG... normally with RPG maker you will start seeing 0 damage very fast using the common "atk*4-def*2" and my formula makes it so even if you have 500 more Defense than your Attackers Attack, then they might stand a chance of causing some damage. I really didn't want damage to drop off fast in my game and make old areas trivial too soon.

Thanks for the encouragement! How does your code work where do you put it? Do you think I can play around with it and change it so that it checks state of enemy increasing damage taken from spell?
Hopefully someone else here can help me out im really stuck.
Use this as a plugin, and place it at the very top of everything. In the formula box in the skill editor, put in the prototype name like this:

attack formula box
Code:
a.attack(a, b)

"Ice" formula box
Code:
a.ice(a, b)

Your name when making each section in the plugin ( Game_Battler.prototype.NAME = function(a, b) { ) is what you will call in the formula box. So if you use "Game_Battler.prototype.insane = function(a, b)", then in the skill formula box simply put "a.insane(a, b)" and it will call that chunk as the formula 😀

and yes, with a bit of toying around, I'm sure you can make it do exactly what you're wanting it to do... being able to have a real code block instead of the single line rubbish of the editor allows you to do more things and bug fix it in a much simpler method
Use this as a plugin, and place it at the very top of everything. In the formula box in the skill editor, put in the prototype name like this:

attack formula box
Code:
a.attack(a, b)

"Ice" formula box
Code:
a.ice(a, b)

Your name when making each section in the plugin ( Game_Battler.prototype.NAME = function(a, b) { ) is what you will call in the formula box. So if you use "Game_Battler.prototype.insane = function(a, b)", then in the skill formula box simply put "a.insane(a, b)" and it will call that chunk as the formula 😀

and yes, with a bit of toying around, I'm sure you can make it do exactly what you're wanting it to do... being able to have a real code block instead of the single line rubbish of the editor allows you to do more things and bug fix it in a much simpler method

A little complicated for me but looks very cool, I briefly played around with it. I like what it can do but I don't understand any of it haha.

I still need this plugin, I can't believe how nothing like this exists, I did not think it to be that complicated. I found a bunch of what I need for XV. Also lecode released this https://forums.rpgmakerweb.com/index.php?threads/released-side-effects-control.53738/ however it does not seem to work for me.

Can anyone help me even with a skill that links and casts another skill on use, just not based on % but rather allows conditions to be set (states).

EDIT:
OOO I finally found something

<Post-Damage Eval>
if (b.isStateAffected(16)) {
user.forceAction(SkillID, -1);
BattleManager.forceAction(user); }
</Post-Damage Eval>

I don't know what that means why there is a -1 after SkillID but it works, it just casts another spell so I can chain spells dependant on if I put states on enemies 🙂.
Also if I put it post damage is it possible to cancel or more importantly reduce the damage of the skill I used then force the cast of the second skill? Ideally I would like to reduce damage from first skill and have a more powerful second skill cast in its place.
Still need help with this or at least a way on code to cancel the original spell cast

Original thread: https://forums.rpgmakerweb.com/threads/change-skill-conditional-on-state.96435/