Gekido2802 Posted January 1, 2015 Share Posted January 1, 2015 How can I make a custom item, spawn at a random position only one time at the world generation? The only thing I've been able to do is spawn the item at the player's current position... Link to comment https://forums.kleientertainment.com/forums/topic/48113-random-spawn-at-world-generation/ Share on other sites More sharing options...
BrotatoTips Posted January 1, 2015 Share Posted January 1, 2015 spawn it at the player position? could you share that code with me? i am having issues doing that. and for your issue, you can try looking at the eye bone files. Link to comment https://forums.kleientertainment.com/forums/topic/48113-random-spawn-at-world-generation/#findComment-595389 Share on other sites More sharing options...
Gekido2802 Posted January 1, 2015 Author Share Posted January 1, 2015 (edited) function SpawnItem(player) --Spawn the item at the world origin.local item = GLOBAL.SpawnPrefab("Your Prefab") --Move the item to the player's position.item.Transform:SetPosition(player.Transform:GetWorldPosition()) end AddSimPostInit(SpawnItem) This will spawn it everytime you enter the game though so I need to find a way to only spawn it once. I did look in the eye bone.It use the GetSpawnPoint function which need what Vector3 function return though I don't know what it return , I don't know where the definition is. In the eye bone file, it use inst.Transform:GetWorldPosition() but when I replace it with player.Transform:GetWorldPosition() I get "attempt to call 'Vector3' (a nil value)" Edited January 1, 2015 by Gekido2802 Link to comment https://forums.kleientertainment.com/forums/topic/48113-random-spawn-at-world-generation/#findComment-595477 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