Jump to content

Einlander

Members
  • Posts

    778
  • Joined

  • Last visited

Everything posted by Einlander

  1. As the topic says, the page is missing from the api documentation list
  2. I was updating a pain trigger and noticed that in the fpsplayer.lua file that the functions: Script:Hurt(damage,distributorOfPain) and Script:TakeDamage(damage) Script:Hurt will lower your health and when dead initiate the death sequence by calling Script:Kill(), BUT it will NOT set the players self.alive to false, call Script:OnHit() or Script:OnDead() Script:TakeDamage will lower your health, set your self.alive to false, call the self:OnHit() and self:OnDead() outputs but will not start the death sequence by calling Script:Kill() Fixed functions: 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 self:OnHit() if self.health<=0 then self.alive = false self:Kill() self:OnDead() end end 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() self:Kill() end end
  3. After some leaps of faith I have come up with a fascinating solution. I used the GetEntityNeighbors.lua file found in the functions folder. I set the entity as itself (i'm using a pivot), with a radius of 0 and false for the scripts parameter. Sadly this will only tell you the outermost object of what you are in. So if you walk in a building in your game, it will return the building entity. Is there a way to return the innermost entity you are in, if you are in one? For you place an entity inside a box, that's inside a safe?
  4. I've been making a AI spawning system and I'm finding that there are situations where the spawn location ends up in another entity. I would like to be able to programmatically detect this and move the spawn location. How would I go about this?
  5. I've been lots of programming, mostly small stuff that when joined together will present the player with a better playing experience. Sadly I don't really have much to actually show currently, but in the coming weeks time provided i should be able to go down my list of to-do's I DO have a video where I show my new test level that can be used as a playground to test all sorts of scripts and game mechanics. I also talk about what next I plan to implement. .
  6. When you place a decal that you want to always be seen, setting the view range does nothing. It always stays in the Near range. I want to put a sign on a wall and I don't want it to disappear.
  7. Do the decals support alphamask channels?
  8. I started with qbasic, whe line numbers and goto's , and gosubs were considered bad practice.
  9. In my game I would like to have flat land with some lakes and pools here and there, but with the current terrain tools its not directly possible. I would need to paint the entire terrain to that height and then make the lakes. I can't zoom out and paint because .1 it gets less accurate and 2. the poly count and culling of the engine. My solution to this would be to either have a set terrain height slider/number box.
  10. Could be related to this? http://www.leadwerks.com/werkspace/topic/10208-initial-move-of-a-texture-locked-prefab-shifts-texture/
  11. The ability to take a entity created by csg and convert it to a mdl file WITH all the surfaces preserved would help accelerate my work in Leadwerks. The obj export collapses all the meshes to 1 object, and the vtf and obj exports do not preserve the textures. With the prefab it is prone to texture shifting and when rotated, depending on the rotate tool used, objects rotate incorrectly. With an mdl export it would be another model entity that I can share with few complications. If implemented, the mdl should not be collapsed. it should preserve the hierarchy and surfaces. Then the user can collapse them later.
  12. It's possible, but as Rick said, you will need to disable the sandbox. I tried it once and it was lots of messy code. I may try it again when I have the time and peace of mind to make it usable for generic stuff. http://www.leadwerks.com/werkspace/blog/120/entry-1182-luajit-awesome-luajit-enet-loaded/
  13. I have 2 of mini-itx pv's 1 intel with windows, 1 amd with linux and a windows 10 hdmi stick pc.
  14. You're going to need more than an overlay for that.
  15. What happens is if windows detects a failure in the graphics card driver (program doing odd things with graphic contexts, application holding on too long to a context and not responding, and millions of other reasons), windows will simply reset the driver itself. Your screens will go dark, your monitors might say they are disconnected and then they will come back. You will get a system notification that looks something like this https://tinkertry.com/display-driver-nvlddmkm-stopped-responding. The amd ones look exactly the same, but it says AMD. Today I haven't had any problems with Leadwerks. That and its a lot cooler today. So I'll be checking the ventilation and the fans on the cards (I don't run with the case one anyway)
  16. With today's beta update i get constant driver resets with my amd gfx card. I can't give much info on whats causing it to crash nor can I record it since it crashes the video recording software too. The fastest way i know to make it crash is to fly around the level in the perspective view. I can get ti to crash withn 5 seconds. Specs: Card: dual R9 270x 3GB CPU : AMD FX- 8350 4.00GHZ Ram: 12GB OS: Windows 7 Pro 64 Driver Version: 15.6 (I had 15.4 where it crashed, 15.6 crashes also) Map that causes the crash.
  17. Scale to .0128 to match the cm grid. It's the same on shade3d for fbx export.
  18. I probably should be doing that anyway. Thanks for the tip! Edit: According to this list http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/collision-r778 props arent suppose to set off triggers. so consider this solved.
  19. Collisions in Leadwerks EXCEPT for character collisions will tend to ignore collision triggers unless swept collision is turned on. If you turn on swept collision, and programatically move the object, all collision types except for character will detect the first trigger, move to the second, fall and then detect that it is in a trigger. Sadly I don't have a map ready to test on. Video
  20. Export the model to fbx format.
  21. The texturing doesn't work right anyway, so we are still setting it by hand. Textures still shift and/or start in the wrong position. So the optimization is moot.
  22. Don't get too mad at that brand of gfx manufacturer. They keep their competition and and developers honest. And we wouldn't have Vulkan as we know it without them.
  23. Open the settings file for leadwerks, search for legacy, and set the option to 1. Start leadwerks, change the settings to meter.
  24. There were some things that were missing from the platform.lua that I have added. It is commented with what I changed. Basically what happened is if you start disabled or disable it in game, The script set the platforms mass to 0. When you enabled it it did not restore the original mass causing it to not move. The fix was to restore the original mass to the entity when enabled AND you have to give it a little push to get it moving again. Script.enabled = true --bool "Enabled" Script.speed = 10 --float "Speed" Script.target = "" --entity "Target waypoint" Script.originPosition = nil Script.targetPosition = nil Script.currentPosition = nil Script.currentRotation = nil Script.moving = nil Script.oldMass = nil function Script:Start() self.originalrotation = self.entity:GetRotation() self.oldMass = self.entity:GetMass() if self.entity:GetShadowMode()>0 then self.entity:SetShadowMode(2)--Light.Dynamic end if self.enabled then if self.entity:GetMass()==0 then Debug:Error("Entity mass must be greater than zero.") end else self.entity:SetMass(0) -- !! BEWARE !! this will cause the platform to not work even if you set self.enabled back to true [FIXED later in code: Einlander] end self.entity:SetGravityMode(false) self.entity:SetCollisionType(Collision.Scene) if self.target == nil then Debug:Error("No target assigned") end self:SetTarget(self.target) end function Script:SetTarget(newTarget) self.currentPosition = self.entity:GetPosition() self.originPosition = self.entity:GetPosition() self.targetPosition = newTarget:GetPosition() --self.distance = self.originPosition:DistanceToPoint(self.targetPosition) self.target = newTarget local pos = self.entity:GetPosition(true) local targetpos = self.target:GetPosition(true) local pin = pos - targetpos self.distance = pin:Length() pin = pin:Normalize() if self.joint then self.joint:DisableMotor() self.joint:Release() end self.joint=Joint:Slider(targetpos.x,targetpos.y,targetpos.z,pin.x,pin.y,pin.z,self.entity,nil) self.joint:EnableMotor() self.joint:SetMotorSpeed(self.speed) self.joint:SetAngle(-self.distance) end function Script:Enable()--in self.enabled = true self.entity:SetMass(self.oldMass) -- this line was missing [einlander] self.entity:AddForce(0,0.001,0) -- give it a tiny push to get it moving [einlander] end function Script:Disable()--in self.enabled = false self.entity:SetMass(0) end function Script:UpdatePhysics() if self.enabled then --Calculate movement local currentpos = self.entity:GetPosition(true) local targetpos = self.target:GetPosition(true) local d = currentpos:DistanceToPoint(targetpos) if d<0.1 then --When the target has been reached --self.entity:PhysicsSetPosition(self.targetPosition.x, self.targetPosition.y, self.targetPosition.z) --self.enabled = false self.component:CallOutputs("WaypointReached") --Check if the target that we have reached also has a target, which is then our new target/waypoint if self.target.script.target ~= nil then self:SetTarget(self.target.script.target) end end else --self.entity:PhysicsSetPosition(self.currentPosition.x, self.currentPosition.y, self.currentPosition.z) --self.entity:PhysicsSetRotation(self.currentRotation.x, self.currentRotation.y, self.currentRotation.z) end end
  25. Does it have mass? And is there a target pivot?
×
×
  • Create New...