Casper CSCA Encyclopedia Crash

Ninjakillzu

Veteran
Veteran
Joined
Aug 19, 2013
Messages
129
Reaction score
40
First Language
English
Primarily Uses
RMVXA
I've been having a crash related to Casper's CSCA Encyclopedia, when I kill a certain enemy. Here's the backtracer log.

Code:
Casper - CSCA Encyclopedia:1475:in `csca_set_defeated': undefined method `+' for nil:NilClass, NoMethodError
    from Casper - CSCA Encyclopedia:1758:in `perform_collapse_effect'
    from Yanfly - Ace Battle Engine:3030:in `perform_collapse_check'
    from Yanfly - Ace Battle Engine:3008:in `apply_item_effects'
    from MA - DW Individual Strikes:63:in `apply_item_effects'
    from Scene_Battle:597:in `invoke_item'
    from Yanfly - Ace Battle Engine:3109:in `invoke_item'
    from Yanfly - Ace Battle Engine:3093:in `block (2 levels) in use_item'
    from Yanfly - Ace Battle Engine:3093:in `times'
    from Yanfly - Ace Battle Engine:3093:in `block in use_item'
    from Yanfly - Ace Battle Engine:3089:in `each'
    from Yanfly - Ace Battle Engine:3089:in `use_item'
    from Yanfly - Ace Battle Engine:2990:in `execute_action'
    from Yanfly - Instant Cast:303:in `execute_action'
    from Yanfly - Visual Battlers:655:in `execute_action'
    from Scene_Battle:550:in `process_action'
    from Scene_Battle:48:in `update'
    from Scene_Base:14:in `main'
    from SceneManager:23:in `run'
    from Main:10:in `block in <main>'
The enemy is no different from all the other enemies I have made, so I'm not really sure why it would crash, which leads me to believe there might be a weird script interaction or something. Here's line 1475 from the script.
Code:
  def csca_set_defeated(enemy, number = 1)
    @csca_defeated_number[enemy.id] += number
  end
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,352
Reaction score
11,942
First Language
English
Primarily Uses
RMMV
That means whatever the enemy id is, there isn't a corresponding element in the @csca_defeated_number array.

Did you start and save a game, then add this script, then resume the saved game? That would cause this error.

If not, can you please provide a link to that script?
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
4,648
Reaction score
5,294
First Language
Indonesian
Primarily Uses
RMVXA
Or try this
Code:
((@csca_defeated_number ||= {})[enemy.id] ||= 0)+= number
 

Ninjakillzu

Veteran
Veteran
Joined
Aug 19, 2013
Messages
129
Reaction score
40
First Language
English
Primarily Uses
RMVXA
That means whatever the enemy id is, there isn't a corresponding element in the @csca_defeated_number array.

Did you start and save a game, then add this script, then resume the saved game? That would cause this error.

If not, can you please provide a link to that script?
I honestly don't remember if I did the whole save, then add, then resume thing. One thing I could do is start a new game, and kill the enemy to see if it still crashes.

Script Link
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,352
Reaction score
11,942
First Language
English
Primarily Uses
RMMV
Or try this
Code:
((@csca_defeated_number ||= {})[enemy.id] ||= 0)+= number
Well, I was about to say the same thing ... just in 10 lines :D


I honestly don't remember if I did the whole save, then add, then resume thing. One thing I could do is start a new game, and kill the enemy to see if it still crashes.
Code:
    for i in 0..$data_enemies.size
      @csca_enemies[i] = false
      @csca_defeated_number[i] = 0
    end
Yes, this definitely sets up an element for each enemy when you start a new game, so would definitely cause that error if you resumed a game that you'd started & saved before adding the script.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
4,648
Reaction score
5,294
First Language
Indonesian
Primarily Uses
RMVXA
Well, I was about to say the same thing ... just in 10 lines :D
Eh now that I looked it back, I'm not even sure if this syntax would work.
More lines are probably better, for both making sure it works and readability.
 

Ninjakillzu

Veteran
Veteran
Joined
Aug 19, 2013
Messages
129
Reaction score
40
First Language
English
Primarily Uses
RMVXA
I started a new game and the crash is gone. Problem solved! Looks like the save was the issue. Hopefully I won't have any other problems with it.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,352
Reaction score
11,942
First Language
English
Primarily Uses
RMMV
Just be aware that this happens sometimes with scripts - if you get any kind of "undefined" error, always try to recall if you added a script then resumed a game that had been started & saved earlier.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,068
Reaction score
6,698
First Language
German
Primarily Uses
RMMV
Looks like the save was the issue.
part of your current script data is always saved, and if you change scripts then load the old version of the script data, this can happen.
which means that as long as you're still changing scripts you have to start a new game at every playtest.

which is why we suggest to get the scripts done first, before doing any playtesting or story development.
 

kyonides

Veteran
Veteran
Joined
Nov 17, 2019
Messages
53
Reaction score
12
First Language
English
Primarily Uses
RMXP
for i in 0..$data_enemies.size

That's real nonsense! There's no enemy 0 (replace it with 1) nor enemy size like in 100 because the array actually has 101 elements. You'd need to add a third dot there to prevent any issues that might show up later on.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Made Custom ENEMY Information Screen
I'm having such a hard time thinking of an interesting battle system. and not being a coder, certain things I wanna do seem a lot harder lol.
Created a character outline with some code. I have no use for this. I'm....bored.....
Having lots of fun using different PS brushes to add a lil' texture to the floors and walls in my maps.

Forum statistics

Threads
93,721
Messages
914,912
Members
123,324
Latest member
ahmbor
Top