custom attack on state expire bug? Yanfly States&Buffs

Discussion in 'Javascript/Plugin Support' started by 22pepperjack, Aug 6, 2018.

  1. 22pepperjack

    22pepperjack Veteran Veteran

    Messages:
    236
    Likes Received:
    72
    Location:
    Northwest Arkansas
    First Language:
    English
    so im not sure if this is the best method for doing this, but it seems to ALMOST work. im using Yanfly's Buffs and States Core and yanflys STB scripts

    Buffs and States Core

    Standard Turn Battle


    what ive done is add in a custom skill for the player character:
    initial skill.png

    when the skill is used it damages the user, and adds a state to said character that provides a double damage boost.
    state.png
    this state lasts for 3 turns, and upon expiring at the end of its last turn, (using the buffs and states core) i attempted to add in a special "Explosion" attack that damages all enemies. without taking up the users turn since it happens after they did their attack, but before the next user attacks.

    the code in the note block:

    <Custom Remove Effect>
    var skill = 12;
    var target = -1;
    BattleManager.queueForceAction(user, skill, target);
    </Custom Remove Effect>

    everything works perfectly fine on the skills initial use, the player takes damage, deals double damage for three turns, and after the third turn they deal an explosive damage to ALL opponents before the opponents attack back. however, if the player uses the skill again AFTER this (on the next turn after the state is removed and the skill used) then it gets stuck in an infinite loop. the player takes damage, the state is applied, but then the state is perpetually at 4 turns remaining and never expires.

    for the life of me i have no clue why the state gets caught in a loop and stops ticking down its turns.

    EDIT: ok so using this ability seems to break the turn counter for all states. battlers and enemies are still able to fight it out no problem, but all states stop counting down after the custom remove skill is used.
     

    Attached Files:

    #1
  2. Autofire

    Autofire PICNIC Solver Veteran

    Messages:
    50
    Likes Received:
    22
    First Language:
    English
    Primarily Uses:
    RMMV
    There are a few possible solutions here, assuming I understood the problem correctly. You might want to implement more than one of these because they change some aspects of the mechanic, though that's up to you.
    1. Put <Reapply Ignore Turns> into your state's note box. I'm exactly sure what's causing this issue, but I believe you don't want the turn counter to increase when the user re-casts this.
    2. Use <Custom Leave Effect> instead of <Custom Remove Effect>. If the state is being reapplied, it's possible that's triggering the removal effect. Keep in mind that Remove gets triggered even if the state is removed by a skill or by death. I'm not sure, but your current system might allow a dead character to use your Unleashed Fury skill, if the circumstances are right...
    3. Using Yanfly's Skill Core plugin, you could make it so that the character cannot use the skill while they have the status. You could use the <Custom Requirement> tags, and use the hasState function to check if the user has the state.
    4. Again, using Yanfly's Skill Core plugin, use the <HP Cost: 25%> instead of having the user attack themselves. This has an extra benefits of putting the health cost into the menu, and it also prevents the player from using the skill if this would be killed by it. This might actually solve your issue, because this isn't considered an attack on the user.
    I'm still not sure I totally understand. These are the things that just occurred to me after looking at the way stuff is set up.
     
    #2
  3. 22pepperjack

    22pepperjack Veteran Veteran

    Messages:
    236
    Likes Received:
    72
    Location:
    Northwest Arkansas
    First Language:
    English
    1 - I have the default settings for the buffs and states core set to ignore the reapplication of states (no stacking) so idk if that changes anything. I tried it and from first glance i dont see any difference across any states/skills but idk lol.

    2 - this is something ive been looking/swapping back and forth between for a bit now as i didnt really understand the difference between the two, ill definitely keep it on "Leave" now that i know thats a risk, my only question is about the end of a battle, if the state is on a character at the end of a battle while using "remove" everything works fine. but if "leave" is applied it seems to leave the battle in a state of limbo? lol

    3 - was gonna implement this next lol now i know how thanks!

    4 - definitely a neat trick, didnt know that little command lol, however im not sure how this prevents the issue? when the skill is used, the damage is instantly dealt to the player and the state is applied, 3 turns later (after that character does whatever they do) the state expires and immediately after the unleashed fury skill is auto used to hit all opponents. after that turns continue as normal.

    ive noticed that if i remove the custom attack from the end of the state nothing bad happens, but the moment that code is implemented and used, all states no longer count down.

    thanks for helping me solve a future problem for the prevent use of active skill thing, but unfortunately the bug still persists. and even worse, i found a comment on Yanfly's site about one of the reasons she is discontinuing the STB script. apparently the use of buffs and states core with STB causes a bug with the STB turn counter that stops it from keeping track. which is the issue im having. :/

    if any ideas exist for how to jumpstart the turn-counters heart after the skill is used, (maybe through common events but i dont really know how those work to be honest lol.) or maybe how to do the same skill but without the buffs and states core. i would really appreciate it.

    P.S. autofire what did you mean by putting the health cost "into the menu" for item 4? and again, thanks!
     
    #3
  4. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,407
    Likes Received:
    2,821
    Location:
    Philippines
    First Language:
    Tagalog
    The problem is that you are using STB together with Force Action.

    As Yanfly said in his site:

    Basically, you can't, at least not with just those plugins. I dont know if theres a fix for this though, especially since Yanfly chose to drop support of his STB CTB and ATB plugins due to the problems they cause to other things.
     
    #4
  5. 22pepperjack

    22pepperjack Veteran Veteran

    Messages:
    236
    Likes Received:
    72
    Location:
    Northwest Arkansas
    First Language:
    English
    Yeah, kinda figured it might not be so simple once I saw that, hopefully one exists or can be found. Thanks for the help tho!
     
    #5
  6. Autofire

    Autofire PICNIC Solver Veteran

    Messages:
    50
    Likes Received:
    22
    First Language:
    English
    Primarily Uses:
    RMMV
    Oh yeah... forgot about that issue. That makes things... pretty hard. If I had the time I'd attempt to fix it, but I've heard it's pretty complex.

    I wasn't totally sure what was causing the issue. It kind of sounded like it had to do with the actor hitting themselves, causing something to happen. Giving the skill an HP cost makes it so that the character isn't being attacked while still making them lose HP.
     
    #6

Share This Page