YouGroove Posted March 9, 2015 Share Posted March 9, 2015 Lua says p0 is nill in the line of code below, when the player script runs a raycast : function Script:Raycast() local p0p = self.p0:GetPosition(true) ... Start() function code : self.p0 = self.entity:FindChild("p0") self.p1 = self.entity:FindChild("p1") Quote Stop toying and make games Link to comment Share on other sites More sharing options...
shadmar Posted March 9, 2015 Share Posted March 9, 2015 position of child is the realtive local position to parent I think? Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
AggrorJorn Posted March 9, 2015 Share Posted March 9, 2015 is self.p0 nil when you get it in the start function? self.p0 = self.entity:FindChild("p0") if self.p0 == nil then error("p0 is nill") end Quote Link to comment Share on other sites More sharing options...
YouGroove Posted March 9, 2015 Author Share Posted March 9, 2015 Yes i got the error, even with other child object like "spark" it doesn't work if i call hide() function just after. I think FindChild is broken, or LE3 don't like my system. self.p0 = self.entity:FindChild("p0") self.p1 = self.entity:FindChild("p1") if self.p0 == nil then error("p0 is nill") end --self.spark=self.entity:FindChild("sparks") --self.spark:Hide() Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Hover Posted March 9, 2015 Share Posted March 9, 2015 I had this problem too. Try deleting "p0" an create a new one, then it should work. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted March 9, 2015 Author Share Posted March 9, 2015 I deleted and created again, the problem remains. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Genebris Posted March 9, 2015 Share Posted March 9, 2015 FindChild works correctly for me. The mistake must be somewhere else. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted March 9, 2015 Author Share Posted March 9, 2015 FindChild works correctly for me. The mistake must be somewhere else. Did you updated your project with last LE3 version ? It's not the first time i use child objects. The pivot is as child fo the player model in Scene panel and this Start() just go in error self.p0 = self.entity:FindChild("p0") self.p1 = self.entity:FindChild("p1") if self.p0 == nil then error("p0 is nill") end I'll re install LE3. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
YouGroove Posted March 9, 2015 Author Share Posted March 9, 2015 Something has gonna corrupted. I changed the player script to FPSPlayer, but launching the game , Lua crash saying p0 is nill in TPS script. That's really weird, i verified and no objects was using TPS script. Another weird thing , i could not rotate camera viwe and the code was unchanged. Perhaps it was map upadting i think that barught these problems. SOLUTION : Delete the model player from the map , and drop it again on the map , and re attache the script. And it runs normal. I could add again p0 pivot as child , and it wasfound and Lua didn't send any error. if self.p0 == nil then error("p0 is nill") end When things go weird, delete the object or the map and re start Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Genebris Posted March 9, 2015 Share Posted March 9, 2015 I think that it's related to the problem that I had few times before. I think that sometimes things just don't get saved. Even if you press save 10 times and launch the game several times (which also should save the map), it can be that something isn't saved on the map. It can be properties in script settings or objects placed on the map. I'm not sure, but I THINK that that happened to me few times beofre. And I also had to delete an object and make it again. And it seems like you have just got the same problem. Sadly I don't know how to reproduce this and I can't corfirm that it's not just my imagination. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted March 9, 2015 Author Share Posted March 9, 2015 I think that it's related to the problem that I had few times before Ok, some security is lacking between objects in the scene and scripts attached to them, something that refuses to overwrite the name of the script. The problem is if you are not aware , this bug make you crazy, i loosed so much time verifying the code, trying again and again things that should work ... i almost let down the project And there are some serious bugs like prefab child not at good position when instancied, pick problems with characters, particle problems ... i make a pause on that project and keep effort on others for now. Quote Stop toying and make games 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.