Jump to content

dennis

Members
  • Posts

    469
  • Joined

  • Last visited

Posts posted by dennis

  1. You could use coroutines in lua to make designing such a thing easier and more logical. It sort of gives you the ability to use a poor mans cinematic tool.

     

    Coroutines can yield out of the function they are in so the rest of the game can continue to run and when they come back into their function they start off where they left off. So you could be inside a loop increasing a number and yield out each loop and each time you come back in the state of everything (let's say that number) is exactly as it was when you left it.

     

    What this provides for you is the ability to make sequences of events rather easily. Each sequence could also be in their own files which makes then nice and separate from each other and easy to maintain. You end up with a script sort of like:

     

    -- pass in LE's world, window, & camera & anything else you need or you can query entities from the world
    function IntroSequence(world, window, camera)
    local player = FindEntity(world, "player")
    
    player.script:DisableInput()
    
    PlaySoundAsync("Sounds\Music\IntroMusic.wav")
    
    local camera1Pos = FindEntity(world, "camera1_intro")
    MoveEntityToLocation(camera1Pos, camera1Pos)
    
    
    player.script:EnableInput()
    end
    

     

     

    Functions that I want to continue running the script I give Async at the end. Functions that I want to run until it's done I don't. For example I may want a move to point and don't want the script to continue until the entity is at that point so that function would be "blocking". I'm still working out none blocking move script as there would be something to track after the function call and not sure how to do that yet.

     

    Dead Anyway needs something like this so going to take a look. Combining with the tween library I posted about this could be pretty slick. I've done tests so I know it works, the question is just making functions to make it easy to work with.

     

    I don't really understand all of that. tried to find out how to but didn't work out :/

  2. I just started a 3rd person type project and used the following code to attach a weapon to the players arm.

     

    Add code to script attached to weapon. Adjust SetPosition and Setrotation as needed.

     

    Script.Target = nil--entity "Player"
    Script.gc = ""
    
    function Script:Start()
    self.gc = self.Target:FindChild("rHand") -- rHand is whatever name of bone
    local gun = self.gc:GetPosition()
    
    self.entity:SetParent(self.gc)
    self.entity:SetPosition(gun.x-11,gun.y-2,gun.z+6)
    self.entity:SetRotation(gun.x-110,gun.y,gun.z)
    
    end
    

     

    Didn't the Scene tree use to show the model Hierarchy? Could just drag the weapon to the bone then.

     

    GheGhe yea true, But it is disabled since update 3.5, will try out the gun script

  3. Heya all,

     

    I wrote this little piece of code:

     i = 1000
     repeat
      world:SetWaterHeight(i)
      i = i - 0.1
     until i < 0.80
     if i <= 0.90 then
      self.enabled = false
      self.lowerstate = false
     end
    

     

    I wanted it to lower smoothly, so you can actually see it come down. I placed this code inside

    Script:UpdateWorld()

    but my screen then stuck and the water is at the preferred height

     

    cheers

  4. I've just made a cinematic sequence library that helps with this. Adding more functionality but the idea is that you have a lua function that executes top down but can yield out to the main LE loop. So you make a sequence of steps for your cinematic. For in game you would find the already existing entities and then call functions to make them do things. You'd most likely disable user input at the start and enable it back again at the end of the sequence.

     

    I'm thinking of making a video tutorial and posting what I have to the workshop on Friday.

     

    sounds cool! you made me start thinking on this. I could make a new set of models get loaded, and let them do stuff then set them free or something

  5. Hmm, back with LE2 i used sqlite database with lua.

    When you pickup a note, artifact or some other stuff you write it away in a database.

    Sqlite3 is a flat file database... You add a increment variable for example:

    Notes = 0

    Everytime you pickup a note it will increment +1. A note has a example value of 100 pts. Every note which sits there in database

    Has to be retrieved so you get the count of the notes. Your script sees 10 * a value of 100 and that's your score.

     

    http://lua.sqlite.org/index.cgi/index

  6. Heya,

     

    How can I make some sort of cinematic (ingame just by using animations) without affecting my game mechanics?

    I have something in mind but it doesnt't really come to life.

     

    i think I do need to run the cinematic (by creating a standard camera) and after completion of the sequence my player gets spawned or something.

    How does the industry standard apply or do you guys have a good idea for me to bring this alive?

     

    I'd like to here from you all, chreers!!

  7. Heya,

     

    How can I make some sort of cinematic (ingame just by using animations) without affecting my game mechanics?

    I have something in mind but it doesnt't really come to life.

     

    i think I do need to run the cinematic (by creating a standard camera) and after completion of the sequence my player gets spawned or something.

    How does the industry standard apply or do you guys have a good idea for me to bring this alive?

     

    I'd like to here from you all, chreers!!

  8. Export the normal, specular and displacement maps.. It should look way better! Your model then reacts on lighting.

     

    What you also can do is simply add shader effects / posteffects to your camera.

    Ie. Camera:AddPosteffects( --shaderfile.shader)

     

    Anyway, what editor are you using there :) ?

  9. Hey shad,

    Already did that, ain't working. here's the code I'm using:

    BarL = Model:Box(1,0.5,0)
    BarL:SetParent(self.camera,false)
    BarL:SetColor(1,1,1,1)
    BarL:SetPosition(-1.3, -0.55, 1.2)
    BarL:SetRotation(35,-85,0)
    BarL:SetShadowMode(0)
    local BarLMat = Material:Load("Materials/HUD/maindisp/hud_bottom_energybars/hude_10.mat")
    BarLMat:SetDepthTestMode(false)
    BarL:SetMaterial(BarLMat)
    BarL= Model:Create()
    

     

    problem is, it won't rotate with the camera. it first did, but since LE 3.4 it doesn't.

     

    Cheers

     

    Btw, that is for the left side, since the Hud is built in several parts

  10. Just parent the box to the camera. No code needed.

    I know, but I want it to do using code, easier to do... because I have more scenes to deal with, and I don't feel like setting those up. still thanks though

     

    after an update your script should not be lost. You should look for .bak* files in the project folder if you can find it.

     

    Still can't find it, there was a strange bug at my side. it was totally lost

  11. heya guys,

     

    a few months ago I created a part in my script where I draw a box and position it at the camera, on movement it moved along with me and on turn it turned with the camera, always facing the same direction. since I lost that script, because of my poor backup (and the engine updated).. I am not able to achieve it anymore, can someone help me with this ?

     

    as seen here: http://www.indiedb.com/games/banned/news/inventory-and-hud

     

    cheers

×
×
  • Create New...