Jump to content

WazMeister

Members
  • Posts

    73
  • Joined

  • Last visited

Everything posted by WazMeister

  1. Thank you! I do not see a download button for anything? Asks me to subscribe which I do, but still no download?
  2. Dam! Spoke too soon and got far too excited. It all works perfectly.. but some odd reason when it comes to then attaching a corner and spinning on Y, it won't now snap or align on the height. (left/back) view. God knows how I fix that now!
  3. Actually.. now to learn why Normals don't look good in leadwerks on new import meshes. Seems to not give it the nice dent in curbs etc
  4. Yes, we fixed it. Thanks. Not sure what it was, but your suggesting of moving Origin gave me idea to try it on a corner rather than center.. and it worked. Snaps perfect in leadworks and aligns like a glove! Some of the meshes in blender were playing up.. but a bit of tweaking and fixed that too. You are brilliant! Thank you soooo much can finally move on to learn something else now (like creating a level! HA)
  5. I think I solved it, with your guidance to re-think... I think I solved it!! Going to test again and will report back. Get ready for a fat, wet, sloppy KISS if this is resolved! You BEAUTY!
  6. Yea, I changed origin on them to be same. I notice when I move them to GRID in Blender... they also do not align up again properly... how odd?!?! Not sure whats happening there.
  7. I'm very basic with blender, just got it to split up modular level parts, for leadwerks. Unsure how I'd change or correct any Normals, tex-coords and vertex positions tbh. Tried attaching file here, if it does not work models I'm using can be found here - https://sketchfab.com/3d-models/street-a0a92282fda5464ab525b16fab8feaa3 street.zip
  8. Hi All, Been having some real trouble getting modular models for level building exported into Leadwerks. After reading a lot here, random sites, Blender guides and tinkering I managed to get models inside Leadwerks to nice size, good central pivot points and start building....... But now I'm getting issues with how Grid snap works with models (model not aligning with grid) and worse issues with models, even mirror like for like, not meeting intimately... i.e gaps or alignment is off regardless taking snap off and tweaking etc... Hopefully images will help, please can anyone help? I've read other posts ref setting Blender up to right grid and scales size, that I've done but any export models seem to have this issue! Very annoying stumbling block. Regardless settings, moving, flipping, ducking and diving.. I can not resolve and its put me to a stop of progressing further..... Any helps will be massively great! Below photos is best I can get it to align after hours of moving no grid size snap .. it should not be this difficult for such poor results, surely?
  9. Amazing. Where do I download this for LE
  10. Where could I find this book.. Links do not work. I realise its 2.3 but sure some of it will still relate to learning 4.6?
  11. This is great and one of the best gestures I've experienced in a long time. This will give me a bit of a confidence boost and direction to learn leadwerks, content is lacking so this is a massive help! Thank you!
  12. Yea, it's basically the Darkness Awaits scripts, code below- Because it did not work, I just went back to basic of self.camera:move and updateworld.. but code below- Player script- local runmultiplier = 0.8 --Set Script properties / define variables Script.health = 100--"Health Script.maxHealth = 100 Script.WalkSpeed = .02 Script.RunSpeed = 0.1 Script.maxAcceleration = 1.0--float "Max Acceleration" --Player states (Setup in a lua table with fields) Script.state = {} --Table called state --Add fields to table Script.state.idle = 0 Script.state.walk = 1 Script.state.run = 2 Script.state.carry = 3 Script.state.dead = 4 function Script:Start() --Set the type to player, keyvalue is string value associated with a key name self.entity:SetKeyValue("type", "player") if self.entity:GetMass() == 0 then self.entity:SetMass(10) end self.angle = self.entity:GetRotation().y self.entity:SetPhysicsMode(Entity.CharacterPhysics) --Setup character controller physics mode self.entity:SetCollisionType(Collision.Character, true) --Get the players current position playerPosition = self.entity:GetPosition() --Create a camera to view game/screen. self.camera = Camera:Create() -- Leave for example changing Field of View --self.camera:SetFov(70) --Set the antialias of camera (MSAA) self.camera:SetMultisampleMode((System:GetProperty("multisample", "1"))) --Set camreas position to the player + above him self.camera:SetPosition(playerPosition.x, playerPosition.y - 3, playerPosition.z) --Rotate the camrea for looking down on player (Top Down View) self.camera:SetRotation(Vec3(90, 0, 0)) --Set script to refer to the camrea follow script etc. set to false so start function won't start within. self.camera:SetScript("Scripts/Objects/Camera/3rdPersonFollow.lua", false) self.camera.script:target = self.entity --set target varible in the camrea script to this entity (player) self.camera.script:Start() --setup lua table to hold healthbar images self.image = {} self.image.healthbar = Texture:Load("Materials/HUD/healthbar.tex") self.image.healthmeter = Texture:Load("Materials/HUD/healthmeter.tex") self.image={} self.image.healthbar = Texture:Load("Materials/HUD/healthbar.tex") self.image.healthmeter = Texture:Load("Materials/HUD/healthmeter.tex") --Define default state variables self.currentState = -1 end --Adjust the camera orientation relative to the player function Script:UpdateCamera() --Rotate the camrea for looking down on player (Top Down View) self.camera:SetRotation(Vec3(90, 0, 0)) --Set camreas position to the player + above him self.camera:SetPosition(self.entity:GetPosition()) self.camera:Move(0, 0, -4) end function Script:UpdatePhysics() --blank vec3 variable for later adding key presses movement.x, movement.y and movement.z local movement = 0 --Get the Game Window local window = Window:GetCurrent() local changed --Check state for player dead if self.currentState == self.state.dead or self.health <= 0 then return end --Check if carrying, if not then player will be idle state if self.currentState ~= self.state.carry then self.currentState = self.state.idle end --Detect if grabbing a bin if self.currentState ~= self.state.carry then local docarry = false if window:KeyDown(Key.Space) then self.currentState = self.state.carry --self.attackstarttime = Time:GetCurrent() end end --Movement --Code for detecting key presses for movement and attacks if window:KeyDown(Key.W) then movement = movement - 1 changed = true end if window:KeyDown(Key.S) then movement = movement + 1 changed = true end if window:KeyDown(Key.D) then self.entity:Turn(0, 3, 0) change = true end if window:KeyDown(Key.A) then self.entity:Turn(0, -3, 0) change = true end if changed then if self.currentState ~= self.state.carry then if window:KeyDown(Key.Shift) then movement = movement * self.RunSpeed self.currentState = self.state.run else movement = movement * self.WalkSpeed self.currentState = self.state.walk end end end self.entity:Move(0, 0, movement) --Update animation if prevState ~= self.currentState then if self.currentState == self.state.idle then self.entity:PlayAnimation("Idle", .1, 200) elseif self.currentState == self.state.walk then self.entity:PlayAnimation("Walk", .1, 200) elseif self.currentState == self.state.run then self.entity:PlayAnimation("Run", .1, 200) elseif self.currentState == self.state.carry then end end end function Script:UpdateWorld() --Update the camrea position each frame (i.e follow player) self:UpdateCamera() end camrea script ---------------------------------------------------------------------- --This script will make a camera follow any entity --target: The entity to follow --distance: The distance away from the entity to place the camera --radius: collision radius of the camera (so it doesn't go through walls) ---------------------------------------------------------------------- Script.target = nil--Entity "Target" --Script.distance = 6--float --Script.debugmode = false--bool --Script.pitch = 15--float --Script.height = 6--float Script.radius = 0.5--float function Script:Start() self.smoothness=60 if self.target==nil then return Debug:Error("Script must have a target.") end self.firstframe=true self.targetoffset=Vec3(0) self.targetpositionoffset=Vec3(0) local camposition = self.entity:GetPosition(true) self.targetposition = self.target:GetPosition(true) self.relativeposition = camposition - self.targetposition --Construct a vertical plane facing the camera local v = Vec3(self.relativeposition.x,0,self.relativeposition.z) local vn = v:Normalize() local plane = Plane(self.targetposition,vn) local result = Vec3(0) local dir = Transform:Point(0,0,1000,self.entity,nil) if plane:IntersectsLine(camposition,camposition + dir,result) then self.targetpositionoffset = result - self.targetposition end self.height = self.entity.mat[3][1] --self.entity:SetDebugPhysicsMode(self.debugmode) --self.entity:SetDebugNavigationMode(true) --self.entity:SetDebugPhysicsMode(true) --self.entity:SetRotation(self.pitch,0,0) self.entity:SetPickMode(0) end function Script:UpdateWorld() --Exit the function if the target entity doesn't exist if self.target==nil then return 0 end --Get the target entity's position, in global coordinates local p0 = self.target:GetPosition(true) + self.targetpositionoffset local p1 = p0 + self.relativeposition--Vec3(p0.x,p0.y+self.height,p0.z-self.distance) local velocity = self.target:GetVelocity() velocity.y=0 self.targetoffset.x = Math:Curve(velocity.x*0.25,self.targetoffset.x,self.smoothness / Time:GetSpeed()) self.targetoffset.z = Math:Curve(velocity.z*0.25,self.targetoffset.z,self.smoothness / Time:GetSpeed()) --if(velocity.x ~= 0) then -- io.write (velocity.x,", ",velocity.y,", ",velocity.z, "\n") --end --Add our original offset vector to the target entity position --p0 = p0 + velocity * 2 --p1 = offset + velocity * 2 p0 = p0 + self.targetoffset p1 = p1 + self.targetoffset --Calculate a second point by backing up the camera away from the first point --local p1 = p0 + Transform::Normal(0,0,-1,self.entity,nil) * distance --Perform a raycast to see if the ray hits anything local pickinfo = PickInfo(); local pickmode = self.target:GetPickMode() self.target:SetPickMode(0) --if self.entity.world:Pick(p0,p1,pickinfo,self.radius,true,Collision.Debris) then --If anything was hit, modify the camera position -- p1 = pickinfo.position --end self.target:SetPickMode(pickmode) --Smooth the camera motion --[[ if self.smoothness>0 then local currentpos = self.entity:GetPosition(true) p1.x = Math:Curve(p1.x,currentpos.x,self.smoothness)--/Time:GetSpeed()) p1.y = Math:Curve(p1.y,currentpos.y,self.smoothness)--/Time:GetSpeed()) p1.z = Math:Curve(p1.z,currentpos.z,self.smoothness)--/Time:GetSpeed()) end ]]-- --[[local currentPosition = self.entity:GetPosition(true) currentPosition.x = Math:Curve(p1.x,currentPosition.x,self.smoothness)--/Time:GetSpeed()) --p1.y = Math:Curve(p1.y,p0.y,self.smoothness)--/Time:GetSpeed()) currentPosition.z = Math:Curve(p1.z,currentPosition.z,self.smoothness)--/Time:GetSpeed())]]-- --Finally, set the camera position --Smooth the height when going up stairs, etc. if self.firstframe then self.firstframe=false self.height = p1.y else self.height = Math:Curve(p1.y,self.height,5) end p1.y = self.height self.entity:SetPosition(p1,true) end
  13. Hi All, I'm trying to understand Leadwerks and scripting by playing around with Darkness Awaits template. I tried using some of the code from the above scripts on my own character model for the camera follow, but kept getting errors of field entity 'nil'. So to test it, I used the original scripts on my model and change a few things to suit bare minimum, and still get an error - attempt to index field 'script' (a nil value) on line 58 which is- self.camera.script.target = self.entity What am I doing wrong?
  14. Agreed. Humans apply the art and the talent. Hopefully through perseverance and pratice, I'll refine my artistic skills and talent be able to make something cool in Leadwerks.
  15. Looks ace, such great talent.
  16. Wow how do you do all this amazing stuff. Any guides or tutorials to ref for Leadwerks?
  17. Got it working by changing the movement code around and likely more basic... Not sure if it's the right way or best way to do this, but it works I guess... unction Script:UpdatePhysics() --blank vec3 variable for later adding key presses movement.x, movement.y and movement.z local movement = 0 --Get the Game Window local window = Window:GetCurrent() local changed --Check state for player dead if self.currentState == self.state.dead or self.health <= 0 then return end --Check if carrying, if not then player will be idle state if self.currentState ~= self.state.carry then self.currentState = self.state.idle end --Detect if grabbing a bin if self.currentState ~= self.state.carry then local docarry = false if window:KeyDown(Key.Space) then self.currentState = self.state.carry --self.attackstarttime = Time:GetCurrent() end end --Movement --Code for detecting key presses for movement and attacks if window:KeyDown(Key.W) then movement = movement - 1 changed = true end if window:KeyDown(Key.S) then movement = movement + 1 changed = true end if window:KeyDown(Key.D) then self.entity:Turn(0, 3, 0) change = true end if window:KeyDown(Key.A) then self.entity:Turn(0, -3, 0) change = true end if changed then if self.currentState ~= self.state.carry then if window:KeyDown(Key.Shift) then movement = movement * self.RunSpeed self.currentState = self.state.run else movement = movement * self.WalkSpeed self.currentState = self.state.walk end end end self.entity:Move(0, 0, movement)
  18. Hi All (again). I must of got too cocky with programming my movement, I wanted to get an understanding of diffrent approaches and implement a state etc. I used the Darkness awaits player template for movement and tweaked it for my liking.. to learn and understand. It never really worked, player just moved on the spot and animation played. AFter playing some more, I strted refrencing the tird person script for help and understanding.... then finally back to my original code I used before (which sort of worked). Now i have the player turning on the spot (the effect I want) but he still wont move at all.. just plays animation for forward and back! I thought I understood the code, but now I'm ripping my hair out with frustration, Tried using entity:Move command and entity:SetInput but it just wont fix it! Would someone be able to review my code below and see where I am going wrong?!?!? local runmultiplier = 0.8 --Set Script properties / define variables Script.health = 100--"Health Script.maxHealth = 100 Script.WalkSpeed = .02 Script.RunSpeed = 0.1 Script.maxAcceleration = 1.0--float "Max Acceleration" --Player sates (Setup in a lua table with fields) Script.state = {} --Table called state --Add fields to table Script.state.idle = 0 Script.state.walk = 1 Script.state.run = 2 Script.state.carry = 3 Script.state.dead = 4 function Script:Start() --Set the type to player, keyvalue is string value associated with a key name self.entity:SetKeyValue("type", "player") if self.entity:GetMass() == 0 then self.entity:SetMass(10) end self.angle = self.entity:GetRotation().y self.entity:SetPhysicsMode(Entity.CharacterPhysics) --Setup character controller physics mode self.entity:SetCollisionType(Collision.Character, true) --Create a camera to view game/screen. self.camera = Camera:Create() -- Leave for example changing Field of View --self.camera:SetFov(70) --Set the antialias of camera (MSAA) self.camera:SetMultisampleMode((System:GetProperty("multisample", "1"))) --Get the players current position local playerPosition = self.entity:GetPosition() local playerRotation = self.entity:GetRotation() --Set camreas position to the player + above him self.camera:SetPosition(playerPosition.x, playerPosition.y + 3, playerPosition.z) --Rotate the camrea for looking down on player (Top Down View) self.camera:SetRotation(Vec3(90, 0, 0)) --[[ Set script to refer to for the camrea movement etc. set to false so start function won't start within. self.camera:SetScript("Scripts/Objects/Camrea/3rdPersonFollow.lua", false) set target varible in the 3rdperson script referenced as this entity (i.e the player) self.camera.script.target = self.entity self.camera.script:Start() ]]-- --setup lua table to hold healthbar images self.image = {} self.image.healthbar = Texture:Load("Materials/HUD/healthbar.tex") self.image.healthmeter = Texture:Load("Materials/HUD/healthmeter.tex") self.image={} self.image.healthbar = Texture:Load("Materials/HUD/healthbar.tex") self.image.healthmeter = Texture:Load("Materials/HUD/healthmeter.tex") --Define default state variables self.currentState = -1 end function Script:UpdatePhysics() --blank vec3 variable for later adding key presses movement.x, movement.y and movement.z local movement = Vec3(0) --Get the Game Window local window = Window:GetCurrent() local changed local move = 0 local prevState = self.currentState --Check state for player dead if self.currentState == self.state.dead or self.health <= 0 then return end --Check if carrying, if not then player will be idle state if self.currentState ~= self.state.carry then self.currentState = self.state.idle end --Detect if grabbing a bin if self.currentState ~= self.state.carry then local docarry = false if window:KeyDown(Key.Space) then self.currentState = self.state.carry --self.attackstarttime = Time:GetCurrent() end end --Movement --Code for detecting key presses for movement and attacks if window:KeyDown(Key.W) then movement = movement + 1 changed = true end if window:KeyDown(Key.S) then movement = movement - 1 changed = true end if changed then --If player is basically moving.. then do.... if self.currentState ~= self.state.carry then --if window:KeyDown(Key.Shift) then --movement = movement:Normalize() * self.RunSpeed --Normalize vector to length of 1, so 1 * Runspeed movement = movement * self.RunSpeed self.currentState = self.state.run --else movement = movement * self.WalkSpeed --movement = movement:Normalize() * self.WalkSpeed self.currentState= self.state.walk --end end end self.entity:SetInput(self.angle, move,0,0) if window:KeyDown(Key.D) then self.entity:Turn(0, 3, 0) changed = true end if window:KeyDown(Key.A) then self.entity:Turn(0, -3, 0) changed = true end --Update animation if prevState ~= self.currentState then if self.currentState == self.state.idle then self.entity:PlayAnimation("Idle", .2, 200) elseif self.currentState == self.state.walk then self.entity:PlayAnimation("Walk", .1, 200) elseif self.currentState == self.state.run then self.entity:PlayAnimation("Run", .2, 200) elseif self.currentState == self.state.carry then end end end
  19. Another amazing post. Would love to understand particles a bit more, ever thought do doing some video tutorials for LE? Or record yourself as you make stuff so we can watch and learn?
  20. Thank you. Will give this a try. Is there a way to use other car models with this?
  21. This looks amazing. Massively inspiring to see such talent and skill with the bonus of seeing. What great stuff leadwerks can do! Fantastic! Praying I can get within half a inch of being able to learn and make something like this. Top stuff. Your hard work has paid off. Thanks for sharing.
  22. Had a little play again tonight. The error when running the template is attempt to call method getdiatqncetoentity (a nil value). It flags the goblinAI script at a line with self. Target then local dis =self. Entity etc I looked around the template in Leadwerks and study some scripts.. But noticed I can't find any scripts or details of where the start screen is setup and introduced, loading message and HUD. I found a hud folder under materials with the textures. Where is the script and process of implementing these things in a game etc? Thanks again my friends.
  23. Great will grab this template. Love using dev textures from half Life mapping days. To layout stuff.
  24. Quickly rushed to try this before bed last night. Ran it and loaded fine apart from the torches. Then walked to a barrel and some error came up Nil something entity. I'll try jump back on tonight and write it down. Glad to find this and thanks for updating it back in 2016! This could help with making custom start screens, menus etc... Relative tutorials for Leadwerks are lacking.
  25. This looks amazing for learning content. Does this work with 4.6, could really open and edit all this for learning.
×
×
  • Create New...