bl4cknite Posted January 26, 2016 Posted January 26, 2016 Script.respawnPoint = "" -- entity "Resspawn point" function Script:Collision (entity, position, normal, speed) if (entity:GetKeyValue ("name") == "Player") then spawnpos = self.respawnPoint:GetPosition() entity:SetPosition(spawnpos) spawnRot = self.respawnPoint:GetRotation() entity.script.camRotation = spawnRot end end hi i was trying to have it when the player hits a place it brings them back to the area before. i had it working but nor it kills the player sometimes when he hits the trigger. Thanks in advance. Quote
Brutile Posted January 26, 2016 Posted January 26, 2016 The only thing I can see wrong with it is that you have local variables that haven't been created with the "local" keyword. Script.respawnPoint = "" -- entity "Resspawn point" function Script:Collision (entity, position, normal, speed) if (entity:GetKeyValue ("name") == "Player") then local spawnpos = self.respawnPoint:GetPosition() entity:SetPosition(spawnpos) local spawnRot = self.respawnPoint:GetRotation() entity.script.camRotation = spawnRot end end Quote
bl4cknite Posted January 26, 2016 Author Posted January 26, 2016 It doesn't work but thank u for trying. Quote
AggrorJorn Posted January 26, 2016 Posted January 26, 2016 Are you by any chance following the saturn tutorial project? Because the issue there is that you hit a place, which triggers a re-positioning. However, on the player script, the hurt function is triggered, causing the player to die as well. Quote
Brutile Posted January 26, 2016 Posted January 26, 2016 I'd recommend searching through the code and find all occurrences where the hurt function is called. See if you can spot anything that shouldn't be happening. Quote
reepblue Posted January 26, 2016 Posted January 26, 2016 I wouldn't make a trigger respawn the player like this. It'd be better if you'd intergrate the respawn code in the player script. Then call the player's respawn function with the trigger or when the player's health reaches 0. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon!
bl4cknite Posted January 26, 2016 Author Posted January 26, 2016 i got it working a little bit better now i moved the point i wanted to go up more the player was hitting the floor and taking damage Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.