[SOLVED] get_hp 4.16

Post Reply
bikerchick
New member
Posts: 5
Joined: Wed Oct 16, 2019 03:58

[SOLVED] get_hp 4.16

by bikerchick » Post

Hey,

I upgraded to 4.16 from 4.14 and am having problems with object:get_hp() in an on_punch event tied to an entity.

If I comment out the second line everything works. So I'm not sure what happened, I don't imagine too much has changed in 4.16?

Thanks for any help,
Madi

Code: Select all

on_punch = function(self, hitter)
                        if self.object:get_hp() <= 0 then
                        ..............
Last edited by bikerchick on Wed Oct 16, 2019 20:00, edited 1 time in total.

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: get_hp 4.16

by rubenwardy » Post

0.4.16 is over 2 years out of date. The latest version is 5.1.0, released a few days ago. I say this because we don't support outdated versions (ie: if this is an engine bug only in 0.4.16, we won't fix it)

Also, when asking for help you should say what it is that isn't working. For example, does it crash or not behave how you expect?
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
Krock
Developer
Posts: 4650
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: get_hp 4.16

by Krock » Post

In future reports (using the most recent stable version), please also include the relevant debug.txt lines to help us tracking down the issue.
https://wiki.minetest.net/Reporting_bugs
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

bikerchick
New member
Posts: 5
Joined: Wed Oct 16, 2019 03:58

Re: get_hp 4.16

by bikerchick » Post

Maybe this is in the wrong board? I'll try again... but I can repost in a different board if necessary.

The mod is a pilzadam framework mod, where a punched mob is supposed to drop an item if hp<=0. However, it seems that hp is not returned. IE. it just skips over till end. There is no output in debug.txt regarding the problem, so therefor there's nothing to debug.

Has no one else had a problem with object:get_hp() in 4.16 or higher?

EDIT---

I'm starting to wonder if the entity is being removed before the on_punch event triggers.... that would explain a few things...

bikerchick
New member
Posts: 5
Joined: Wed Oct 16, 2019 03:58

Re: get_hp 4.16

by bikerchick » Post

Alright, upon further debugging, I have come to find that the entity is indeed removed before the on_punch event.

Log:

Code: Select all

2019-10-16 13:07:48: ACTION[Server]: madi punches object 19: LuaEntitySAO at (4.56142,3.5,-149.451)
on_punch hp= 1
2019-10-16 13:07:48: ACTION[Server]: LuaEntitySAO at (4.56142,3.5,-149.451) punched by player madi, damage 1 hp, health now 0 hp

bikerchick
New member
Posts: 5
Joined: Wed Oct 16, 2019 03:58

Re: get_hp 4.16

by bikerchick » Post

Solved by reverting back to 0.4.14.

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: get_hp 4.16

by rubenwardy » Post

bikerchick wrote:Solved by reverting back to 0.4.14.
Using software 6 versions and 3 years out of date isn't a solution

Also, I can't find a mod called "framework" by PilzAdam.
If you're referring to either Simple Mobs by PilzAdam or Animal Framework by sapier, then you should use Mobs Redo instead - it's actually maintained
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

bikerchick
New member
Posts: 5
Joined: Wed Oct 16, 2019 03:58

Re: [SOLVED] get_hp 4.16

by bikerchick » Post

Yeah thanks for not helping, at all. Next time, if you don't have a clue, just ignore my threads, and leave the replies to someone who might have an idea.

Thanks!

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: [SOLVED] get_hp 4.16

by rubenwardy » Post

You barely gave any relevant information to actually let us help you, and then went with the lazy solution. My first question was about the full nature of the problem, then the second question was after I was trying to find the full code to be able to reproduce it if a simple example didn't.

I work a full time job and invest many hours developing Minetest, writing the modding book, and working on related third-party projects. After spending all that time, receiving that response doesn't really motivate me to look into to the cause of this and see if this still happens on a supported version of Minetest
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
Lone_Wolf
Member
Posts: 2578
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

Re: [SOLVED] get_hp 4.16

by Lone_Wolf » Post

@bikerchick Why are you still using 0.4.14? The latest Minetest (5.1) is a lot better. Not many mods are going to be backwards-compatible with 0.4.x anyway
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

Sokomine
Member
Posts: 4290
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: [SOLVED] get_hp 4.16

by Sokomine » Post

bikerchick wrote: Yeah thanks for not helping, at all. Next time, if you don't have a clue, just ignore my threads, and leave the replies to someone who might have an idea.
But the information that simple_mobs by PilzAdam is no longer maintained and that it might be a good idea to use its successor - mobs_redo - instead is good advice. A lot changed in the meantime; mobs_redo runs fine on servers and supports more features. What prevents you from updating?
A list of my mods can be found here.

wulfsdad
Member
Posts: 45
Joined: Tue Dec 04, 2012 10:38
GitHub: hildigerr

Re: [SOLVED] get_hp 4.16

by wulfsdad » Post

bikerchick wrote:
having problems with object:get_hp() in an on_punch event tied to an entity.
...

Code: Select all

on_punch = function(self, hitter)
                        if self.object:get_hp() <= 0 then
                        ..............
Use on_death instead.

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests