-
Posts
21 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by insomniac_lemon
-
-
Did you search your system for .werk files? Maybe you are simply remembering it wrong(, I hope for your own good).
I am very much sure. All the files are new.
Alongside of the default files I had /Scripts/Objects/spells/stream.lua
inside weapons I had something like FPSgun_edited.lua from when I started,
inside player I had FPSPlayer_custom.lua
along with the other maps, I had something like PROJECT.map, not sure if that was the name, but I remember it was all caps.
The update deleting my files is the only possible issue. Searching for .werk files results in only the default file that is fresh, searching for stream.lua turns up nothing. To add to that, the 'recent' files in both map/script editors don't have any traces of the files I've previously worked on.
Is it possible that, because I was using the default project instead of my own, the default .werk file was loaded with the update, removing any changes I've made?
-
You can change the default location of the projects directory in the options dialog. However, I don't think projects were ever stored anywhere but the documents folder, by default. Some time ago, the config and log file locations were also moved to the documents folder, to make it easier for people to find.
I'm fairly sure that my projects were in the .leadwerks folder, and that a week ago it wasn't in my documents folder, and now it's the ONLY thing in my documents folder. (because I don't use my native documents folder, I use a documents folder on another drive)
Whether or not, my Leadwerks files are GONE. I had them right with all the other default project files, including a map, new scripts (including one in a new folder) and they're all missing. I did pre-2015 updates and every time it would start right up to my scene telling me I needed to update my project, now there is no trace whatsoever that I have done anything.
-
I have no idea what this is about. There have been no such changes. Are you talking about the projects folder or the application files themselves?
The projects folder (what once was ~/.leadwerks) . Where it was before still exists, but only with 'Leadwerks.log' in it, and the project I was working on before (map and scripts) are gone. Now the projects folder is in a newly-created ~/Documents/Leadwerks
This happened with the 3.4 update.
-
So the newest update seems to have moved from .leadwerks in the home folder to Leadwerks in the Documents folder..... all of the old files are just gone?
Why were the map and scripts files not moved instead of deleted? Or at least left alone so the user could deal with them?
-
Guppy, I personally use Arch because it used systemd (Ubuntu using upstart seemed a little slow to boot up) and the user repository makes it *much* easier to get software that isn't in (or updated in!) the official repos (adding repositories in Ubuntu is a MAJOR mess) and generally I want to be using updated software (VLC and WINE were usually my issues) rather than what it was updated to when the distro was released. That being said, I use nVidia so it's not an issue.
Greb, I'm not sure of your setup, but if your situation is like mine (My computer is a pre-built, came with an ATI card, and I had driver problems on Windows) then maybe you should consider buying an nVidia graphics card (please disregard if you specifically bought an AMD graphics card). The sad fact really is that AMD has the WORST driver support out of all of the manufacturers when it comes to Linux. When it comes to gaming on Linux, AMD fans are gonna have a bad time. (one example is Borderlands 2 and BL:tpS released on Linux, states AMD cards are not and may not function properly)
Intel has the best open source drivers, and nVidia has the best proprietary drivers. Overall, nVidia gives the best experience for graphically intense operations. If you do, maybe you could just get something from the 400+ series in GTS or GTX and spend $100-$200 or less. These are a bit old but still support the newest version of OpenGL, you might even find a really nice deal for a used one.
-
Using Steam version on Arch (admittedly not fully up to date, Kernel 3.16.4-1-ARCH) Intel i7 CPU, nVidia GTS 450 GPU w/ driver version 343.22, no issues here.
Sounds like maybe another issue. Have you tried starting Leadwerks through terminal to see if that gives you a more specific reason for the error? Maybe your GPU is too old to support the OpenGL version, or maybe you have a library issue for some reason.
-
Try setting the position of the emitter at a fixed position somewhere in your level where you can actually view it. At least you can check if the emitter is properly working. If it is properly working then you know there is something wrong with the positioning code of the emitter.
So, I tried this and still saw nothing. I tried creating a light at a fixed point instead, that worked. I tried changed position/velocity, material, none of those fixed it. I also tried creating the emitter in different places, defining it differently, even full on in the main script didn't seem to work.
I believe I adapted my code from this reference page (see water/mist comments in spoiler above) and it seems like it has since changed (unless somehow, I found a very similar code snippet that instead used instances of an emitter), I tried making it like the new code and it didn't seem to help, either.
-
I have a problem with an emitter that still hasn't been solved, that is I'm trying to use an emitter as a weapon, but no particles [are visibly] created, and no errors are thrown.
If it's that I have the wrong position, velocity, speed, size, or some other issue entirely, I'm not sure. If there is some way I can figure out where particles are being created, or if someone could point out what mistake I'm making and how I should fix it, I would appreciate it.
My weapon code:
import "Scripts/AnimationManager.lua" Script.index=1--int "Weapon slot" Script.offset=Vec3(1,-0.6,0)--Vec3 "Offset" Script.rotation=Vec3(0,0,0)--Vec3 "Rotation" function Script:Start() if self.started then return end self.started=true self.entity:SetPickMode(0) self.entity:SetAnimationFrame(0,1,"fire") self.entity:SetShadowMode(0) self.entity:SetOcclusionCullingMode(false) self.currentaction=nil self.sound={} self.animationmanager = AnimationManager:Create(self.entity) self.originalposition = self.entity:GetPosition() self.originalrotation = self.entity:GetRotation() self.emitter={} --Create the water mist emitter self.emitter[0]=Emitter:Create() --Create the water mist material self.emitter[0]:SetMaterial("Materials/Effects/muzzleFlash.tex") self.emitter[0]:SetEmissionVolume(10,10,10) self.emitter[0]:SetColor(1,0.1,0.1,1) self.emitter[0]:SetVelocity(2,0,0,1) self.emitter[0]:SetParticleCount(100) self.emitter[0]:SetReleaseQuantity(10) self.emitter[0]:SetMaxScale(100) self.emitter[0]:SetDuration(1000) self.emitter[0]:SetAcceleration(0,-12,0) self.emitter[0]:Hide() --emitter:AddScaleControlPoint(0,1) --sets inital scale to 1 -- emitter:AddScaleControlPoint(1,3) --sets final scale to 3 --emitter:AddAlphaControlPoint(0,0) --sets inital alpha to 0 --emitter:AddAlphaControlPoint(1,1) --sets final alpha to 1 return true end function Script:UpdateWorld() local pickinfo=PickInfo() end --[[ function Script:UpdatePhysics() end ]]-- --[[ function Script:Collision(entity, position, normal, speed) end ]]-- function Script:Fire() local pickinfo=PickInfo() local e local place place= self.player.camera:GetPosition(true) e = self.emitter[0]:Instance() e = tolua.cast(e,"Emitter") e:Show() e:SetLoopMode(false,true) e:SetPosition(place, true) local v=3 e:SetVelocity(0, 0, 10 ,10) end function Script:Draw() local place place= self.player.camera:GetPosition(true) self.entity:SetPosition(place+self.offset, true) self.animationmanager:Update() end --[[ function Script:DrawEach(camera) end ]]-- --[[ --This function will be called after the world is rendered, before the screen is refreshed. --Use this to perform any 2D drawing you want the entity to display. function Script:PostRender(context) end ]]-- function Script:Hide() self.entity:Hide() end --[[ --This function will be called when the entity is deleted. function Script:Detach() end ]] function Script:Release() self.emitter[0]:Release() self.emitter[1]:Release() self.emitter=nil ReleaseTableObjects(self.sound) end --This function will be called when the last instance of this script is deleted. function Script:Cleanup() self.Release() end
My main code:
[/size] 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.flashlighton = false --bool "Flashlight on" 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 function Script:CycleWeapon(direction) local n,weapon local foundindex=false local prevweapon if direction==1 then for n,weapon in pairs(self.weapons) do if foundindex then self:SelectWeapon(n) return end if self.currentweaponindex==n then foundindex=true end end if foundindex then for n,weapon in pairs(self.weapons) do self:SelectWeapon(n) return end end else for n,weapon in pairs(self.weapons) do if prevweapon then if self.currentweaponindex==n then self:SelectWeapon(prevweapon) return end end prevweapon=n end if prevweapon then self:SelectWeapon(prevweapon) end end end function Script:AddWeapon(weapon) if weapon.index==nil then weapon.index=1 end if self.weapons[weapon.index]==nil then self.weapons[weapon.index]=weapon self.weapons[weapon.index].player = self self.weapons[weapon.index].entity:SetParent(self.weapontag) self.weapons[weapon.index].entity:SetPosition(self.weapons[weapon.index].offset) if self.weapons[weapon.index].rotation~=nil then self.weapons[weapon.index].entity:SetPosition(self.weapons[weapon.index].rotation) end self.weapons[weapon.index].entity:Hide() if weapon.index>self.currentweaponindex then self:SelectWeapon(weapon.index) end if self.sound.pickupweapon~=nil then self.sound.pickupweapon:Play() end return true end return false end function Script:SelectWeapon(index) if index~=self.currentweaponindex then if self.weapons[self.currentweaponindex]~=nil then self.weapons[self.currentweaponindex].entity:Hide() end self.currentweaponindex = index if self.weapons[self.currentweaponindex]~=nil then self.weapons[self.currentweaponindex].entity:Show() end self.weaponlowerangle=90 self.suspendfire=false self.weapontag:SetRotation(self.weaponlowerangle,0,0) end end --This function will be called when an entity is loaded in a map. Use this for intitial setup stuff. function Script:Start() self.weapons={} 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.flashlight=Sound:Load("Sound/Player/flashlight_02_on.wav") 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={} local n for n=1,4 do self.sound.footsteps.concrete.step[n] = Sound:Load("Sound/Footsteps/Concrete/step"..tostring(n)..".wav") end 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.05,1000) 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) --Create flashlight self.flashlight = SpotLight:Create() self.flashlight:SetParent(self.camera,false) self.flashlight:SetPosition(0.2,-0.1,0) self.flashlight:SetRotation(10,-3,0) self.flashlight:SetConeAngles(25,15) self.flashlight:SetShadowMode(Light.Dynamic+Light.Static) if self.flashlighton==false then self.flashlight:Hide() end --Load the default weapon, if one is set self.weapontag = Pivot:Create(self.camera) --------------------------------------------------------------------------- --We want the player model visible in the editor, but invisible in the game --We can achieve this by creating a material, setting the blend mode to make --it invisible, and applying it to the model. --------------------------------------------------------------------------- local material = Material:Create() material:SetBlendMode(5)--Blend.Invisible self.entity:SetMaterial(material) material:Release() self.entity:SetShadowMode(0) 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 end function Script:Release() self.listener:Release() self.flashlight:Release() if self.corpse~=nil then self.corpse:Release() self.corpse=nil end ReleaseTableObjects(self.sound) ReleaseTableObjects(self.image) ReleaseTableObjects(self.weapons) 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.flashlight:Hide() if self.weapons[self.currentweaponindex]~=nil then self.weapons[self.currentweaponindex]:Hide() 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() if self.lastweaponhittesttime==nil then self.lastweaponhittesttime=0 end if currenttime - self.lastweaponhittesttime>100 then self.lastweaponhittesttime=currenttime local pickinfo=PickInfo() local p1 = Transform:Point(0,0,0,self.camera,nil) local p2 = Transform:Point(0,0,0.6,self.camera,nil) local pickmode = self.entity:GetPickMode() self.entity:SetPickMode(0) --if self.entity.world:Pick(p1,p2,pickinfo,0.25) then -- self.weaponlowered=true --else -- self.weaponlowered=false --end self.entity:SetPickMode(pickmode) end if self.weaponlowered then self.weaponlowerangle = self.weaponlowerangle + 4 * Time:GetSpeed() else self.weaponlowerangle = self.weaponlowerangle - 4 * Time:GetSpeed() end self.weaponlowerangle = math.max(0,math.min(self.weaponlowerangle,90)) self.weapontag:SetRotation(self.weaponlowerangle,0,0) --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 --Mouse look self.currentMousePos = window:GetMousePosition() window:SetMousePosition(Math:Round(context:GetWidth()/2), Math:Round(context:GetHeight()/2)) self.currentMousePos.x = Math:Round(self.currentMousePos.x) self.currentMousePos.y = Math:Round(self.currentMousePos.y) if self.mousezpos==nil then self.mousezpos=0 end if self.currentMousePos.z~=self.mousezpos then if self.weapons[self.currentweaponindex] then if self.weapons[self.currentweaponindex].currentaction==nil then for n=1,math.abs(self.currentMousePos.z-self.mousezpos) do if self.currentMousePos.z>self.mousezpos then self:CycleWeapon(-1) else self:CycleWeapon(1) end end self.mousezpos=self.currentMousePos.z end else self.mousezpos=self.currentMousePos.z end end self.mouseDifference.x = Math:Curve(self.currentMousePos.x - Math:Round(context:GetWidth()/2),self.mouseDifference.x,3) self.mouseDifference.y = Math:Curve(self.currentMousePos.y - Math:Round(context:GetHeight()/2),self.mouseDifference.y,3) self.camRotation.x = Math:Clamp(self.camRotation.x + self.mouseDifference.y / self.mouseSensitivity,-90,90) self.camRotation.y = self.camRotation.y + (self.mouseDifference.x / self.mouseSensitivity) --Adjust the view shake self.hurtoffset.x = Math:Inc(0,self.hurtoffset.x,2*Time:GetSpeed()) self.hurtoffset.y = Math:Inc(0,self.hurtoffset.y,2*Time:GetSpeed()) self.smoothedhurtoffset.x = Math:Curve(self.hurtoffset.x,self.smoothedhurtoffset.x,3) self.smoothedhurtoffset.y = Math:Curve(self.hurtoffset.y,self.smoothedhurtoffset.y,3) --Set the camera angle self.camera:SetRotation(self.camRotation+self.smoothedhurtoffset) --Picking and usage local pickInfo = PickInfo() --Raycast Pick that is being send from the camera in to the world self.canUse = false local fire = false local currentime = Time:GetCurrent() if self.weapons[self.currentweaponindex]~=nil then if self.weapons[self.currentweaponindex].automatic then if window:MouseDown(1) then fire=true else self.suspendfire=false end else if window:MouseHit(1) then fire=true end end end if fire then if self.carryingEntity then local dir = Transform:Vector(0,0,self.throwforce,self.camera,nil) self.carryingEntity:AddForce(dir) self:DropEntityCarrying() else if self.suspendfire~=true then if self.weapons[self.currentweaponindex].clipammo==0 and self.weapons[self.currentweaponindex].automatic==true then self.suspendfire=true end self.weapons[self.currentweaponindex]:Fire() end end end if window:KeyHit(Key.R) then if self.weapons[self.currentweaponindex]~=nil then if type(self.weapons[self.currentweaponindex].CanReload)=="function" then if self.weapons[self.currentweaponindex]:CanReload() then self.suspendfire=false self.weapons[self.currentweaponindex]:Reload() end end end end if window:KeyHit(Key.E) then if self.carryingEntity then self:DropEntityCarrying() else local p0 = self.camera:GetPosition(true) local p1 = Transform:Point(0,0,self.useDistance,self.camera,nil) if self.entity.world:Pick(p0,p1, pickInfo, 0, true) then --Looks for any entity in the hierarchy that has a "Use" function local usableentity = self:FindUsableEntity(pickInfo.entity) if usableentity~=nil then --Use the object, whatever it may be usableentity.script:Use(self) else if self.carryingEntity == nil then mass = pickInfo.entity:GetMass() --Pick up object if it isn't too heavy if mass>0 and mass<=self.maxcarryweight then self.carryingEntity = pickInfo.entity self.carryingobjectcollisiontype = self.carryingEntity:GetCollisionType() self.carryingEntity:SetCollisionType(Collision.Debris) self.carryrotation = Transform:Rotation(pickInfo.entity:GetQuaternion(true),nil,self.camera) self.carryposition = Transform:Point(pickInfo.entity:GetPosition(true),nil,self.camera) end end end end end end --The icon that shows that an object can be picked up or can be interacted with --Amnesia fan, I see. if self.carryingEntity == nil then local p0 = self.camera:GetPosition(true) local p1 = Transform:Point(0,0,self.useDistance,self.camera,nil) if self.entity.world:Pick(p0,p1, pickInfo, 0, true) then if self:FindUsableEntity(pickInfo.entity)~=nil then self.canUse=true else local mass = pickInfo.entity:GetMass() if mass>0 and mass<=self.maxcarryweight then self.canUse = true end end end end end function Script:DropEntityCarrying() self.carryingEntity:SetCollisionType(self.carryingobjectcollisiontype) self.carryingEntity = nil 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() --Exit the function early if the player is dead 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 if window:KeyHit(Key.F) then self.sound.flashlight:Play() if self.flashlight:Hidden() then self.flashlight:Show() else self.flashlight:Hide() end end --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(38) then self.input[1]=self.input[1]+1 end if window:KeyDown(40) then self.input[1]=self.input[1]-1 end if window:KeyDown(39) then self.input[0]=self.input[0]+1 end if window:KeyDown(37) 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) context:SetBlendMode(Blend.Alpha) ----------------------------------------------------------------------- --Draw the blood overlay on the screen to indicate damage local k,v for k,v in pairs(self.bloodoverlay) do if v.intensity>0 then context:SetColor(1,1,1,v.intensity*0.5) context:DrawImage(v.texture,0,0,context:GetWidth(),context:GetHeight()) if self.health>0 then v.intensity = v.intensity-0.02 * Time:GetSpeed() end else self.bloodoverlay[k]=nil end end context:SetColor(1,1,1,1) if self.health>0 then if self.canUse==true and self.carryingEntity == nil then local pickUpX = math.floor((context:GetWidth() - self.image.hand:GetWidth()))/2 local pickUpY = math.floor((context:GetHeight() - self.image.hand:GetHeight()))/2 context:SetBlendMode(Blend.Alpha) context:DrawImage(self.image.hand, pickUpX, pickUpY) else if self.carryingEntity==nil then if self.weapons[self.currentweaponindex]~=nil then if self.image.crosshair then local crossHairX = math.floor((context:GetWidth() - self.image.crosshair:GetWidth()))/2 local crossHairY = math.floor((context:GetHeight() - self.image.crosshair:GetHeight()))/2 context:SetBlendMode(Blend.Alpha) context:DrawImage(self.image.crosshair, crossHairX, crossHairY) end end end end end context:SetBlendMode(1) context:SetColor(0,0,0,0.5) local indent=8 local w = 180 local h = 40 end --Return whether the player is crouching function Script:IsAlive() return self.alive and 1 or 0 end --TakeDamage 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[size=4]
-
How about Ctrl+shift+z for redo? Ctrl+y is completely annoying, Microsoft-y, Ctrl+shift+z is fairly common (Adobe+Autodesk products, Blender, and GIMP as examples) and I definitely prefer that.
Click+drag doesn't seem to work for adding things to the flowgraph editor (this can be done through the scene menu, though). The scrollwheel also doesn't scroll in the asset browser.
EDIT: A more native file browser (with more native styling, is aware of system bookmarks) would be preferred. For a good example, look at GIMP's open/save file browser. Or Google Chrome's. AFAIK it's either some kind of system request (like it queries the default file browser for it) or it's a standard component that knows where to look for bookmarks.
-
You are taking local camera position and it's always the same for camera. Use :GetPosition(true) and :SetPosition(place, true) to work with global position.
Thanks, I got it working now, that was one of my issues. (another was needing an offset so a non-colliding model would appear).
Why is it that SetRotation doesn't need to be done, but the rotation still occurs?
Also, am I doing something wrong with my emitter that would cause it not to work?
import "Scripts/AnimationManager.lua" Script.index=1--int "Weapon slot" Script.offset=Vec3(1,-0.6,0)--Vec3 "Offset" Script.rotation=Vec3(0,0,0)--Vec3 "Rotation" function Script:Start() if self.started then return end self.started=true self.entity:SetPickMode(0) self.entity:SetAnimationFrame(0,1,"fire") self.entity:SetShadowMode(0) self.entity:SetOcclusionCullingMode(false) self.currentaction=nil self.sound={} self.animationmanager = AnimationManager:Create(self.entity) self.originalposition = self.entity:GetPosition() self.originalrotation = self.entity:GetRotation() self.emitter={} --Create the water mist emitter self.emitter[0]=Emitter:Create() --Create the water mist material self.emitter[0]:SetMaterial("Materials/Effects/muzzleFlash.tex") self.emitter[0]:SetEmissionVolume(10,10,10) self.emitter[0]:SetColor(1,0.1,0.1,1) self.emitter[0]:SetVelocity(2,0,0,1) self.emitter[0]:SetParticleCount(100) self.emitter[0]:SetReleaseQuantity(10) self.emitter[0]:SetMaxScale(100) self.emitter[0]:SetDuration(1000) self.emitter[0]:SetAcceleration(0,-12,0) self.emitter[0]:Hide() --emitter:AddScaleControlPoint(0,1) --sets inital scale to 1 -- emitter:AddScaleControlPoint(1,3) --sets final scale to 3 --emitter:AddAlphaControlPoint(0,0) --sets inital alpha to 0 --emitter:AddAlphaControlPoint(1,1) --sets final alpha to 1 return true end function Script:UpdateWorld() local pickinfo=PickInfo() end --[[ function Script:UpdatePhysics() end ]]-- --[[ function Script:Collision(entity, position, normal, speed) end ]]-- function Script:Fire() local pickinfo=PickInfo() local e local place place= self.player.camera:GetPosition(true) e = self.emitter[0]:Instance() e = tolua.cast(e,"Emitter") e:Show() e:SetLoopMode(false,true) e:SetPosition(place, true) local v=3 e:SetVelocity(10, 0, 0 ,0) end function Script:Draw() local place place= self.player.camera:GetPosition(true) self.entity:SetPosition(place+self.offset, true) self.animationmanager:Update() end --[[ function Script:DrawEach(camera) end ]]-- --[[ --This function will be called after the world is rendered, before the screen is refreshed. --Use this to perform any 2D drawing you want the entity to display. function Script:PostRender(context) end ]]-- function Script:Hide() self.entity:Hide() end --[[ --This function will be called when the entity is deleted. function Script:Detach() end ]] function Script:Release() self.emitter[0]:Release() self.emitter[1]:Release() self.emitter=nil ReleaseTableObjects(self.sound) end --This function will be called when the last instance of this script is deleted. function Script:Cleanup() self.Release() end
Basically what I'm trying to accomplish is to have a jet of particles (like a flamethrower) spew forwards from the character, but I don't see any indication of ANY particles after holding the left mouse button and looking around.
-
While in the weapon script I'd say self.player:GetPosition() should return an appropriate vec3.
To make a prefab afaik you create the entity with all its scripts, materials and such and then in the scene tab just do save as prefab. I know that if I don't give the name with the .pfb suffix then its not treated as a prefab. The prefab is your final step though, you do all the work on your created entity first. I wouldn't even consider looking at making something a prefab until I'd finished debugging the source entity.
As for the dual wield thing, for weapons and spells I'd guess you would need to pass an additional argument into the different weapon scripts signifying if they being used left or right handed. The scripts would then have to load either the left or right handed images and animations and also choose between left and right offsets to keep everything consistent.
I think I'm making sense....
I've switched over to trying to use a box that's repositioned, but so far it seems to not be working at all. It rotates with the view, but seems to stay in one place.
My specific code for that so far is:
function Script:Draw() local place place= self.player.camera:GetPosition() self.entity:SetPosition(place) self.animationmanager:Update() end
Full script:
import "Scripts/AnimationManager.lua" Script.index=1--int "Weapon slot" Script.offset=Vec3(0,0,0)--Vec3 "Offset" Script.rotation=Vec3(0,0,0)--Vec3 "Rotation" Script.clipsize=6--int "Clip size" Script.ammo=200--int "Ammunition" Script.maxswayamplitude=0.01 Script.amplitude=0 Script.swayspeed=0 Script.timeunits=0 Script.smoothedposition=Vec3(0) Script.smoothedrotation=Vec3(0) Script.verticalbob=0 Script.jumpoffset=0 Script.bulletspeed=200--float "Bullet speed" Script.landoffset=0 Script.pellets=1--int "Pellets" Script.scatter=0.01--float "Scatter" Script.firetime=0 Script.refirerate=100--int "Refire rate" Script.bulletrange=1000 Script.muzzleflashscale=0.2--float "Flash size" Script.bulletforce=500--float "Force" Script.bulletdamage=10--int "Damage" Script.automatic=true--bool "Automatic" Script.dryfiresoundfile=""--path "Dry fire" "Wav File (*wav):wav|Sound" Script.fire1soundfile=""--path "Fire sound 1" "Wav File (*wav):wav|Sound" Script.fire2soundfile=""--path "Fire sound 2" "Wav File (*wav):wav|Sound" Script.fire3soundfile=""--path "Fire sound 3" "Wav File (*wav):wav|Sound" Script.pumpsoundfile=""--path "Pump sound" "Wav File (*wav):wav|Sound" Script.ricochet1soundfile=Sound:Load("Sound/Ricochet/bullet_impact_dirt_01.wav") Script.ricochet2soundfile=Sound:Load("Sound/Ricochet/bullet_impact_dirt_02.wav") Script.ricochet3soundfile=Sound:Load("Sound/Ricochet/bullet_impact_dirt_03.wav") Script.reloadsoundfile=""--path "Reload sound" "Wav File (*wav):wav|Sound" Script.reloadspeed=0.05--float "Reload speed" Script.firespeed=0.05--float "Fire speed" Script.tracer = Sprite:Create() Script.tracer:Hide() Script.currentaction=nil function Script:Start() if self.started then return end self.started=true self.entity:SetAnimationFrame(0,1,"fire") self.entity:Hide() self.entity:SetShadowMode(0) self.entity:SetOcclusionCullingMode(false) self.currentaction=nil self.clipammo=self.clipsize self.ammo = self.ammo - self.clipammo self.muzzle = self.entity:FindChild("muzzle") self.sound={} self.animationmanager = AnimationManager:Create(self.entity) self.originalposition = self.entity:GetPosition() self.originalrotation = self.entity:GetRotation() self.emitter={} --Create the water mist emitter self.emitter[0]=Emitter:Create() --Create the water mist material self.emitter[0]:SetMaterial("Materials/Effects/muzzleFlash.tex") self.emitter[0]:SetEmissionVolume(0.5,0.5,0.5) self.emitter[0]:SetColor(1,0.1,0.1,1) self.emitter[0]:SetVelocity(1.5,1.5,1.5,1) self.emitter[0]:SetParticleCount(10) self.emitter[0]:SetReleaseQuantity(10) self.emitter[0]:SetMaxScale(0.3) self.emitter[0]:SetDuration(1000) self.emitter[0]:SetAcceleration(0,-12,0) self.emitter[0]:Hide() --emitter:AddScaleControlPoint(0,1) --sets inital scale to 1 -- emitter:AddScaleControlPoint(1,3) --sets final scale to 3 --emitter:AddAlphaControlPoint(0,0) --sets inital alpha to 0 --emitter:AddAlphaControlPoint(1,1) --sets final alpha to 1 return true end function Script:UpdateWorld() local pickinfo=PickInfo() end --[[ function Script:UpdatePhysics() end ]]-- --[[ function Script:Collision(entity, position, normal, speed) end ]]-- function Script:Fire() local pickinfo=PickInfo() local e local place place= self.player.camera:GetPosition() e = self.emitter[0]:Instance() e = tolua.cast(e,"Emitter") e:Show() e:SetLoopMode(false,true) e:SetPosition(place) local v=0.2 e:SetVelocity(100, 0, 0 ,0) end function Script:Draw() local place place= self.player.camera:GetPosition() self.entity:SetPosition(place) self.animationmanager:Update() end --[[ function Script:DrawEach(camera) end ]]-- --[[ --This function will be called after the world is rendered, before the screen is refreshed. --Use this to perform any 2D drawing you want the entity to display. function Script:PostRender(context) end ]]-- function Script:Hide() self.entity:Hide() self.muzzleflash:Hide() self.muzzlelight:Hide() end --[[ --This function will be called when the entity is deleted. function Script:Detach() end ]] function Script:Release() self.emitter[0]:Release() self.emitter[1]:Release() self.emitter=nil ReleaseTableObjects(self.sound) end --This function will be called when the last instance of this script is deleted. function Script:Cleanup() self.Release() end
Please forgive me for I'm still in the stage where I'm not sure what to do next. I'm sure my emitter isn't working, but it could be emitting somewhere I can't see, which is why getting the positioning working properly is important. I hope this has an easy fix, but there's so much non-basic stuff (view bob, bullet tracer, etc.) that makes it hard for me to understand how it's been (or how it SHOULD be) done.
-
Since you are just starting out I would encourage you to play around with the autopistol prefab. It think it is easier to edit an existing script rather than writing it from scratch. Majority of the ground work is already there.
Definitely look at everything that comes with the engine.
For example, many spells are really nothing but very flashy bullets. You'll have a cast (fire) anim + instantiate the spell effect (bullet) with travel and then on collision you can create another anim/efffect and add damage to the player. The existing gun code gives you a framework to adapt to your needs, much faster than starting from scratch.
My major problem is many things are behind the scenes, like how you see the weapon prefab, but there's no clear link to the script it uses (although it's clear if you're LOOKING for it in the scripts section)
I think I understand most of it, but trying to make my own script/prefab has not worked thus far. Even pasting in the autopistol's code into my script causes a sprite to appear at [0,0,0] which tells me I've made the prefab wrong. What I did was make a pivot near the player, attach the script in that, and make that into a prefab [i've tried different parent/prefab combos].
So my real question here, as I've not seen and tutorials on it yet, either/or
How do you actually MAKE weapon prefabs? Also,
How exactly am I supposed to be getting the user's position? What I thought worked doesn't seem to, so I'm assuming I'm missing some crucial piece? What about numbers for velocity, how does that work in relation to the player?
The reason why I'd like to make my own script is because what I'm trying to do is fundamentally different on many levels, and many things in the autopistol script don't really apply. I get that bolt spells *would* be useful to still use bullets (especially if I could attach an emitter to the bullet), but what I'm trying to do first is make a flamethrower/stream spell, so instead of a bullet I'd like to use actual emitted particles instead.
How exactly would I call the script manually instead of from a prefab? I already know that I'm likely going to abandon it later, because of the amount of possibilities for dual wield combinations it woudn't be worth making a prefab for each one (unless it's possible to load multiple weapon prefabs at once, say for left and right?).
-
1. Leadwerks is a game engine. Anything gameplay related has to be programmed. There are some gun examples in the deafult SDK but dual wielding is not part of that. This is something you would have to make yourself.
2. This is really complex stuff you are talking about here. I would not recommend doing this and rather use existing animations.
3. 2 answers here: Yes you can inlock the mouse: ShowMouse() to view it and making sure the Mouse coordinates are not centered every frame. Maximizing a window can also done by code. http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/window/windowcreate-r462
1. I know, I was just thinking out loud and asking in case others knew something I didn't. So am I right in thinking in my situation I should be avoiding the weapon prefab situation altogether and just use scripts with needed variables (left/right hand, spell info) and call them through code?
2. Again, I know.... but when it comes to character customizability (different clothes, armor, etc) it would be an easier setup, and I'd love if I could make hits so they actually.... hit... rather than just passing through the enemy. I'd like it if the enemy hit could influence the way the weapon keeps going, along with the ability to cause dynamic destruction (cut off limbs, dent armor, collide weapons) is probably even more advanced, but something I hope I could eventually do.
3. Thanks! Tried both, and they worked perfectly. I never actually thought to look in app.lua (I didn't really know about it).....
-
Hello.
I recently purchased this program on Steam because I wish to make my own game, basically an RPG inspired by the many downfalls discovered after playing copious amounts of Oblivion/Skyrim. Things like gold/stature being relatively useless and easy to acquire, inventory management being tedious, useless items, and seemingly important things like bartering needing to be fleshed out. I also have tons of ideas on how the spell/combat system can be improved, and have story/mechanic ideas from an unrelated RPG idea I had previously.
One of the main reasons I was interested in Leadwerks was the Linux support, as it seems the Unreal editor does not yet support it (at least not according to their site), plus Leadwerks seems to be more user-friendly in a *few* ways.
Naturally, I have a few questions....
1. Is dual-wielding weapons supported, or would I need to somehow make custom scripts, and weapon-combo prefabs from those instead?
2. Is it possible to take a skeletal-like structure (like the FPSPlayer prefab) and animate that using kinematics and scripted modifications (such as for different weapons/spells) to do movements instead of pre-made animations? (obviously binding a skin to it later?)
3.With the indie version, is it possible to unlock the mouse so I can try maximizing the window?
Unrelated, how do I change my forum avatar? I don't see the option anywhere.
-
Yeah, a bit better, but still choppy. The AI level gives me around 7-15 FPS, which is uncomfortably slow. It's especially odd because it's not even rendering at 1920x1080, it's 1024x768.
Actually, even having lights enabled in the viewport makes it hard to navigate the AI scene in the editor.
EDIT: Ok, I think I solved this. If I close Steam and Chrome, the game performs fine (mostly, still some minor lag spikes when firing at enemies).
It also performs fine (with Steam and Chrome open) if I switch the editor's render mode to textured (turning lighting off).
So maybe it's a memory thing? My memory usage (with Steam and Chrome open) is 3.5 GiB.... maybe it's hitting the limit of memory a 32bit app can access? Is it running it [the game code] as 32bit?
EDIT2: Seems funky. Got it rendering in 1920x1080 now, with only the editor (rendering in wireframe) and Steam open, the AI level runs at 3 FPS just walking. Closing Steam, it's perfectly fine until combat starts (which gets choppy from gunshots/hits?), until the end of the level.
-
Debug mode will always run slowly. This is normal. I've noticed the Microsoft compiler in particular does really slow checks for STL errors.
It runs slowly in the normal mode, too, I just used debug mode to get the actual FPS. It still feels choppy, so I wouldn't doubt it only going 20 FPS.
-
I've noticed during the testing, performance is really bad.
Whether it's the AI testing level (3-10 FPS), 2 lights+floor+kicking around a box, or a particle emitter with high particle count, as soon as something starts happening it is visibly choppy. It is bogged down from 200 FPS to around 20 FPS with hardly anything going on, and I don't see why that could be, it's not like many unnecessary things are being rendered. (the moving platform level has more lights and moving shadows, unless that's different because the fixed movement path allows the shadows to be buffered)
Now my computer is a bit outdated (i7 860 CPU, GTS 450 GPU, 8 GBs of RAM), but it doesn't seem like it should be having this much trouble just from lighting, especially when I can play other games on medium/high graphics with better performance.
I'm not sure if this is a general issue, as I've only tried the Linux version, so it very well could be only an issue on that version of the software.
-
I agree. As a free-and-open format it should be supported by default. Every sound I record is stored as OGG.
-
If this hasn't been worked out yet, what about similar options?
I actually prefer using maximized windows rather than fullscreen, because then I'm less likely to lose track of time. Several games employ alternatives already, such as maximized bordered or maximized borderless windows.
In the case of "Don't Starve" and "Delver" , the game is aware of how much space is available after window decorations and panels, and resizes the context accordingly (maximizing the window removes the borders but leaves the title bar).
In the case of "Eldritch" setting the game to 1920x1080 without enabling full screen gives a borderless window-the game takes up the entire screen but leaves your panel visible. This is..... well, an easier option, as it does not seem to take in account how much space the panel takes up, just displaying behind it. My panel only takes up 20px at least, so you really shouldn't be placing crucial information that close to the edge, anyways.
I'm hoping that a resizable window with fitting context is an easy option. I was happy to see that the maximize button was not disabled on the game test window, but looked around and didn't easily find any easy way to unlock the mouse to try it. I've done it with OpenGL in Java (just basic stuff) so I know it's possible.
All files from .leadwerks in home folder, including user files, gone?
in Linux
Posted
There are no .bak files from Leadwerks anywhere on my system, and I've updated like 2-3 times.
I don't doubt that's the way it's supposed to be, but as I've said, there's no trace of anything I've done in Leadwerks. Even if it was lost some other way, I'd expect the 'recent files' lists in Leadwerks to still show memory of my old files (giving a 'this file cannot be found' spheal). All I'm saying is something happened. Maybe it was some edge case where I was a few minor versions behind, or maybe it's because I'm not on Ubuntu. If other people have this same issue, don't be surprised.