nebrosarth Posted July 12, 2019 Share Posted July 12, 2019 I want a command to spawn an explosion after creature death. However, c_spawn"gunpowder".components.explosive:OnBurnt() spawns it under cursor, not in creature location. I tried SpawnPrefab("gunpowder").Transform:SetPosition(inst.Transform:GetWorldPosition()), but idk how to ignite it lol. I need to connect .components.explosive:OnBurnt()) and .Transform:SetPosition(inst.Transform:GetWorldPosition()), but idk how to do it too. If there are another ways to do so let me know! Link to comment Share on other sites More sharing options...
IronHunter Posted July 12, 2019 Share Posted July 12, 2019 store the prefab in a variable then add any desirable commands afterward e.g. local kaboom = SpawnPrefab("gunpowder") kaboom.Transform:SetPosition(inst.Transform:GetWorldPosition()) if kaboom.components.explosive then kaboom.components.explosive:OnBurnt()) end 1 Link to comment Share on other sites More sharing options...
nebrosarth Posted July 13, 2019 Author Share Posted July 13, 2019 22 hours ago, IronHunter said: store the prefab in a variable then add any desirable commands afterward e.g. local kaboom = SpawnPrefab("gunpowder") kaboom.Transform:SetPosition(inst.Transform:GetWorldPosition()) if kaboom.components.explosive then kaboom.components.explosive:OnBurnt()) end Oh, thanks, It works just fine. local function explode(inst) local kaboom = SpawnPrefab("gunpowder") kaboom.Transform:SetPosition(inst.Transform:GetWorldPosition()) if kaboom.components.explosive then kaboom.components.explosive:OnBurnt() end end local function OnDeath(inst) inst:DoTaskInTime(0, explode) end Link to comment 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