Jump to content

Lua bug ?


YouGroove
 Share

Recommended Posts

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")

post-3271-0-66654900-1425902294_thumb.jpg

Stop toying and make games

Link to comment
Share on other sites

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()

Stop toying and make games

Link to comment
Share on other sites

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.

Stop toying and make games

Link to comment
Share on other sites

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 sleep.png

Stop toying and make games

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 sleep.png

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.

Stop toying and make games

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...