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 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 Share on other sites More sharing options...
Gekido2802 Posted January 1, 2015 Author Share Posted January 1, 2015 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)" 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.