Line723 TypeError occurred

I get this funny error that only pops up when I load a saved game. It is an error from the Game_BattlerBase script.

line 723: TypeError occurred.
no implicit conversion from nil to integer.

So it's this thing:

#--------------------------------------------------------------------------
  # * Determine Usability of Normal Attack
  #--------------------------------------------------------------------------
  def attack_usable?
  usable?($data_skills[attack_skill_id])     <---  Line 723
  end

I do have one script that deals with attack skill id's. It is the Yanfly WeaponAttackreplace. In it, I can give weapons specific normal attack id's. This only happens when I load up a saved game though. The script works fine from new game.

But just in case for whatever reason it isn't that script despite the evidence. Here are all my scripts:

YanflyWeaponAttackreplace

Tsukihime EffectManager

Tsukihime Autostate

Tsukihime Instance items and the fix for it

Equipmentbase script and the equipmentlevel script from Selchar and Tsukihime.

Just me trying to learn a little bit when it says no implicit conversion from nil to integer. Is it trying to tell me that there is no automatic change from attack skill id 1 to whatever the id is for any equipped weapon?
It means you're trying to access an array using nil, which is not supported. It requires an integer, as the message indicates.


So for whatever reason, attack_skill_id points to nil.


If you added the script recently and tried to test on a saved file, it may not be initialized properly.
If you added the script recently and tried to test on a saved file, it may not be initialized properly.
Nope. I always completely exit the editor then restart it after installing a script.
No I mean if you try to load a save file, the save file may not have the required data initialized.


Yanfly's scripts generally do not provide support for save files.
Scripts that modify properties in the data ($game) classes will almost ALWAYS have issues if you add the script and then try to resume a game that was saved before the script was added. It does not surprise me that you are getting this error when trying to load an older save file.


Start a new game, save it, then try to reload it. I suspect the error will not happen.
Scripts that modify properties in the data ($game) classes will almost ALWAYS have issues if you add the script and then try to resume a game that was saved before the script was added. It does not surprise me that you are getting this error when trying to load an older save file.

Start a new game, save it, then try to reload it. I suspect the error will not happen.
Actually, I've done this too. This was how I figured out that it was the save causing the error. It wouldn't show up when I played from new game but once I loaded after making non script related edits to basic parameters of a weapon and testing it, the error appeared.

So I take it I should look for another cool script like that one? Because it's a really good one but if I can't load a file without it crashing.. 🙁
Are you loading from a saved game that was created before adding the script?


If so, then Hime's Instance Weapons that have been created before that point have no @attack_skill, so it returns nil. And because Yanfly's notetag loads on data initialize (at the game start), it is not re-reading the additional created instance items' notetag.


Just start a new game and try saving from there. I bet it won't throw any error.
Are you loading from a saved game that was created before adding the script?
No. I started a new game after both adding the script and restarting RPGMaker. I Played from this new game, then saved. Then loaded that save file. And it began to crash.

But I think I found a very similar script that helps me overcome this problem.

Kread EX states that he took this script idea and used it to use Custom Weapon formulas. Works just the same as the Yanfly script only with

the formula in the weapon tag. And it works without crashes =D.
There's also this script, which is similar to yanfly's attack replace, except it applies to all database objects related to actors/enemies.


http://www.himeworks.com/2014/03/11/attack-skill-command/


command_attackSkill1.jpg



I wasn't aware that you could execute a different skill using kread-ex's script.
You started a new game, but then you DID go in and edit things in the database.

Original thread: https://forums.rpgmakerweb.com/threads/line723-typeerror-occurred.25240/