mavi Posted June 17, 2015 Share Posted June 17, 2015 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 startedfunction 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 toinst.components.inventory:GiveItem(GLOBAL.SpawnPrefab(v))for example. Appreciate any help! Link to comment Share on other sites More sharing options...
Blueberrys Posted June 17, 2015 Share Posted June 17, 2015 @maviRelative to "..\scripts\" GetWorldPosition - ??? (Maybe input.lua)SpawnPrefab - mainfunctions.luaAddSimPostInit - modutil.lua Also check out this site. Link to comment Share on other sites More sharing options...
mavi Posted June 17, 2015 Author Share Posted June 17, 2015 @maviRelative to "..\scripts\" GetWorldPosition - ??? (Maybe input.lua)SpawnPrefab - mainfunctions.luaAddSimPostInit - 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 More sharing options...
Recommended Posts
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.