Jump to content

AggrorJorn

Members
  • Posts

    4,816
  • Joined

  • Last visited

Everything posted by AggrorJorn

  1. Would have bin fun if someone said: Update()is better.
  2. lol haha "which one is better...". Joke of the week. I ment to say: Update or Render.
  3. It works just as I want it now. Thanks for the help everyone. (Community +1 (couldn't find the + sign )) 1 question though: When the fuse is turned of, all lights that were shown, have to be automaticly hidden. I used this code and it works: function object:Update() if lightsHide == 1 then local n,target,targetmessage,args,delay for n=0,7 do target=self.model:GetTarget(n) if target~=nil then target:Hide() end end end end Instead of object:Update() I can also use object:Update(). The result is the same, but I would like to which one is better. I'm also thinking of putting up a tutorial about this. nice lua code sample...
  4. Looking forward to this. I think this would greatly improve the FPS in my scenes.
  5. It is kinda embarrassing , but after reading your replies I see what you mean. In the first place I didn't need to create those links at all. I totally focused on the wrong problem. I linked the fuse to the lights even before I started trying to make the script, because I thought I would need it. After the script was pretty much done, I must have totally forgotten that those links are not being used by the script. (no messages doink ) I know that using links wasn't good anyway because if I had more than 8 lights, I would have a problem. But then again, it was more testing if it really worked. On the other hand: the fuse has links in the scene, so 'target ~= nill'. This would mean that the script works, independent from whether the script is logical. Cant wait to try this at home... Thanks for your replies. I'll let you know how it goes.
  6. Well the local variables just overwrite each other and are not giving an error. But I removed them since they are pointless. Thx That certainly works but that's not the problem of the disfunctioning I think. The lightswitch script doesn't seem to read the lightHide value from the fuse.
  7. Spot the error! no seriously, perhaps I'm declaring the value in the wrong location. fuse: require("scripts/class") local class=CreateClass(...) function class:CreateObject(model) local object=self.super:CreateObject(model) local fuseActive = 0 lightsHide = 1 function object:ReceiveMessage(message,extra) if message=="use" then local n,target,targetmessage,args,delay for n=0,7 do target=self.model:GetTarget(n) if target~=nil then if object.fuseActive == 1 then fuseActive = 0 lightsHide = 1 else fuseActive = 1 lightsHide = 0 end end end end end end
  8. The link is referring to the tutorials section from the downloads. Josh removed that section because he created the pages section. I had to create a new download there. http://leadwerks.com/werkspace/index.php?/page/index.html?record=16
  9. I'm wondering how to use global variables with LUA. I have a fuse/generator which you can turn on and of. Every single light in my scene can be turned on or off depending on whether the generator is active (on). These are the variables that i use in the generator script. I have declared them before I create the object. fuseActive = 0 lightsHide = 1 I can activate the generator with a use message. The fuseActive variable is used to either turn on or off the generator. When the generator is activated, all the light-switches have to make use of the lightsHide variable. This is a part from the light-switch script: if lightsHide == 0 then if lightOn==1 then target:Hide() lightOn=0 else target:Show() lightOn=1 end end The lightsHide variable in the light-switch script should use the value from the variable in the generator script. How can I make the lightHide variable in the generator script global, so that I can use it in the light-switch script? Any other suggestions whether scripting like this is efficient, is also welcome.
  10. nice Gimpy73 (and mate)! I expected something else when I saw the title 'death'. But it is a nice beat.
  11. Cloud level editing would be cool, but I have to say that I can hardly imagine people working together while sculpting a terrain. How about instead of just the terrain, you can edit the entire scene. One computer is the host, and every lua file that is adjusted, gets updated to the other editing person. When someone drags an object in the scene, the other editor sees this happening, but if you don;t have the same model in the your local folder, than you don't see it happen.
  12. I don't think that is such a weird suggestions. I believe that there was a blog about this
  13. Well I tried your way, and the the script in the switch was no correct. I think it would have worked, but I had the problem that light that was created inside the lamp, could shine through walls. If I would drag a regular lamp in screen, this didn't happen. Also I would like to leave the script for the light alone. I tried this and it worked! Instead of sending messages, I just used the show() and hide() commando's. This is script for the switch: require("scripts/class") local class=CreateClass(...) class.sound_switch=LoadSound("abstract::switch.wav") function class:CreateObject(model) local object=self.super:CreateObject(model) local lightOn=1 function object:ReceiveMessage(message,extra) local n local target local args local delay if message=="use" then if class.sound_switch~=nil then PlaySound(class.sound_switch) end local n,target,targetmessage,args,delay for n=0,7 do target=self.model:GetTarget(n) if target~=nil then if lightOn==1 then target:Hide() lightOn=0 else target:Show() lightOn=1 end end end end end end
  14. I don't have an entire example but instead of chassis = LoadModel(abstract::chassis.gmf) you could use the CreateCube and CreateCylinder commands: http://www.leadwerks.com/wiki/index.php?title=Meshes
  15. Check this topic: animation example
  16. I believe you can set the reflection value in your mat file higher. For more shininess usse gloss.
  17. OK thanks for your answers. I'll try this first and will let you know what the results are.
  18. Yes I have. the light switch code is identical to the switch that comes with the sdk. I'm only using a different message. local n,target,targetmessage,args,delay for n=0,7 do target=self.model:GetTarget(n) if target~=nil then delay = tonumber( self.model:GetKey("delay"..n,"0") ) * 1000.0 if self.active==1 then target:SendMessage("Hide",nil,delay) else target:SendMessage("Show",nil,delay) end end end The lamp scriptshould should then something with these messages like: function object:ReceiveMessage(message,extra) if message=="show" then self.light:SetIntensity(2) else self.light:SetIntensity(0) Would I need to configure these messages in the class.lua first?
  19. Does anyone have an example regarding turning a light on and off via messages? I've been trying to get this to work by fooling around with the switch.lua for a while now, but sofar no good. I'm looking for a script that eihter sends a 'show' or 'hide' message. The light that can be turned on and of is created inside a lamp. Would anyone be so kind to help me out with this. This is the code of the lamp: require("scripts/class") local class=CreateClass(...) function class:CreateObject(model) local object=self.super:CreateObject(model) --Create light self.light=CreatePointLight(1,model) self.light:SetColorf(1,0.4,0.2,1,1) self.light:SetPositionf(0,0.1,-0.25,0) self.light:SetShadowOffset(0,0.80,0) end end
  20. - Raycasting is used in one the example scripts. For example by turning on and of a switch or when shooting a weapon. - With leadwerks engine 2.3 you can do realtime animations inside the editor using Lua. - high end graphics. The engine has the power to do so, however you need good models and textures to use that power. - Leadwerks has Newton physics integrated, although you could use your other physics systems. no support for that though. - the sandbox editor is used for editing levels, terrain creation, vegetaion placement - the SDK comes with a couple of tools to convert your models to the leadwerks engine format: gmf. The tools you need are 3ds2gmf.exe and coonvertmesh.exe.
  21. I have absolutely no idea what this code is doing but it looks very pro.
  22. Uploaded the first version of the Leadwerks 2.3 - User Guide. http://leadwerks.com/werkspace/index.php?/page/index.html?record=16
  23. Thanks for the Info Josh and Volker, they are realy helpfull. I have to be honest: I totaly misunderstood the physics type 'scene'. I thought this meant, that the object receives collision from everything that is inside the 'scene' or editor at moment. I doubt if my explanation about the character controller is true then: o Character. Only the Character controller has collision with this object.
  24. The models can have up to 8 LOD stages? The index parameter (values 0-7)
×
×
  • Create New...