Casper CSCA Encyclopedia Crash

Ninjakillzu

Veteran
Veteran
Joined
Aug 19, 2013
Messages
132
Reaction score
42
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,458
Reaction score
12,015
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,691
Reaction score
5,363
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
132
Reaction score
42
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,458
Reaction score
12,015
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,691
Reaction score
5,363
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
132
Reaction score
42
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,458
Reaction score
12,015
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,205
Reaction score
6,761
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
54
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

I'm currently being attacked by the RPG Maker Hydra: fixing one problem only to have two more rise to take its place.
Hey you! Yeah YOU! Whatcha doin' not backing up your projects? You a masochist or sumthin'? GO BACK UP YOUR PROJECTS! Sheeesh... Didn't think I'd hafta spell it out for yas.
now I need to determine, how MV determines if an auto tile is complete or not.
Edit:From what I can tell it uses Autotile kinds to do that.
Edit 2: The editor determines it and packs picture data for the engine....
Finished with the ground work for my class system, using Ellye's Class Change Equipment and Yanfly's Class Change Core plugins to implement an equip based subclass feature!
Hi people! I was wondering... Here in Brazil, we have a whats app group for we talk about rpg maker and our projects. A more informal way for we meet each other. Is there any whats app group out there? :)

Forum statistics

Threads
94,282
Messages
919,663
Members
124,023
Latest member
CodeLoser
Top