Master Cabalist
Member
I'm getting an "Invalid with reference" on my path_start function call. I think it is referring to the "with" command I use right above path_start. I tried putting in an if clause before the with(inst) and it still has a problem.
The code is here, its a little lengthy but mostly repetitious:
And here is the exact error:
For the "with(inst)", inst=noone is set in the create event
The code is here, its a little lengthy but mostly repetitious:
GML:
//////////////DRAW TRAIL OF BATS////////////////////
///////////////////////////////////////////////
draw_trail_of_bats--;
global.spacing_myTimer += 0.001;
if (global.spacing_myTimer > 1.0)
{
global.spacing_myTimer = 1.0;
}
global.spacing_myTimer2 += 0.001;
if global.spacing_myTimer2 > 1.0
{
global.spacing_myTimer2 = 1.0;
}
global.spacing_myTimer3 += 0.001;
if global.spacing_myTimer3 > 1.0
{
global.spacing_myTimer3 = 1.0;
}
if (draw_trail_of_bats <= 0)
{
//inst =
//path from grasslands to forest?
if (inst == noone)
{
inst = instance_create(300, 371, SentryBatWalkMap);
}
if (inst != noone)
{
with (inst)
{
path_start(GrasslandsToForestTrail, 5, path_action_stop, 0);
show_debug_message("Spacing myTimer:" + string(global.spacing_myTimer));
show_debug_message("Path Position: " + string(path_position));
path_position = global.spacing_myTimer;
show_debug_message("Updated path_position" + string(path_position));
path_end();
}
}
draw_trail_of_bats = room_speed;
//a path from forest to snow
if (inst2 == noone)
{
inst2 = instance_create(378, 354, SentryBatWalkMap);
}
if (inst2 != noone)
{
with (inst2)
{
path_start(ForestToSnowTrailbk, 5, path_action_stop, 0);
show_debug_message("Spacing myTimer:" + string(global.spacing_myTimer2));
show_debug_message("Path Position: " + string(path_position));
path_position = global.spacing_myTimer2;
show_debug_message("Updated path_position" + string(path_position));
path_end();
}
}
//open up snow level
//from snow to lava
if (inst3 == noone)
{
inst3 = instance_create(464, 254, SentryBatWalkMap);
}
if (inst3 != noone)
{
with (inst3)
{
path_start(SnowToLavaTrailbk, 5, path_action_stop, 0);
show_debug_message("Spacing myTimer:" + string(global.spacing_myTimer3));
show_debug_message("Path Position: " + string(path_position));
path_position = global.spacing_myTimer3;
show_debug_message("Updated path_position" + string(path_position));
path_end();
}
}
}
Line 54 points to the first path_start function call.___________________________________________
############################################################################################
ERROR in
action number 1
of Step Event0
for object TravelMasterbk:
invalid with reference
at gml_Object_TravelMasterbk_Step_0 (line 54) - path_start(GrasslandsToForestTrail, 5, path_action_stop, 0);
############################################################################################
gml_Object_TravelMasterbk_Step_0 (line 54)
For the "with(inst)", inst=noone is set in the create event