[Resolved]Possible Instance DestroyBug

Xer0botXer0

Senpai
Hi guys,

I've an object that runs a script, in the script a 2D array is looped through filtered down to particular instances, these instances are then destroyed.

The possible bug here is that the object calling the script was destroyed in the process. Right at this point:

Notice the points:

Point 1 'i' variable used for iteration, in correlation with Point 4, current 'i' value is 0.
Point 2 array being looped through is 'arr_bah_items', using 'i' as a reference you can see point 5 shows that the second dimension of the array is 8, which according to point 6 is -1 (uninitialized).

Point 3 shows (probably should've taken the shot while instance_destroy() was in focus) but anyway instance_destroy triggers on an uninitialized entry, destroying the object that's calling this script.
 

TsukaYuriko

☄️
Forum Staff
Moderator
-1 is the value of self which evaluates to the calling instance's instance ID when used in instance-themed functions. This is not a bug, everything is working as intended.

You should use noone in this context for uninitialized entries, not -1/self
 

TsukaYuriko

☄️
Forum Staff
Moderator
Situations such as this one are a perfect example why the manual's hint that "You should also note that using the values instead of the keywords in your code is not at all recommended" is an important thing to keep in mind at all times, as it "could cause issues later on." Potential side effects include but are not limited to spontaneous combustion of calling instances.

You can check the exact values on the keywords manual page - as a reminder of what not to use directly in your code.
 
Top