Jump to content

childspawner troubles


HomShaBom

Recommended Posts

I'm working no my first mod, and my 1st step is trying to get a bunch of birds spawning around a structure.

 

I looked at how beebox and beehive spawn bees, so I tried modifying the homesign to add a childspawner to it and make it spawn crows.

 

When I test the mod I'm not seeing any errors, but crows are not spawning. What am I missing here?

 

modmain.lua:

function fn(inst)    inst:AddComponent("childspawner")    inst.components.childspawner.childname = "crow"    inst.components.childspawner:SetRegenPeriod(1)    inst.components.childspawner:SetSpawnPeriod(1)    inst.components.childspawner:SetMaxChildren(10)    inst.components.childspawner:StartSpawning()endAddPrefabPostInit("common/objects/homesign", fn)
Link to comment
Share on other sites

I figured it out. In the homesign.lua file they refer to the prefab as "common/objects/homesign" so i thought I had to use that name here. It worked once i changed it to AddPrefabPostInit("homesign", fn)


I figured it out. In the homesign.lua file they refer to the prefab as "common/objects/homesign" so i thought I had to use that name here. It worked once i changed it to AddPrefabPostInit("homesign", fn)

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