Jump to content

Function definitions?


Recommended Posts

Hi all,


Just started playing a week ago and now I want to try making my own mods for fun. I was looking at some sample code on how to spawn monsters when a new game is started

function SpawnCreature(player)        --[NEW] Get the player's current position.    local x, y, z = player.Transform:GetWorldPosition()    --[NEW] Spawn a 'Beefalo' prefab at the world origin.  Prefabs are basically a fancy game development term for objects.  Every     --      creature, item and character in 'Don't Starve' is a prefab.    local creature = GLOBAL.SpawnPrefab("forest/animals/beefalo")    --[NEW] Move the creature to the player's position.    creature.Transform:SetPosition( x, y, z )   end--[NEW] Tell the engine to run the function "SpawnCreature" as soon as the player spawns in the world.AddSimPostInit(SpawnCreature)

Are these "functions" (GetWorldPosition(), SpawnPrefab(), AddSimPostInit()) defined anywhere? I cannot seem to find it as it is not as obvious where to look compared to


for example.


Appreciate any help! :-)

Link to comment
Share on other sites



Relative to "..\scripts\"
GetWorldPosition - ??? (Maybe input.lua)
SpawnPrefab - mainfunctions.lua
AddSimPostInit - modutil.lua
Also check out this site.



There they are! Site looks helpful I'll check it out. Thanks

Link to comment
Share on other sites


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