Jump to content

Recommended Posts

I'm new to modding and don't understand why the game can't seem to find my prefab.

 

require "prefabutil"

local Assets=
{
	Asset("ANIM", "anim/wharang_dango.zip"),
}

local function fn(Sim)
	local inst = CreateEntity()
	inst.entity:AddTransform()
	inst.entity:AddAnimState()
    
    inst.AnimState:SetBank("wharang_dango")
	inst.AnimState:SetBuild("scroll")
	inst.AnimState:PlayAnimation("idle", true)
	MakeInventoryPhysics(inst)

	
	inst:AddTag("wharangmod")
	
    inst:AddComponent("inspectable")
    
    inst:AddComponent("fuel")
    inst.components.fuel.fuelvalue = TUNING.SMALL_FUEL
    
	MakeSmallBurnable(inst, TUNING.SMALL_BURNTIME)
    MakeSmallPropagator(inst)
    
    
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.atlasname = "images/inventoryimages/wharang_dango.xml"
	

    return inst
end

return Prefab("common/inventory/scroll", fn, Assets),

any help would be appreciated.

Link to comment
https://forums.kleientertainment.com/forums/topic/94032-cant-find-prefab/
Share on other sites

Did you add your prefab to the list of prefabs in your modmain.lua file?
If not, then that might be the reason why. :p To add it simply open the modmain.lua file and there you'll see something like:

   PrefabFiles = { "YourCharacter" }

Simply add your prefab there so it'll look like that:

   PrefabFiles = { "YourCharacter", "YourPrefabHere" }

However, if you did add it and it doesn't work, then I'm guessing it could be probably just a typo somewhere. So simply make sure that you typed the name of your prefab file everywhere correctly. 

On 7/27/2018 at 4:57 PM, rockninja said:

inst.components.inventoryitem.atlasname = "images/inventoryimages/wharang_dango.xml"

Did you also add all of the item's custom images to the Assets = { } section in your modmain.lua?

Assets = {
    Asset( "IMAGE", "images/inventoryimages/wharang_dango.tex" ),
    Asset( "ATLAS", "images/inventoryimages/wharang_dango.xml" ),   
       }

You should add it along with all the other assets which are already there. (If there currently are any)

Edited by BraveChicken

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
×
  • Create New...