Mince Posted February 6, 2013 Share Posted February 6, 2013 I tried the EntityNew={} ver That gave me a error with inherit = nil??? The following Script dont work, either if any one can help me rotate the blades that will be great. --Include the base script for all classes dofile("Scripts/base.lua") --Some global sounds we will use for all instances squeak={} squeak[0]=LoadSound("abstract::squeak_1.ogg") squeak[1]=LoadSound("abstract::squeak_2.ogg") --This function builds the interface for the properties editor function InitDialog(grid) --Add the base interface for all classes base_InitDialog(grid) --Now we can add our own custom properties group=grid:AddGroup( "Windmill" ) group:AddProperty( "spinspeed","|0,4",PROPERTY_FLOAT,"Spin Speed") group:Expand(1) end --Spawn function for creating new instances function Spawn(model) local entity=base_Spawn(model) --Retrieve a few limbs we will use later entity.blades=model:FindChild("windmill_blades") entity.base=model:FindChild("windmill_housing") entity.model:SetKey("spinspeed","1") --An update function for one instance. Declaring the function as part of the entity table allows us to use "self" for the table function entity:Update() --Although these limbs should always be present, it"s a good idea to add a check to make sure they exist before using them if self.blades~=nil then self.blades:Turnf(0,tonumber(self.model:GetKey("spinspeed"))*AppSpeed(),0,0) end if self.base~=nil then --Make the base sway slightly angle=math.sin(AppTime()/2000.0)*5-15 angle=angle+math.cos(AppTime()/500.0)*2 self.base:SetRotationf(0,0,angle,0) --Make the base squeak lasttime=tonumber(self.model:GetKey("lastsqueaktime","0")) if (AppTime()-lasttime>8000) then self.model:SetKey("lastsqueaktime",AppTime()+math.random(0,5000)) self.base:EmitSound(squeak[math.random(0,1)],50,1,0) end lasttime=tonumber(self.model:GetKey("lastsheeptime","0")) end end end --Update function, called during every UpdateWorld() function Update(world) if world==world_main then local model,entity for model,entity in pairs(entitytable) do if model.world==world then entity:Update() end end end end Quote Link to comment Share on other sites More sharing options...
macklebee Posted February 8, 2013 Share Posted February 8, 2013 where did you get the windmill model from? that hasn't been around since 2.3 first came out... which is also using very old inherent scripts and multi-state lua in the beta version of the LE2.3 editor in that video so not too surprised that it doesn't work in the latest LE2.5 evaluation version... Quote 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 More sharing options...
02arnoldj Posted February 12, 2013 Share Posted February 12, 2013 I Googled leadwerks engine examples and found a Site with a description about a windmill (must have been version 2.3 i guess) so i followed a link to download it and there it was. I now have it animated in 2.5 Thanks 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.