[SOLVED] get_hp 4.16

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

[SOLVED] get_hp 4.16

by bikerchick » Wed Oct 16, 2019 04:03

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: 5859
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: get_hp 4.16

by rubenwardy » Wed Oct 16, 2019 06:29

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?
 

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

Re: get_hp 4.16

by Krock » Wed Oct 16, 2019 15:56

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 » Wed Oct 16, 2019 16:13

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 » Wed Oct 16, 2019 18:11

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 » Wed Oct 16, 2019 19:59

Solved by reverting back to 0.4.14.
 

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

Re: get_hp 4.16

by rubenwardy » Wed Oct 16, 2019 20:02

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
 

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

Re: [SOLVED] get_hp 4.16

by bikerchick » Wed Oct 16, 2019 22:37

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: 5859
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [SOLVED] get_hp 4.16

by rubenwardy » Wed Oct 16, 2019 22:43

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
 

User avatar
Lone_Wolf
Member
 
Posts: 2193
Joined: Sun Apr 09, 2017 05:50
Location: Hopefully very far from yours, snoop :P
GitHub: LoneWolfHT
IRC: Lone_Wolf
In-game: Lone_Wolf

Re: [SOLVED] get_hp 4.16

by Lone_Wolf » Wed Oct 16, 2019 23:14

@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
 

Sokomine
Member
 
Posts: 3886
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [SOLVED] get_hp 4.16

by Sokomine » Wed Oct 16, 2019 23:59

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.
 


Return to Problems



Who is online

Users browsing this forum: No registered users and 3 guests