C
Carbiner
Guest
I am getting an error that references object index, and I don't have any code that does that anymore. Its happening when my controller object tries to assign a destination to its units, in this code:
The ds_priority has the id's of the units it can use prioritized by their distance to the target, which in this script is represented by the variable ats. ats is determined by another script that calls this one.
The target (ats) is set in the second script like this:
These are the screenshots of the error message and debugger:
The thing is, the object index its referencing, (object mapper_base) is destroyed at the beginning of the level, replacing itself with obj_base. The game seems to progress normally until the very end of the level where this error occasionally pops up. This makes it frustrating to debug and hard to pinpoint. I have checked all the scripts that it calls and never once do they mention object_index. They used to, as I used that as a way of fixing my improperly made for loops, but I have fixed those loops and removed all of those checks.
I don't know what to do, so help would be appreciated.
Code:
for(i=0;i<units_per_target;i+=1)
{
inst = ds_priority_delete_min(redone_list);
inst.inv_x = ats.x;
inst.inv_y = ats.y;
Code:
for(i=0;i<number_targets;i+=1)
{
units_adjusted = units_per_target; // Reset the average
units_adjusted += adjustment;
ats2 = ds_priority_delete_max(ats_priority);
scr_ai_unit_control(ats2,units_adjusted);
iv -= 1;
Code:
for(i=0;i<instance_number(obj_base);i+=1)
{
ats = instance_find(obj_base,i);
p1 = scr_ai_base_strength(ats);
p2 = scr_ai_base_distance(ats);
p3 = scr_ai_base_color(ats,p1);
p4 = scr_ai_base_stability(ats);
pt = p1+p2+p3+p4;
if(pt > 0)
{
ds_priority_add(ats_priority,ats,pt);
}
The thing is, the object index its referencing, (object mapper_base) is destroyed at the beginning of the level, replacing itself with obj_base. The game seems to progress normally until the very end of the level where this error occasionally pops up. This makes it frustrating to debug and hard to pinpoint. I have checked all the scripts that it calls and never once do they mention object_index. They used to, as I used that as a way of fixing my improperly made for loops, but I have fixed those loops and removed all of those checks.
I don't know what to do, so help would be appreciated.