Jump to content

gordonramp

Members
  • Posts

    398
  • Joined

  • Last visited

Everything posted by gordonramp

  1. I don't seem to be able to remove the 'Frames per Second stats' from this code. Usually it is with the SetStats Framework command but I can find no sign of it here or in the 'require' scripts. Has anyone located it?
  2. Yes, That works. FlushKeys() eh. I'm slowly picking up bits of Lua. Thanks Mack.
  3. This is Great. I'm wondering how to turn it on and off. I've included it in a simple scene in which I move around. When I hit the tilde button the console appears but has lots of wwwwwwwwwwwwwwwwws in it. Hence my query. How to turn it on only when the Tilde button is pressed.
  4. Just updated... No heathaze in the Editor or Lua, sky is default though I changed it in the Editor.
  5. I think this is something for Josh to put right. He is often telling potential customers to go the Lua way, so if they do then there needs to be 'seamless compatibility' between the Editor and the Lua Engine. Workarounds can only achieve so much and they often lead to complications. It's great that we have got this far but I don't think it's time to get too confident yet.
  6. It didn't even occur to me that IE7 may be the issue. So many people use it. I'll try Google Chrome for a while and see if it suites me. If not I'll try IE8 or Firefox etc.
  7. Good point, Internet Explorer 7. I just downloaded Google Chrome and copy and paste between code tags formats with it. So I guess I'll be using Google Chrome in the future. Thanks. However don't expect my code to be always indented, I actually prefer it nice and neat against the left hand margin. Easier to read.
  8. I'm glad you brought that up. What I find is that code in code tags on this forum doesn't copy and paste with wordwrap ie. it pastes as one long line and takes forever to format, (please explain how to do it if I'm incorrect). So I figure I'm making life easier for people by putting my code in quotes which does paste with wordwrap (formatiing). Also, indentation is not a requirement of coding, it is only a preference by some.
  9. Yes, emitters don't seem to be working.
  10. With some adjustments and input from Lumooja's fpcontroller code, this now works in the Editor and outside the Editor.. No Gun but has Flashlight. function round(num, idp) return tonumber(string.format("%." .. (idp or 0) .. "f", num)) end BLEND_NONE=0 BLEND_ALPHA=1 -- if fw==nil then --we are not in Editor RegisterAbstractPath("") Graphics(800,600) fw=CreateFramework() scene=LoadScene("abstract::tunnels.sbx") scene:SetCollisionType(COLLISION_SCENE) TFilter(1) AFilter(4) standalone=1 end require("Scripts/constants/collision_const") require("Scripts/constants/engine_const") require("Scripts/LinkedList") require("Scripts/filesystem") require("Scripts/math/math") dx=0.0 dy=0.0 camerapitch=0.0 camerayaw=0.0 move=0.0 strafe=0.0 --Create a player controller controller=CreateController(1.8,0.45,0.25,45) controller:SetCollisionType(COLLISION_CHARACTER,0) controller:SetMass(10) if standalone==1 then controller:SetPosition(Vec3(42.0,1,-10)) else controller:SetPosition(fw.main.camera.position) end camerapitch=fw.main.camera.rotation.x camerayaw=fw.main.camera.rotation.y-90 HideMouse() MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2) FlushKeys() FlushMouse() local pick local camera = fw.main.camera local remainingtime local starttime=AppTime() local gameduration=2--length of game in minutes local gamemode=0 --Flashlight flashlight = {} flashlight.light = CreateSpotLight(8) flashlight.light:Hide() flashlight.sound_switch = LoadSound("abstract::switch.wav") flashlight.state=0 flashlight.light:SetConeAngles(30,35) flashlight.light:SetRotation(Vec3(5,0,0)) flashlight.light:SetShadowmapSize(512) flashlight.light:Paint(LoadMaterial("abstract::flashlight.mat")) function flashlight:SetState( state ) if state~=self.state then self.state=state if state==0 then self.light:Hide() else self.light:Show() end if self.sound_switch~=nil then self.sound_switch:Play() end end end --main function while KeyHit(KEY_ESCAPE)==0 do jump=KeyHit(KEY_SPACE)*6.0 if controller:IsAirborne()==1 then jump=0 end local time = AppTime()/3200.0 local frame = time*(179.0-96.0)+96.0 frame=Clamp( frame, 96, 179 ) --Camera look gx=Round(GraphicsWidth()/2) gy=Round(GraphicsHeight()/2) dx=Curve((MouseX()-gx)/4.0,dx,3.0/AppSpeed()) dy=Curve((MouseY()-gy)/4.0,dy,3.0/AppSpeed()) MoveMouse(gx,gy) camerapitch=camerapitch+dy camerayaw=camerayaw-dx camerapitch=math.min(camerapitch,90) camerapitch=math.max(camerapitch,-90) fw.main.camera:SetRotationf(camerapitch,camerayaw,0,1) movespeed=6 movesmoothing=10 if controller:IsAirborne()==1 then movesmoothing=200 end --Player movement move=Curve( (KeyDown(KEY_W)-KeyDown(KEY_S))*movespeed,move,movesmoothing) strafe=Curve( (KeyDown(KEY_D)-KeyDown(KEY_A))*movespeed,strafe,movesmoothing) --Update controller controller:Update(camerayaw,move,strafe,jump,40,10) fw:Update() if KeyHit(KEY_F)==1 then flashlight:SetState(1-flashlight.state) end --Position camera camera:SetPositionf(controller.position.x,controller.position.y+0.8,controller.position.z,1) time=AppTime() flashlight.light:SetPosition(fw.main.camera:GetPosition(1)) flashlight.light:SetRotationf( CurveAngle( fw.main.camera.rotation.x, flashlight.light.rotation.x, 3.0/AppSpeed() ), CurveAngle( fw.main.camera.rotation.y, flashlight.light.rotation.y, 3.0/AppSpeed() ) ) flashlight.light:Movef(-0.07,-0.04,0.02) fw:Render() Flip(0) end controller:Free() ShowMouse()
  11. As the Framework is now accessible with Lua outside of the editor, I've revisited my fpcontroller code.. I can load a scene and look around with mouselook but am unable to move.. can someone tell me why.. fpcontroller revisited require("Scripts/constants/collision_const") require("Scripts/constants/engine_const") require("Scripts/LinkedList") require("Scripts/filesystem") require("Scripts/math/math") --Register abstract path RegisterAbstractPath("") --Set graphics mode if Graphics(1024,768)==0 then Notify("Failed to set graphics mode.",1) return end --Create framewerk object and set it to a global object so other scripts can access it fw=CreateFramework() if fw==nil then Notify("Failed to initialize engine.",1) return end SetGlobalObject("framewerk",fw) camera=fw.main.camera camera:SetPositionf(-4,1.2,-4) --Variables dx=0.0 dy=0.0 camerapitch=0.0 camerayaw=0.0 move=0.0 strafe=0.0 --Create a player controller controller=CreateController(1.8,0.45,0.25,45) controller:SetPosition(fw.main.camera.position) camerapitch=fw.main.camera.rotation.x camerayaw=fw.main.camera.rotation.y controller:Move(Vec3(0,-0.9,0)) --HideEntity(vwep) HideMouse() MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2) FlushKeys() FlushMouse() local pick local camera = fw.main.camera local remainingtime local starttime=AppTime() local gameduration=2--length of game in minutes local gamemode=0 scene=LoadScene("abstract::tunnels.sbx") light=CreateDirectionalLight() light:SetRotationf(45,45,45) while KeyHit(KEY_ESCAPE)==0 do jump=KeyHit(KEY_SPACE)*6.0 if controller:IsAirborne()==1 then jump=0 end --Camera look gx=Round(GraphicsWidth()/2) gy=Round(GraphicsHeight()/2) dx=Curve((MouseX()-gx)/4.0,dx,3.0/AppSpeed()) dy=Curve((MouseY()-gy)/4.0,dy,3.0/AppSpeed()) MoveMouse(gx,gy) camerapitch=camerapitch+dy camerayaw=camerayaw-dx camerapitch=math.min(camerapitch,90) camerapitch=math.max(camerapitch,-89.99) fw.main.camera:SetRotationf(camerapitch,camerayaw,0,1) movespeed=6 movesmoothing=10 if controller:IsAirborne()==1 then movesmoothing=200 end --Player movement move=Curve( (KeyDown(KEY_W)-KeyDown(KEY_S))*movespeed,move,movesmoothing) strafe=Curve( (KeyDown(KEY_D)-KeyDown(KEY_A))*movespeed,strafe,movesmoothing) --Update controller controller:Update(camerayaw,move,strafe,jump,40,10) if KeyHit(KEY_ESCAPE)==1 then break end fw:Update() fw:Render() Flip(0) end
  12. At last, I'm able to access the Framewerk with Lua. Looking forward to the docs Josh.
  13. Compiler Error.."Can't find interface for module 'lugi.generator'"
  14. CharacterFX has been unsupported for years. I suggest milkshape3d. At $35 it's a great way to begin modelling animating and rigging, is easy to use, has a large forum and regular updates.
  15. I've been trying to get mouselook and mousemovment working with the following piece of Lua code. It loads a scene outside of the Leadwerks Editor using the Lua Engine. As soon as I add a controller I get the errors occur.. I know there is more code to add in the loop. But it doesn't even like the variables.
  16. I'll dig out the code and start a new thread.
  17. Well, I've spent quite a bit of time trying to get it going outside of the Editor, without success. 'Exception_access_violation' seems to be the most common error. Lumooja, Yes, I spent some time on that bit of code but as you said in that post, there were errors.
  18. I'd be grateful if you or someone could post some simple fpcontroller code that works with the Lua Engine..
  19. Thats it, since the 2.3 editor came out there has been a serious shudder, flicker and disrupted image when looking at the camera's highest point, using the standard fpscontroller.lua script. That's in Editing and game mode. Anyone else noticed this and know how to remedy it?
  20. gordonramp

    Merry Christmas!

    Great. Does this mean that the FPScontroller.lua code can be easily adapted to work outside of the Editor now?
  21. Just re-read what 'mikedee' actually said and you are right he does indicate that he has an illegal version of the software. Unacceptable. However, the notion of 'stealing $200 out of Josh's wallet' is debatable and an argument I've heard many times in the past about software 'piracy'. It implies that someone would be compelled to purchase the software were they not able to acquire it for nothing. That doesn't stack up. At most Josh has lost a potential customer and even that may not be the case because 'mikedee' has indicated that he will buy the LE. after a suitable evaluation period. There has been no theft of money from Josh's wallet because the money was never put there in the first place.
  22. Dead Marley, That's a different sort of different.
×
×
  • Create New...