Jump to content

fumanshoo

Members
  • Posts

    232
  • Joined

  • Last visited

Posts posted by fumanshoo

  1. Also, this is for editing within the Editor, but under Leadwerks Engine SDK/Scripts/Games, there is a fps controller for use in the Editor. There is also a nifty car one and a free roam one which you can enable in the Editor by going into the Editor, going to the options at the top right, go to paths/gamescript and then load which ever you like. But they are for use in the Editor and I don't recommend scripting in the editor because some other people on Werkspace told me how inefficient it is. It's really easy to screw up in the Editor if you are not just loading environment stuff...

  2. The Leadwerks Engine SDK/Script Editor is a Lua script editor and I use it a lot. What I'd do is put your environment and such in the Editor and then edit your main character and what not using the Script Editor. You can easily do a first person camera with this tutorial by Aggror... in fact, I'll give you the script for that, but you need to change the scene your self. It's the 16th line of code which says scene=LoadScene("abstract::default.sbx") which you would change the "default" to what ever you made in the Editor your self.

     

    require("Scripts/constants/engine_const")
    require("Scripts/math/math")
    COLLISION_CHARACTER=1
    RegisterAbstractPath("")
    Graphics(1200,600)
    fw = CreateFramework()
    credits = LoadSound("abstract::star wars.ogg")
    creditMaterial = LoadMaterial("abstract::credits.mat")
    scene = LoadScene("abstract::default.sbx")
    camera = fw.main.camera
    camera:SetPosition(Vec3(3,30,-10))
    light = CreateDirectionalLight()
    light:SetRotation(Vec3(45,45,0))
    controller = CreateController(2,.5,0.5 , 45,.03)
    controller:SetMass(10)
    controller:SetCollisionType(COLLISION_CHARACTER)
    controller:Move(Vec3(0,1,0))
    DebugPhysics(0)
    MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2)
    camRotation = Vec3(0)
    dx = 0.0
    dy = 0.0
    SetWorldGravity(Vec3(0,-20,0))
    strafe = 0
    move = 0
    while AppTerminate()==0 do
    if KeyHit(KEY_ESCAPE)==1 then break end
    --jump
    jump = KeyHit(KEY_SPACE) * 6
    if controller:IsAirborne()==1 then
     jump = 0
    end
    if KeyDown(KEY_H)==1 then
     MoveEntity(organisms,Vec3(.25,0,0))
    end
    if KeyDown(KEY_F)==1 then
     MoveEntity(organisms,Vec3(-.25,0,0))
    end
    if KeyDown(KEY_T)==1 then
     MoveEntity(organisms,Vec3(0,.25,0))
    end
    if KeyDown(KEY_G)==1 then
     MoveEntity(organisms,Vec3(0,-.25,0))
    end
    if KeyDown(KEY_DOWN)==1 then
     FreeEntity(water)
    end
    if KeyDown(KEY_M)==1 then
     PlaySound(credits)
    end
    --crouch
    if KeyDown(KEY_C)==1 then
     controller:Crouch(1)
     cameraHeight = 0.3
     moveSpeed = .25
     strafeSpeed = .25
    else
     controller:Crouch(0)
     cameraHeight = 1.5
     moveSpeed = 1
     strafeSpeed = 1
    end
    if KeyDown(KEY_LSHIFT)==1 then
     moveSpeed = 3
     strafeSpeed = 3
    else
     moveSpeed = 1
     strafeSpeed = 1
    end
    mx=Curve(MouseX()- GraphicsWidth()/2,3.0/AppSpeed())
    my=Curve(MouseY()- GraphicsHeight()/2,3.0/AppSpeed())
    MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2)
    camRotation.x = camRotation.x + my / 8
    camRotation.y = camRotation.y - mx / 8
    camera:SetRotation(Vec3(camRotation.x,camRotation.y,1))
    --setting the minimum and maximum camera angles
    camRotation.x = math.min(camRotation.x, 75)
    camRotation.x = math.max(camRotation.x, -45)
    
    move = Curve( (KeyDown(KEY_W)-KeyDown(KEY_S)) * 5, move , 3 )
    strafe = Curve( (KeyDown(KEY_D)-KeyDown(KEY_A)) * 5, strafe , 3 )
    controller:Update(camRotation.y, move * moveSpeed, strafe * strafeSpeed, jump, 25 , 10, KeyDown(KEY_C))
    fw:Update()
    camera.position.y = Curve (controller.position.y + cameraHeight,camera.position.y, 20)
    camera:SetPosition(Vec3( controller.position.x, controller.position.y + cameraHeight, controller.position.z))
    fw:Render()
    Flip(0)
    end
    

     

    There's a whole bunch of bull**** in my first person cam because I use it to screw around with code that I don't know about... so maybe just sift though that, but here's the tutorial for it. Very easy to follow and teaches you a lot about Lua. I believe there are about five tutorials...

     

     

    Oh, and this is now your god. This link right here is your Jesus and savior. Even though a lot of the examples are BlitzMax and Pascal and C++ and NOT Lua, it still teaches you a lot...

     

    http://www.leadwerks.com/wiki/index.php?title=Main_Page

  3. Thank you so much. I tried once, but I couldn't get anywhere because under scripts/constants/keycodes, it says MOUSE_LEFT to obviously click on things, but for what ever reason, it was not working for me...

  4. @ Dennis, I forgot to add that I have my mouse = 0 before the main loop, and I am using "K" because I have run out of keys and I am not smart enough to do something like press escape and then use GUI because I am already using escape to end the program... Anyways, when I use your script, my mouse goes to the right corner and then freaks out and I can't go back to normal... I think that has to do with the function FlipHook because that didn't really do anything like change colors or anything like that...

  5. So, I haven't been able to work on this too long or too hard, but I want my mouse to stop rotating around my controller ( or pivot in this case ) and start moving freely around the screen when I press "K" and stop moving and then start rotating around my controller ( or pivot in this case ) when I press "K" again. So basically a menu. Here's my code. Please don't judge if it's completely off...

     

    --mouse
    if KeyHit (KEY_K)==1 then
     if mouse== 1 then
      mouse = 0
      ShowMouse(mouse)
      MoveMouse(GraphicsWidth(),GraphicsHeight())
      mx=Curve(MouseX()- GraphicsWidth(),3.0/AppSpeed())
      my=Curve(MouseY()- GraphicsHeight(),3.0/AppSpeed())
    else
      mouse = 1
      HideMouse(mouse)
      MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2)
      mx=Curve(MouseX()- GraphicsWidth()/2,3.0/AppSpeed())
      my=Curve(MouseY()- GraphicsHeight()/2,3.0/AppSpeed())
     end
    end
    

     

    So far, it shows and hides the mouse, but other than that, nothing happens...

  6. Wow, that's very exiting. I've never been one to complain about graphics because I have no console and I never owned a computer that could display high-end graphics, but I have noticed that motion blur makes the gameplay a little different for most games. I'm sure LE3 will look fantastic with motion blur even though it has already been seen in LE2.

  7. NONONO! I love your veggie system, but I do not enjoy modeling the trees. Blender has a nice plug-in application for tree modeling, but it is not very fun to use because it's not as flexible as Speed Tree looks. Plus moss and things like that look very easy in Speed Tree.

  8. Ah, I see. Do you have a link to this information? Is it in the Wiki or in a LE file? It would be much appreciated.

     

    Thanks very much by the way. Exactly what I was looking for.

  9. would stop animations that are using AppSpeed()
    \

     

    Well I can not test animations because my graphics card does not support animation in LE, but my controller moves at AppSpeed() and when I pause, it does not stop my controller, so maybe or maybe not. I will see in a few months when my computer is fit.

  10. I saw the Page Up Page Down in "keycodes.lua", but what I mean is scrolling the middle mouse button. The closest I see is "MIDDLE_MOUSE", but it is referring to pressing down the middle mouse button. If it can be done by Bethesda, I can do it haha.

     

    But thanks very much for the pause response. I think I will set a near Depth of Field behind the menu when I pause. That way, the game appears to be blurred in the background.

  11. I do not see a scrolling key under "constants/keycodes" I am trying to make a camera much like Skyrim and Fallout, but I can't find a "scroll up" or "scroll down" keycode. A link or path to the folder containing the script for scrolling keycodes would be much appreciated.

     

    EDIT: I also have a completely unrelated question.... when I do the following code, my game does not pause or resume. Why is this not happening?

     

     

    --pause/resume
    if KeyDown(KEY_Y)==1 then
     PauseApp()
    end
    if KeyDown(KEY_U)==1 then
     ResumeApp()
    end
    

  12. I like the Frameworks commands and how easy they are to use. I think motion blur would be a nice little command for frameworks. I know motion blur is possible without frameworks, but it is a little complicated for beginners like me.

     

    ... although adding too many commands to the frameworks could be overwhelming to a beginner as well... Eh, I'll leave it to you, Josh!

  13. I guess "do the trick" was not a good use of my oompa loompa vocabulary. I was referring to my framerate and just use of the editor in general. Textures tend to look funny in the editor and I am sure it is because of my computer because games have the same problem. I am also downgrading when it comes to ram. I am using 10GB right now and downgrading to 8. The i5 and the video card is an upgrade though.

×
×
  • Create New...