bl4cknite Posted January 26, 2016 Share 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 Link to comment Share on other sites More sharing options...
Brutile Posted January 26, 2016 Share 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 Link to comment Share on other sites More sharing options...
bl4cknite Posted January 26, 2016 Author Share Posted January 26, 2016 It doesn't work but thank u for trying. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted January 26, 2016 Share 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 Link to comment Share on other sites More sharing options...
Brutile Posted January 26, 2016 Share 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 Link to comment Share on other sites More sharing options...
reepblue Posted January 26, 2016 Share 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! Link to comment Share on other sites More sharing options...
bl4cknite Posted January 26, 2016 Author Share 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 Link to comment Share on other sites More sharing options...
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.