Jump to content

Can't find prefab?


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
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. 

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...