Yanfly Skill Cooldowns crashing? [solved]

So in the later part of my game, you can switch party members mid-battle.

This switching is done via Neonblack CP Battle Engine:

http://forums.rpgmakerweb.com/index.php?/topic/4811-cps-battle-engine/

However, the game crashes when doing so.

The crash comes from:

https://yanflychannel.wordpress.com/rmvxa/gameplay-scripts/skill-restrictions/

Screenshot:

LSaO90q.png


Could a patch be made to make these two compatible and prevent the crash when using the "switch" (which is oddly called the "party" 'skill') in battle?

Thanks!
It seems that the called skill got no warmup defined, which is weird because it should be initialized from the start...

Try to change the method from where the error comes to this:

def warmup?(skill) skill = skill.id if skill.is_a?(RPG::Skill) wwww = $data_skills[skill].warmup.nil? ? 0 : $data_skills[skill].warmup return [wwww * wur, 0].max.to_i endI guess that's the method from where the error happens, right? I modified that script in my old project, so line 594 is most probably not the same for me, and I am not in the mood to load Yanflys's site with my epic connection to download a fresh copy. 😛 Try it out, and see if it works or not!

Edit:

Yeah, I just read CP's party switch code. It actually creates a new skill manually, and since Yanfly's warmup initialization is done only on startup, the new 'party switch' skill won't have a warmup and makes the game crash.

The above little change should fix it, but there are a bunch of other variables missing too, so you will most probably encounter other errors too.

If that happens, try to put the below snippet immediately below CP's Battle Engine:

Spoiler
Code:
class Game_Action  ## Adds a switch skill and who to switch with.  def set_swap_party(id = 0)    if id > 0      $data_skills.push(RPG::Skill.new)      $data_skills[-1].swap_party = id      $data_skills[-1].speed += CP::BATTLERS::SWITCH_SPEED      $data_skills[-1].id = $data_skills.size - 1      $data_skills[-1].load_notetags_srs if $data_skills[-1].warmup.nil? # loads Yanfly's stuff      @item.object = $data_skills[-1]    else      @item.object = $data_skills[1]    end    self  endend
Yeah, "undefined method ... for nil class" is often a cause of adding a script then trying to resume a game saved before the script was added. As I've just said in another thread - when you get this message, the first thing you should do is start a new game and see if the error still happens.
Yeah, "undefined method ... for nil class" is often a cause of adding a script then trying to resume a game saved before the script was added. As I've just said in another thread - when you get this message, the first thing you should do is start a new game and see if the error still happens.
I am starting from a new game 😛

I will try sixth's fixes now, thanks.

EDIT: Muchas gracias, Sixth!! 😀

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-skill-cooldowns-crashing-solved.42503/