Problem with Yanfly's Skill Cost Manager Script

● ARCHIVED · READ-ONLY
Started by Maximus32 1 posts View original ↗
  1. I have a problem with this script.

    So, there is a custom requirement "A" I have for action "X" that pertains to the number of live enemies of a certain ID in the troop. "A" is satisfied when all of the battlers’ actions are set (therefore action "X" is added to the action list), but when the player attacks and kills an enemy, the game fails to meet "A" anymore. Come time to execute action "X", I think that because the condition is false, my game gets stuck in an endless loop.

    Here is the requirement. The "$game_eggas" object has been initialized already and its "eggas" method simply returns the number of eggas in battle and prints it to the console.

    <custom cost requirement>$game_eggas.eggas == 2</custom cost requirement> 
    Code:
    def eggas  eggas = $game_troop.live_member_ids.select { |a| a == 21 }  puts(eggas.length)  return eggas.lengthend
    You can see that it runs the method 8 times when setting the enemies' actions, which is fine.

    1.png

    As soon as I kill one of the eggas, however, it runs again ad infinitium, and I'm not sure why

    2.png

    It might be that the game cannot execute action "X" (because condition "A" is being violated), yet it has already been set to be executed, so the game gets stuck there gets stuck there...

    In that case, is there a way to prevent this engine from checking certain custom requirements right before executing the action?

    I attempted asking on Yanfly's channel, but I have yet to receive a response...