I'm trying to make a system to set functions with a frame delay, then execute them when the delay is up. The system works right now for delaying functions that have no arguments, however as it is right now it doesn't work on functions with arguments, as the argument count depends on the function. I think I have a way to make it work using arrays, but I'm not sure how, if I can, transfer the contents of an array to a call_deferred as actual functions. Is there any way to do this? Right now it looks like
if args.size() == 0:
#If there are no elements in the args array, run the function normally
get_node(commander).call_deferred(qFunction)
queue_free()
elif args.size() > 0:
#If there are elements in the args array, run the function using the elements as args
get_node(commander).call_deferred(qFunction, args)
queue_free()
Obviously the problem with this is that it'll try to run the qFunction with the args array as an argument. I'm looking for a way to have it run the qFunction, but using each array element as an argument. Is there any way to do that?