Jump to content
JonesGaming

I don't get fall damage

Recommended Posts

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

Share this post


Link to post

It is really great to see that people are still making use of these tutorials, even though they are a bit outdated.

The problem lies in the Collision function. Th 4th parameter is speed. When you print out the value to the screen you will see that it is 0 and therefor not afflicting damage to the player.

function Script:Collision(entity,position,normal,speed)
    System:Print("speed:" ..speed)
    if speed>20 and entity:GetKeyValue("name") ~= "DeathTrigger" then
        self:Hurt(100)
    end
end

Obiously the speed value should not be 0. This does seem like a bug imo. Maybe something that slipped in with 4.5. I tried the same map with the beta version and the problem persists. This can be a good bug report.

Share this post


Link to post

Ah ok! I was already wondering why the color of the parameter for speed is sometimes colored black while the others are blue inside the code editor.

Share this post


Link to post

This might be because I remember switching the order in which raycasts and collisions are done in the character physics...I will take a look.

Share this post


Link to post

Okay, this is fixed and will be in a new build on the beta branch shortly.

Share this post


Link to post
Guest
This topic is now closed to further replies.
×
×
  • Create New...