Jump to content

Longtime weird LUA occurances


Alienhead
 Share

Go to solution Solved by Alienhead,

Recommended Posts

This has been happening awhile but I haven't came back to it yet because i havent needed to do anything like this until now.

Here is some the code:

                    --- Start the clouds
                        for t=1, self.layer1Amount do
                            uagc_clouds[t].mesh = self.layer1Cache[math.random(1,self.layer1TypeCount)]:Instantiate(world)
                            uagc_clouds[t].mesh = Model(uagc_clouds[t].mesh)
                            uagc_clouds[t].mesh:SetHidden(false)
                            uagc_clouds[t].mesh:SetPosition(player.entity:GetPosition())
                            uagc_clouds[t].mesh:SetPickMode(0)
                            local anum = math.random(self.minScale, self.maxScale)

                            uagc_clouds[t].mesh:SetScale(anum, anum, anum)
                            uagc_clouds[t].mesh:Translate(math.random(-self.maxDist,self.maxDist), math.random(self.minHeight,self.maxHeight), math.random(-self.maxDist,self.maxDist))
                            uagc_clouds[t].mesh:SetLodDistance(self.lod1, self.lod2, self.lod3)
                            uagc_clouds[t].speed = Random(self.maxSpeed/2, self.maxSpeed)
                        end


                  --->> Move the clous
			        for t=1, 40 do
			            uagc_clouds[t].mesh:Translate(0,0,1)   --- THIS LINE ERRORS OUT !, says uagc_clouds[t].mesh is nil when clearly the code above sghows it isnt.
        			end

lua.thumb.png.dfa83394704e193f1b25e6241d46bb4a.png

I'm only happy when I'm coding, I'm only coding when I'm happy.

Link to comment
Share on other sites

How do you know that layer1Amount equals 40? That seems very odd to hard-code the array size.

You can use #uagc_clouds to get the array size.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • Solution

Yah I saw that error as soon as I posted this message. Seems to be NO WAY to delete a topic anymore so I had to just leave it.

 

I'm only happy when I'm coding, I'm only coding when I'm happy.

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