Jump to content

Lua Class Update


coldfire
 Share

Recommended Posts

Well, its been quite some time since I've messed with LUA-based entities and I've noticed quite a lot has changed. I am curious if you would set it up like:

 

function class:Update(model)

 

Or if there was a different way of doing it. If its not too much to ask, I'm sure a simple example of rotating the model would show me exactly what I need to know. I've searched through several other script to find an example with no luck. Thanks in advance.

x_coldfire_x.png

AMD 64 X2 3800+ | 3G DDR2 667 | Windows 7 Ultimate 64 Bit | Nvidia Geforce 9800 GT 512MB DDR3

Link to comment
Share on other sites

there are several examples in the lua forum... but here is a quick and dirty script to rotate the model:

 

require("scripts/class")
local class=CreateClass(...)

function class:CreateObject(model)
       local object=self.super:CreateObject(model)

function object:Update()
	object.model:Turn(Vec3(0,1,0))
end
end 

 

this assumes that you have downloaded at least the oldest version of 2.30, since there was a change from multi-state to single-state lua and inherent scripts have changed since LE 2.3 was first released

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

there are several examples in the lua forum... but here is a quick and dirty script to rotate the model:

 

require("scripts/class")
local class=CreateClass(...)

function class:CreateObject(model)
       local object=self.super:CreateObject(model)

function object:Update()
	object.model:Turn(Vec3(0,1,0))
end
end 

 

this assumes that you have downloaded at least the oldest version of 2.30, since there was a change from multi-state to single-state lua and inherent scripts have changed since LE 2.3 was first released

 

Yup, i was using the multi-state system before, so this was completely new to me, lol. Thank you so much for the snippet. Its just what I needed. I didn't realize it was inside the class:CreateObject(model) function. Thanks a ton!

 

Randy

x_coldfire_x.png

AMD 64 X2 3800+ | 3G DDR2 667 | Windows 7 Ultimate 64 Bit | Nvidia Geforce 9800 GT 512MB DDR3

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