[Ace] Undefined method: "item" for nil:nilclass?

EternalShadow

Veteran
Veteran
Joined
Sep 16, 2012
Messages
5,781
Reaction score
1,041
First Language
English
Primarily Uses


alias cp_bv2_use_item use_item def use_item ## Process an actor set switch. item = @subject.current_action.item <----- The relevant line if !item.swap_party.nil? && item.swap_party > 0 user_swap_party else cp_bv2_use_item end endRight at the end of battle, just after EXP/items obtained are stated.This only appears when the skill "Ultimate Burst" is used, and ends the battle with sufficient damage.

I can't see any database issues. This hasn't happened before, and I don't think I changed anything special.

What does this error mean?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,667
First Language
German
Primarily Uses
RMMV
In 99% of all cases it means that you loaded an old savegame after adding a new script.


Technically it means that some data wasn't initialized, and in 99% of all cases the scripts initialize their data on the "new game" command, so if you added a script and then loaded an old savefile from before that script was added, then the "undefined for NIL" error messages pop up when the data from the script is needed.
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,202
First Language
Binary
Primarily Uses
RMMZ
it means that the variable @subject.current_action does not have a legitimate object associated with the current_action method. which is causing the item method to be called on a nil object, which does not have an item method.

Try this?

Code:
 alias cp_bv2_use_item use_item  def use_item  ## Process an actor set switch.    return unless @subject && @subject.current_action    return unless item = @subject.current_action.item    if !item.swap_party.nil? && item.swap_party > 0      user_swap_party    else      cp_bv2_use_item    end  end
 
Last edited by a moderator:

Hudell

Dog Lord
Veteran
Joined
Oct 2, 2014
Messages
3,545
Reaction score
3,715
First Language
Java's Crypt
Primarily Uses
RMMZ
In 99% of all cases it means that you loaded an old savegame after adding a new script.

Technically it means that some data wasn't initialized, and in 99% of all cases the scripts initialize their data on the "new game" command, so if you added a script and then loaded an old savefile from before that script was added, then the "undefined for NIL" error messages pop up when the data from the script is needed.
I've noticed a lot of scripts doing this and I really wonder why they don't do the proper checks  on the "load game" command too. It'd be just a couple of extra lines and would make everyone's life easier.
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,202
First Language
Binary
Primarily Uses
RMMZ
No worries dude, it really wasnt any hassle at all :D
 

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,848
Messages
1,016,974
Members
137,562
Latest member
visploo100
Top