Jump to content

Throwable Weapons - SpawnPrefab having issues


Recommended Posts

This is the error I'm currently getting:

[string "scripts/mainfunctions.lua"]:249: bad argument #1 to 'find' (string expected, got nil)

So either saved isn't actually supposed to be the item name (i.e. lucy) and my (item) in SpawnSaveRecord is too much of a departure from the original (inst._spear), though (inst._item) didn't work as saved became nil, or SpawnPrefab is trying to work with the variable name, rather than it's value.

This is what I have there:

local item = prefab
	print("Weapon is", item)
	local throwable = GLOBAL.SpawnSaveRecord(item)   --Saved is coming up as the item now, but now: [string "scripts/mainfunctions.lua"]:249: bad argument #1 to 'find' (string expected, got nil)
	print("Throwable is", throwable)   --am I gonna have to edit the SpawnPrefab function so it stringifies what item is rather than literally using item?
	throwable.Transform:SetPosition(inst:GetPosition():Get())  --I would have to edit the SpawnSaveRecord one too, wouldn't I?
Edited by Hero Complex
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...