How to force a player to drop loot after the timer hits 0? (On multiplayer)

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

I’m still learning, but i seriously need help on this one, is there a way to force a player to drop one loot after timer stops?

:bust_in_silhouette: Reply From: timothybrentwood
var loot_timer    
func _ready():
	loot_timer =
	loot_timer.wait_time = 5
	loot_timer.one_shot = true
	# here is where you can specify what function gets called
	# when the timer timers out, in this case it's drop_one_loot
func some_func_to_start_timer():

# called when loot_timer times out based on the connect() function above
func drop_one_loot():
	var loot_to_drop = get_loot_to_drop()

That code would go in your player class. Your implementation of get_loot_to_drop() and drop_loot() are entirely up to how you’ve structured your loot system and game as a whole though. I would need more information about how your code is structured if you need help with that part.

Now that I think of it, is this for one loot to be dropped? Or the entire loot? Cuz I forgot to specify that the player can choose what to drop (1item) from the player’s inventory

Nexxt | 2021-05-03 16:48