If statement not working with Path 3D progress

Hello everyone, there’s this one issue that is driving me mad:
I created a simple time mechanic with a “time on” script with a boolean that turns to false when you talk with NPCs (while their textbox is active).
I also made a Path 3D and a Path 3D follow for an NPC so that a speed variable turns to 0 when time is deactivated (and textboxes are active), in order to make them stop when you talk to them and also make them start again from the last position when you close the textbox.

Thing is, this actually worked until today, I tried installing the 3D smoothing add-on to help with the jitter and now boom: it doesn’t work anymore.

this is the code I wrote on the Path3DFollow Node:

func _process(delta):

if time.time_on == true:
	progress += runspd * delta
else:
	runspd = 0
if time.hours == 9 and time.time_on == true:
	runspd = 3
	state = "normal" 

at first I didn’t need to repeat “if time_on == true” so many times, but since it stopped working I tried everything but it still doesn’t stop while he’s following his path, no matter how many times I try stopping him by calling the textbox.
I see in the debugger that the runspd variable doesn’t turn to 0 when it’s supposed to, but time_on is working as intended.
I can’t understand what happened, any suggestion?

Sounds like you’ll have to start digging in the code for that plugin.

I think I located the issue: no matter what I do, the progress of follow path 3d just won’t stop, even with a tween. I tried binding it to a key aaaand… nothing happened, it’s like the path can’t be interrupted until it reaches the end, why is that?

If you can bash together a little demo project of the situation, I’d be happy to have a look for you.

I solved the problem and I feel so stupid, I forgot I added the NPC script into the autoload so the autoload was taking priority, I just had to delete it from the autoload settings and now everything works as intended, but thank you for your time!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.