Jump to content

Slastraf

Developers
  • Posts

    705
  • Joined

  • Last visited

Everything posted by Slastraf

  1. Only rare 3D map and character moving (for now) Maybe I have started this blog too soon, but I want to share my ideas . (also I am a bit bored ) If you want to build something similar like this in your game, please do that . Whats inside the Screen (items with "+" are currently not in the game): The screen itself: The resolution can be changed in the options menu, There is a very smooth vintage and contrast shader to make it look better. Appearently it has a very good look now. http://steamcommunity.com/sharedfiles/filedetails/?id=408368927 The map: Some self made assets with the nobiax textures in the workshop* make a good look. There are walls, dead trees and a big stone. all of them have physics and it works quite well . This are low poly 3d models made in blender* . The character movement: (character model itself currently work in progress) It is like in L.o.L. , a top-down camera following the character smootlhly via thirdpersonfollow script. w-a-s-d keys move the character into the directions. The mouse is visible and is used for +spells and other things to interact with the 3D world. Very much work needs to be done in particular here. The +barrels and +chests: Unlike the chest, a barrel can be breaked by the player to see whats inside even when its locked. The chest can be opened if it is not locked and a window will appear showing you what`s inside. The +key: Any key that (wow just want to throw in that the site auto saved this at 12:22:22) is found on the map is for opening a +door or a +chest to explore the world. There is also a +key boundle that can open anything if you are skilled in this. +Npcs: They are a main part of the Game, like story and much amount of interacting with them on surprise or +trading. examples: guardian always watches you not stealing a item, or you will be put into jail. +buttons and +bars: On the screen there will be a health bar, a stamina bar and a mana amount bar. if one of them is empty you can think yourself what happens. The bars maximum amount can be increasid with potions for an amount of time or via skill tree. The health bar in particular can be filled with food, the mana bar with drinks, the stamina bar just with potions but it refills itself much faster if the character makes a short break from running. There will also be a combat switch button, when you are in combat, you need too pull out your weapon, when you are in a friendly surrounding with Npcs they want you to put it on your back. Much more buttons will be available like inventory or equip and much more things...
  2. i agree with YouGroove, blender is easy for animation.- If you start with 3d modeling any program is hard to learn but in blender you have a huge amount of things you can do, (for example it has model painter or model(terrain) sculpting aswell as motion capture which cost very much on other programs. Instead in Blender is free and you can learn it by watching much tutorials online (as i started). I cant say anything about 3D coat or others but when i was looking at this (for me ) it seemed to be as hard as blender to start with.
  3. if you are a littlebit advanced use app.win:GetMousePosition() to get the mouse position. then you put this in an if- function , now you just need to say that if mouseposition is in (insert position of your start game, options etc., which can be get when you draw mouseposition on the screen so you can read it) and load your next map or stop the main loop.
  4. think i should go on bug report with setrotation() seems like it safes the first input, then always returns this value even if u put in new ones
  5. I put self.dir = self.GetVelocity():Normalized() self.entity:AlignToVector(self.dir) in updatephysics() .it gives me the error attemt to call field getvelocity (a nil value) dont know why this happens, am i missing something ?
  6. still no affect. this makes no bugs, nothing has a script attached except player *frustrating* , got options (anyone ?
  7. I have already deleted the camera in the fpsscript, also didnt got a probelm with that for now http://www.artur-betz.de/lel here is the link for image i got bugs with leadwerks site discovered sry for link was the fastest way i could make
  8. Player with fpsplayersript modified and other things I have Camera with thirdpersonfollow as target player, PlayerModel attached to player with modeltoplayerscript all physics are same as you said player -> ccharcontroller, collision : char playermodel-> rigid body, no shape, no collision type camera aswell" tried to put if App.window:KeyDown(Key.A) then self.entity:SetInput(45,0 ,0) end in modified fpsplayer, nothing still happens even modeltoplayer has no script
  9. i tried both; only updateworld and only updatephysics; no reaction or what do you want to say with commenting out in updateworld
  10. RpgMovement script: (modified fps script) import "Scripts/Functions/ReleaseTableObjects.lua" Script.health = 100 --float "Health" Script.maxHealth = 100 --float "Max Health" Script.mouseSensitivity = 15 --float "Mouse sensitivity" Script.camSmoothing = 2 --float "Cam smoothing" Script.moveSpeed = 2.5 --float "Move Speed" Script.speedMultiplier = 1.5 --float "Run Multiplier" Script.strafeSpeed = 4 --float "Strafe Speed" Script.playerHeight = 1.8 --float "Player Height" Script.jumpForce = 8 --float "Jump Force" Script.useDistance = 2 Script.alive=true Script.eyeheight=1.6 Script.footstepwalkdelay = 500 Script.footsteprundelay = 300 Script.weaponfile=""--path "Weapon" "Prefab (*.pfb):pfb|Prefabs" Script.input={} Script.maxcarryweight=5 Script.throwforce = 500 Script.isairborne=false Script.bloodindex=1 Script.teamid=1--choice "Team" "Neutral,Good,Bad" Script.hurtoffset=Vec3(0) Script.smoothedhurtoffset=Vec3(0) Script.mouseDifference = Vec2(0,0) Script.playerMovement = Vec3(0,0,0) Script.tempJumpForce = 0 --This function will be called when an entity is loaded in a map. Use this for intitial setup stuff. function Script:Start() self.currentweaponindex=-1 self.camRotation = self.entity:GetRotation(true) self.weaponlowerangle=0 self.image={} self.image.crosshair = Texture:Load("Materials/HUD/crosshair.tex") self.image.hand = Texture:Load("Materials/HUD/use.tex") self.image.blood={} self.image.blood[1]=Texture:Load("Materials/HUD/blood1.tex") self.image.blood[2]=Texture:Load("Materials/HUD/blood2.tex") self.image.blood[3]=Texture:Load("Materials/HUD/blood3.tex") self.image.blood[4]=Texture:Load("Materials/HUD/blood4.tex") --Load shared sounds self.sound={}--table to store sound in self.sound.damage={} self.sound.damage[1]=Sound:Load("Sound/Impact/body_punch_03.wav") self.sound.damage[2]=Sound:Load("Sound/Impact/body_punch_04.wav") self.sound.pickupweapon=Sound:Load("Sound/Player/pickupammo.wav") self.sound.footsteps={} self.sound.footsteps.concrete={} self.sound.footsteps.concrete.step={} self.sound.footsteps.concrete.step[1] = Sound:Load("Sound/Footsteps/Concrete/step1.wav") self.sound.footsteps.concrete.step[2] = Sound:Load("Sound/Footsteps/Concrete/step2.wav") self.sound.footsteps.concrete.step[3] = Sound:Load("Sound/Footsteps/Concrete/step3.wav") self.sound.footsteps.concrete.step[4] = Sound:Load("Sound/Footsteps/Concrete/step4.wav") self.sound.footsteps.concrete.jump = Sound:Load("Sound/Footsteps/Concrete/jump.wav") self.bloodoverlay={} self.entity:SetPickMode(0) --Set the type for this object to player self.entity:SetKeyValue("type","player") local mass = self.entity:GetMass() if self.entity:GetMass()==0 then Debug:Error("Player mass should be greater than 0.") end --Create a camera self.camera = Camera:Create() self.camera:SetFOV(70) self.camera:SetRange(0,0) self.camera:SetMultisampleMode((System:GetProperty("multisample","1"))) --Set the camera's rotation to match the player self.camera:SetRotation(self.entity:GetRotation(true)) --Set the camera position at eye height self.camera:SetPosition(self.entity:GetPosition(true)+Vec3(0,self.eyeheight,0)) --Create listener self.listener = Listener:Create(self.camera) local window = Window:GetCurrent() local context = Context:GetCurrent() window:SetMousePosition(Math:Round(context:GetWidth()/2), Math:Round(context:GetHeight()/2)) self.camera:SetRotation(self.camRotation) if self.weaponfile~="" then local prefab = Prefab:Load(self.weaponfile) if prefab~=nil then if prefab.script~=nil then self:AddWeapon(prefab.script) else prefab:Release() end end end local material = Material:Create() material:SetBlendMode(5)--Blend.Invisible self.entity:SetMaterial(material) material:Release() self.entity:SetShadowMode(0) end function Script:Release() self.listener:Release() if self.corpse~=nil then self.corpse:Release() self.corpse=nil end ReleaseTableObjects(self.sound) ReleaseTableObjects(self.image) local k,v for k,v in pairs(self.weapons) do v:Release() end end function Script:Collision(entity,position,normal,speed) if speed>20 then self:Hurt(100) end end function Script:Hurt(damage,distributorOfPain) if self.health>0 then self.sound.damage[math.random(#self.sound.damage)]:Play() self.health = self.health - damage self.hurtoffset = Vec3(math.random(-1,1),math.random(-1,1),0):Normalize()*30 local blood = {} local n=1 blood.texture=self.image.blood[math.random(1,4)] blood.intensity=1 table.insert(self.bloodoverlay,blood) if self.bloodindex>4 then self.bloodindex=1 end if self.health<=0 then self:Kill() end end end function Script:Kill() self.corpse = Pivot:Create() local shape = Shape:Load("Models/Characters/Generic/corpse.phy")--this shape is made from a low-poly CSG sphere, so it will roll around a bit but come to a stop quickly self.corpse:SetShape(shape) if shape~=nil then shape:Release() end self.corpse:SetMass(5) self.corpse:SetMatrix(self.camera:GetMatrix()) self.camera:SetParent(self.corpse) self.camera:SetPosition(0,0,0) self.camera:SetRotation(0,0,0) self.corpse:SetCollisionType(Collision.Prop) self.corpse:SetSweptCollisionMode(true) self.entity:SetCollisionType(0) self.corpse:SetFriction(10,10) local maxomega=5 self.corpse:SetOmega(Vec3(math.random(-maxomega,maxomega),math.random(-maxomega,maxomega),math.random(-maxomega,maxomega))) local v = self.entity:GetVelocity() if v:Length()>1 then v=v:Normalize() end self.corpse:SetVelocity(Vec3(math.random(-1,1),math.random(-1,1),math.random(-1,1))) self.entity:SetMass(0) self.entity:SetPhysicsMode(Entity.RigidBodyPhysics) end function Script:FindUsableEntity(entity) while entity~=nil do if entity.script then if type(entity.script.Use)=="function" then --If "enable" has not been set, it still won't be "false" so this will pass: if entity.script.enabled~=false then return entity else return nil end end end entity = entity:GetParent() end return nil end function Script:UpdateWorld() local currenttime = Time:GetCurrent() --Exit the function early if the player is dead if self.health<=0 then return end local window = Window:GetCurrent() local context=Context:GetCurrent() if window:KeyHit(Key.P) then self.camera:SetDebugPhysicsMode(true) end self.isairborne = self.entity:GetAirborne() end --This function plays footstep sounds in regular intervals as the player walks function Script:UpdateFootsteps() if self.lastfootsteptime==nil then self.lastfootsteptime=0 end if self.input[0]~=0 or self.input[1]~=0 then local speed = self.entity:GetVelocity():xz():Length() if self.entity:GetAirborne()==false then if (speed>self.moveSpeed*0.5) then local t = Time:GetCurrent() local repeatdelay = self.footstepwalkdelay if speed>self.moveSpeed * (1+(self.speedMultiplier-1)*0.5) then repeatdelay = self.footsteprundelay end if t-self.lastfootsteptime>repeatdelay then self.lastfootsteptime = t local index = math.random(1,4) self.sound.footsteps.concrete.step[index]:Play() end end end end end --This function will be called once per physics update function Script:UpdatePhysics() if self.health<=0 then return end local window = Window:GetCurrent() --Fade out the screen blood if self.bloodintensity~=nil then if self.bloodintensity>0 then self.bloodintensity = self.bloodintensity-0.01 self.bloodintensity = math.max(0,self.bloodintensity) end end --Update the footstep sounds when walking self:UpdateFootsteps() --Toggle the flash light on and off --Apply forces to make the carried object move the way we want if self.carryingEntity then local currentpos = self.carryingEntity:GetPosition(true) local pos = Transform:Point(self.carryposition,self.camera,nil) local rot = Transform:Rotation(self.carryrotation,self.camera,nil) local maxdiff = 0.5 local diff = pos:DistanceToPoint(currentpos) --Drop the carryinItem when the distance between camera and item exceed the pickdistance if diff>1.5 then self:DropEntityCarrying() else if diff>maxdiff then pos = currentpos + (pos-currentpos):Normalize()*maxdiff diff = maxdiff end self.carryingEntity:PhysicsSetPosition(pos.x,pos.y,pos.z,0.25) self.carryingEntity:PhysicsSetRotation(rot,0.5) end end --Player Movement local movex=0 local movez=0 self.input[0]=0 self.input[1]=0 if window:KeyDown(Key.W) then self.input[1]=self.input[1]+1 end if window:KeyDown(Key.S) then self.input[1]=self.input[1]-1 end if window:KeyDown(Key.D) then self.input[0]=self.input[0]+1 end if window:KeyDown(Key.A) then self.input[0]=self.input[0]-1 end local playerMovement = Vec3(0) playerMovement.x = self.input[0] * self.moveSpeed playerMovement.z = self.input[1] * self.moveSpeed --This prevents "speed hack" strafing due to lazy programming if self.input[0]~=0 and self.input[1]~=0 then playerMovement = playerMovement * 0.70710678 end --if self.entity:GetAirborne() then -- playerMovement = playerMovement * 0.2 --end --Check for running with shift and when not carrying anything if self.carryingEntity == nil and window:KeyDown(Key.Shift) then playerMovement.z = playerMovement.z * self.speedMultiplier end -- Check for jumping local jump = 0 if window:KeyHit(Key.Space) and self:IsAirborne() == 0 then jump = self.jumpForce self.sound.footsteps.concrete.jump:Play() --Give the player an extra boost when jumping playerMovement = playerMovement * 1.6 end -- Check for crouching --if App.window:KeyHit(Key.ControlKey) then -- crouched = not crouched --end --With smoothing --Position camera at correct height and playerPosition self.entity:SetInput(self.camRotation.y, playerMovement.z, playerMovement.x, jump , false, 1.0, 0.5, true) local playerPos = self.entity:GetPosition() local newCameraPos = self.camera:GetPosition() --local playerTempHeight = ((self:IsCrouched() == 1) and crouchHeight or playerHeight) newCameraPos = Vec3(playerPos.x, newCameraPos.y ,playerPos.z) if newCameraPos.y<playerPos.y + self.eyeheight then newCameraPos.y = Math:Curve(playerPos.y + self.eyeheight, newCameraPos.y, self.camSmoothing) else newCameraPos.y = playerPos.y + self.eyeheight end self.camera:SetPosition(newCameraPos) end --Return whether the player is airborne function Script:IsAirborne() return self.entity:GetAirborne() and 1 or 0 end function Script:PostRender(context) --TakeDamage end function Script:TakeDamage(damage) --Decrease health self.health = self.health - damage; --Call OnHit output self:OnHit() --If health lower or equal to zero, the player is dead if self.health <= 0 then self.alive = false --Call the OnDead output self:OnDead() end end --Increase health function Script:ReceiveHealth(healthPoints)--in --Increase health self.health = self.health + healthPoints; --Health can not be more then maximum health if self.health > self.maxHealth then self.health = self.maxHealth end --Call Health received output self.component:CallOutputs("HealthReceived") end --when health is zero or lower, an output call is made function Script:OnDead()--out --Extra check to make sure that the player is no longer alive if not(self:IsAlive()) then self.component:CallOutputs("Ondead") end end --when the player gets damaged we call this output function Script:OnHit()--out self.component:CallOutputs("OnHit") end RPG_modeltoplayer script: function Script:Start() end function Script:UpdateWorld() end function Script:UpdatePhysics() if App.window:KeyDown(Key.A) then self.entity:SetInput(45,0 ,0) end end function Script:Draw() end function Script:Render() self.entity:SetPosition(self.pivot:GetPosition(true),true) end sorry for length, better you make this in a empty script for overview
  11. so now i tried in updatephysics: if App.window:KeyDown(Key.A) then self.entity:SetInput(45,0 ,0) end (45 only for test) no reaction, no error
  12. Hello I was making an UFO camera attached to a model which is attached to an modified fps player. the fps player model does not rotate.(neither anything) So : my problem is that i cant make the PlayerModel facing the direction it walks, i already tried keydown : a, etc. -> setrotation (does not work for me, only in x axis in all 3 variables that it needs) and some other things that are not necessary So anyone got a solve?
  13. havent tried that in the app.lua? taught you can put in there any reslution
  14. have same problem here, as soon as i add crates. HOW TO FIX: use the .mdl and attach the texture manually, then it will work. physics shape need to be attached
  15. http://opengameart.org/content/industrial-extension-pack-1-tanks found some good no license assets
  16. dat music makes gema angry, cant watch vid
  17. Hello I just wanted to say here, that Leadwerks should come with some basic Fonts like(maybe) futuristic, mid-age, and other, that dont have a extra license as usual. For me arial is boring, it is just handable for prototypes.
  18. yeah i need to understand that you need to attach the material in the model editor , not as usual
  19. got same problem , got to upload it with my /werkspace/page/games/_/slastraf-horror-1-r69 slastraf horror game
  20. yeah i tried to apply animated shaders aswell, same results only a very strange material. going to try this now again. thanks for reply
  21. Still no answer ? sorry for repost , cant get this working is frustrating atm
  22. Hello Community I have a problem with a low poly character animation to leadwerks (again) In Blender the character and animation rig seems to be fine, I already used ctrl+a, used the leadwerks exporter as well as regular .fbx export , but in leadwerks model editor the bones seem not to be attached to the model, they just loop the animation and the model is always on the first frame of the default animation. regards Friedrich Betz player.fbx
  23. try to open it in blender and then use leadwerks exporter or export it as .fbx
×
×
  • Create New...