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 https://forums.kleientertainment.com/forums/topic/55360-function-definitions/ 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 https://forums.kleientertainment.com/forums/topic/55360-function-definitions/#findComment-647779 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 https://forums.kleientertainment.com/forums/topic/55360-function-definitions/#findComment-647832 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now