I am making a game and want it to get the pack file from online. I cannot figure out the problem. My code:

extends Node

func _ready():
	$HTTPRequest.download_file = "https://pastebin.com/raw/vkm7jxkY"


# warning-ignore:unused_argument
# warning-ignore:unused_argument
# warning-ignore:unused_argument
func finish_load(result, response_code, headers, body):
	print(body)
	print(result)
	print(response_code)
	print(headers)
	var f = File.new()
	f.open("user://tmpPck.pck", File.WRITE)
	f.store_string(body)
	f.close()
# warning-ignore:return_value_discarded
	ProjectSettings.load_resource_pack("user://tmpPck.pck")
# warning-ignore:return_value_discarded
	get_tree().change_scene("res://title.tscn")

And my scene tree is a Node with an HTTPRequest as a child. Those are the exact node names.

Can someone help me?

Are you getting any errors in the Godot console or anything? Also, instead of storing the data using store_string, have you tried using store_buffer? I think the body argument from the HTTP request is a PoolByteArray, so you probably need to use store_buffer to store the array into a file.

No, no errors. Not even anything printing. I'm not sure the request is working or if bot detection is messing with it. No response at all from the console.

Also here's my new code:

extends Node

func _ready():
	$HTTPRequest.download_file = "https://pastebin.com/raw/vkm7jxkY"


# warning-ignore:unused_argument
# warning-ignore:unused_argument
# warning-ignore:unused_argument
func finish_load(result, response_code, headers, body):
	print("got stuff")
	if not response_code in range(200, 300):
		print("HTTP ERROR:"+response_code)
	print(body)
	print(result)
	print(response_code)
	print(headers)
	var f = File.new()
	f.open("user://tmpPck.pck", File.WRITE)
	f.store_buffer(body)
	f.close()
# warning-ignore:return_value_discarded
	ProjectSettings.load_resource_pack("user://tmpPck.pck")
# warning-ignore:return_value_discarded
	get_tree().change_scene("res://title.tscn")

I think you need to call the request function after setting the download file to tell the HttpRequest node to start the download.

11 days later
a year later