noob - timer.wait_time not changing the time the node is set to run.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GarrettGemini

I’m using a timer to limit how long a missile exists. I want to be able to adjust this based on the quality of the weapon used.
scene structure is area2d/timer.


extends Area2D

var vel = Vector2()
var pos = Vector2()

func _ready():
    $range_timer.wait_time = world.missile_stats["range"]
    print( str($range_timer.wait_time) )

func _on_range_timer_timeout():

This does print out the wait_time I set, but the missile lives for the amount of time that is set in the GUI’s node inspector.
I have also tried to adjust with a local variable and fixed float/int values, tried setting the node inspector value to 0.0 and tried the older code of .set_wait_time() (which is not valid code any more.)

:bust_in_silhouette: Reply From: kidscancode

Is your timer set to autostart? Disable that and add $range_timer.start() after you set the wait_time.

I should have thought of that. …but won’t forget it now!! Thank you very much!!

GarrettGemini | 2018-03-29 19:50

:bust_in_silhouette: Reply From: zhangyao

I think the proper setter of wait time should be