Search the Community
Showing results for tags 'damage'.
-
Hi everyone, it might be a stupid question but i just startet working with Leadwerks and LUA. So i am doing the tutorial series available here -> youtube and i have the problem that the player doesn't die when he falls from a high position. Everything else from the tutorial is working but maybe i missed something at the beginning? I remember that something didn't work at the beginning regarding the "name" value of the player. In the tutorial it was just "player" but in my version the value was "FPSPlayer". So i had to rename it to "player" to make the tutorial work on LW 4.5. Perhaps that's the problem? I attached my project and it would be really helpful if someone could have a look at it or just point me into the right direction. tutorial.7z
-
I've been working on a script that's based on an old reepblue script he included in his old lex template. I want it to damage the player as long as he's inside the trigger box, but right now, it just kills him outright, can't get the timer to work I think, what am I doing wrong? Script.enabled=true --bool "Start Enabled" Script.entered = false Script.exited = false Script.hadCollision = false Script.RefireTime = 1.0 -- float "Refire Time" Script.Timer = 0 Script.Tipped=false Script.damage=10--int "Damage" function Script:Start() self.enabled=true end function Script:UpdatePhysics() if self.enabled then if self.entered then if self.hadCollision == false then if self.exited == false then self.component:CallOutputs("onendTouchAll") --System:Print("onendTouchAll") self.Timer = 0 self.Tipped=false self.entered = false end end end self.hadCollision = false end end function Script:Collision(entity, position, normal, speed) if self.enabled then if entity:GetKeyValue("name") == "FPSPlayer" then self.hadCollision = true entity:AddForce(0,0,0) if self.entered == false then self.component:CallOutputs("onstartTouch") --System:Print("onstartTouch") self.entered = true self.exited = false end if not self.Tipped then self:Trigger(entity) end end end end function Script:UpdateWorld() if self.enabled and self.entered then -- A negitive value will disable this. if self.Tipped and self.RefireTime >= 0 then self.Timer = self.Timer + (Time:GetSpeed()/100) if self.Timer > self.RefireTime then self.Timer = 0 end end end end function Script:Trigger(entity) self.component:CallOutputs("OnTriggerTick") --System:Print("OnTriggerTick") -- Hurt the activator! if entity.script then if self.Timer == 0 then if type(entity.script.Hurt)=="function" then entity.script:Hurt(self.damage) end end end end function Script:Enable()--in if self.enabled==false then self.enabled=true end end function Script:Disable()--in if self.enabled then self.enabled=false end end
-
I don't want fall damage in my game, I'm not sure how to get rid of it. Help, please. I still want damage in the game, just not fall damage. Thanks.