2 posts • Page 1 of 1
So I hope you read that correctly. Basically, my mob has a feature that makes it get damaged when it falls but I want to to be more concise. I want to calculate how much damage should take place based on the distance of its fall and its weight. I have a default weight value of 155 which should be considered the normal weight of a player for my mod. It can be accessed via self.weight. Weight obviosly means how much the mob weighs. Also if I create gravity based on the players weight how would that be done?
- Posts: 2464
- Joined: Wed Oct 19, 2016 15:18
- GitHub: Andrey2470T
- In-game: Andrey01
- Location: Russia, Moscow
I`d suggest so:
'2' value means to damage a player if he has the velocity along Y is equal to 1.
Code: Select all
local y_vel = player:get_player_velocity().y local player_damage = 2*math.ceil(y_vel) local player_hp = player:get_hp() >= player_damage and player:get_hp()-player_damage or 0 player:set_hp(player_hp, "falling_down")
Users browsing this forum: No registered users and 3 guests