how to increase player's max hp?

Post Reply
User avatar
davidthecreator
Member
Posts: 452
Joined: Mon Aug 18, 2014 19:48
GitHub: daviddoesminetest
In-game: DavidDoesMinetest
Location: Lithuania

how to increase player's max hp?

by davidthecreator » Post

I want the player to have 100hp instead of 20
So how could I increase players maxhp to 100?

User avatar
burli
Member
Posts: 1643
Joined: Fri Apr 10, 2015 13:18

Re: how to increase player's max hp?

by burli » Post

Afaik it is not possible because it is hard coded in the core. But maybe I am wrong. I also would like to change the hp

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

Re: how to increase player's max hp?

by Krock » Post

Yes, it's hardcoded.
https://github.com/minetest/minetest/bl ... ants.h#L91
Problem bypass idea: Use armor to protect you against damage.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
burli
Member
Posts: 1643
Joined: Fri Apr 10, 2015 13:18

Re: how to increase player's max hp?

by burli » Post

Well, than you can modify it in the source code and compile it. But this would only work on your server, so I wouldn't recommend it

User avatar
Wuzzy
Member
Posts: 4803
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: how to increase player's max hp?

by Wuzzy » Post

There is an old feature request for this:
viewtopic.php?f=5&t=10347

Here's an issue on GitHub:
https://github.com/minetest/minetest/issues/2246

For some reason, it is labelled “Low priority”. :-(

User avatar
emperor_genshin
Member
Posts: 83
Joined: Tue Dec 22, 2015 05:04
GitHub: GenshinMT
IRC: Genshin
In-game: Genshin
Location: [REDACTED]
Contact:

Re: how to increase player's max hp?

by emperor_genshin » Post

hmm, there should simply be a way to replace the default health with another type of health system to extend HP (3D-Armors is a good example)...

It's possible to create something like that with the existing minetest modding API, however you may need to add few variables and integrate it together to work with the max health variable if the additional health value reaches less than or equal to the default max HP value.
I'm just a individual who likes to make impressive things. | Current Mod: Dungeon Crawl Maker https://www.youtube.com/watch?v=c6g6H2kLBpg

Chem871
Member
Posts: 999
Joined: Sat Aug 19, 2017 21:49
GitHub: Chemguy99
In-game: Chem Nyx
Location: My Basement's Attic

Re: how to increase player's max hp?

by Chem871 » Post

Someone needs to figure this out, I'd like to have a higher health.
What is SCP-055?

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

Re: how to increase player's max hp?

by Krock » Post

The situation changed. Since this PR was merged, it's possible to use the "hp_max" object property on players. (same with breath, was added later)
As you can see in the date - it requires a 0.5.0-dev build newer than August. Because it is a feature, 0.4.17 (-dev) will not contain that change.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
ratmix
Member
Posts: 149
Joined: Mon May 01, 2017 19:45
In-game: ratmix
Contact:

Re: how to increase player's max hp?

by ratmix » Post

Krock wrote:The situation changed. Since this PR was merged, it's possible to use the "hp_max" object property on players. (same with breath, was added later)
As you can see in the date - it requires a 0.5.0-dev build newer than August. Because it is a feature, 0.4.17 (-dev) will not contain that change.
Using a 5.0.0-dev server and client, I cannot get this to work...

Code: Select all

local max_hp = 50
minetest.register_on_joinplayer(function(player)
		player:set_properties({hp_max = max_hp})
    player:set_hp(max_hp)
	end)
Initially the player has 50HP but is soon damged by 30, returning their HP to the default value of 20. Am I doing something wrong?
King of the Hill :: Modern Warfare Server RATMIX.COM:30000 | King of the Hill Community Site

User avatar
ratmix
Member
Posts: 149
Joined: Mon May 01, 2017 19:45
In-game: ratmix
Contact:

Re: how to increase player's max hp?

by ratmix » Post

Disregard, the hpregen mod was overriding my hp_max. Works now.
King of the Hill :: Modern Warfare Server RATMIX.COM:30000 | King of the Hill Community Site

User avatar
SuperStarSonic
Member
Posts: 160
Joined: Fri Oct 14, 2022 20:30
GitHub: Python-Sargent
In-game: SuperStarSonic
Location: Earth (may be out of date)

Re: how to increase player's max hp?

by SuperStarSonic » Post

ratmix wrote:
Sat Jan 19, 2019 08:15
Disregard, the hpregen mod was overriding my hp_max. Works now.
Is there a way to make the engine display more than 20 hitpoints?

User avatar
Blockhead
Member
Posts: 1684
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: how to increase player's max hp?

by Blockhead » Post

SuperStarSonic wrote:
Fri Jan 19, 2024 16:16
ratmix wrote:
Sat Jan 19, 2019 08:15
Disregard, the hpregen mod was overriding my hp_max. Works now.
Is there a way to make the engine display more than 20 hitpoints?
hudbars mod. You can configure it in the settings menu to show hearts instead of a bar if you want.

Next time, post a new thread instead of replying to a thread that's been dead for years with a question that's only tangentially related.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

Mint
Member
Posts: 11
Joined: Sun Dec 17, 2023 13:27

Re: how to increase player's max hp?

by Mint » Post

The mod HUD bars cannot change max health, I think it's hard coded so I don't know if we can change that value. If I'm wrong please correct me as I'm interested too.

User avatar
Mantar
Member
Posts: 590
Joined: Thu Oct 05, 2017 18:46
Contact:

Re: how to increase player's max hp?

by Mantar » Post

You have to change hp_max in the player's properties first, and then you can set hp to whatever.
Lead dev of Exile, git repo: https://codeberg.org/Mantar/Exile

User avatar
SuperStarSonic
Member
Posts: 160
Joined: Fri Oct 14, 2022 20:30
GitHub: Python-Sargent
In-game: SuperStarSonic
Location: Earth (may be out of date)

Re: how to increase player's max hp?

by SuperStarSonic » Post

I'm sorry but none of this has answered how to make it so changing max health actually changes anything visually when its above 20 HP.

I assume this is hard coded. (Especially from what Mint said)

User avatar
Festus1965
Member
Posts: 4181
Joined: Sun Jan 03, 2016 11:58
GitHub: Festus1965
In-game: Festus1965 Thomas Thailand Explorer
Location: Thailand ChiangMai
Contact:

Re: how to increase player's max hp?

by Festus1965 » Post

SuperStarSonic wrote:
Sat Jan 20, 2024 23:57
I'm sorry but none of this has answered how to make it so changing max health actually changes anything visually when its above 20 HP.
as it was NOT part of the question = yes! there was no need to answer that !
how to increase player's max hp?
And to go further:
you have to find the settings that are now 10 bread ? = 20 hp
that should be somewhere inside
and change this to 10 bread are 50 hp
and also change the formular so that now 1 bread represents 5 hp,
so depending on the hp the 'lever' highlighted is also de- and increasing to this new 10 represents 50 formula.

Have fun
At a fast overlook onto the lua coade I didn't see it, but there are some settings at begin that could have it.
Human has no future (climate change)
If urgend, you find me in Roblox (as CNXThomas)

User avatar
SuperStarSonic
Member
Posts: 160
Joined: Fri Oct 14, 2022 20:30
GitHub: Python-Sargent
In-game: SuperStarSonic
Location: Earth (may be out of date)

Re: how to increase player's max hp?

by SuperStarSonic » Post

Festus1965 wrote:
Sun Jan 21, 2024 01:08
SuperStarSonic wrote:
Sat Jan 20, 2024 23:57
I'm sorry but none of this has answered how to make it so changing max health actually changes anything visually when its above 20 HP.
as it was NOT part of the question = yes! there was no need to answer that !
Not to be rude, but it seems you have not even read my question. Don't just right me off because you don't understand my question.

User avatar
Blockhead
Member
Posts: 1684
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: how to increase player's max hp?

by Blockhead » Post

SuperStarSonic wrote:
Sat Jan 20, 2024 23:57
I'm sorry but none of this has answered how to make it so changing max health actually changes anything visually when its above 20 HP.

I assume this is hard coded. (Especially from what Mint said)
Help us help you. First you need to let us know what game you're on, and what mods you intend to use that will change the player's maximum health. If it's your own game and/or your own mod, that's still valid answer, but please share the code if you can. You also need to let us know if you want specifically to use hearts as the visual indicator of health, or if you are okay with a solid filled bar like hudbars uses. Then we can help you make sure all of that works together.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

User avatar
Festus1965
Member
Posts: 4181
Joined: Sun Jan 03, 2016 11:58
GitHub: Festus1965
In-game: Festus1965 Thomas Thailand Explorer
Location: Thailand ChiangMai
Contact:

Re: how to increase player's max hp?

by Festus1965 » Post

SuperStarSonic wrote:
Sun Jan 21, 2024 01:36
Not to be rude, but it seems you have not even read my question. Don't just right me off because you don't understand my question.
SuperStarSonic wrote:
Fri Jan 19, 2024 16:16
Is there a way to make the engine display more than 20 hitpoints?
hehe, sure there is a problem :
did you mean :
* use that existing 10 hearts ? to show over 50 points = then 1 heart is instead before 1 then 5 health
* or is meant to have instead of 10 hearts now 50 of them ? (= longer or make them smaller ?)

"display more 20 hitpoints" is sure not clear enough - as there are two solutions in my understanding
have fun to specify tour meant solution !
So I didn't understand your written question ! or as I have 2 solutions I am not sure which you want.

* 50 hearts ?
* or using this 10 hearts for 50 hp ?
Last edited by Festus1965 on Sun Jan 21, 2024 10:04, edited 1 time in total.
Human has no future (climate change)
If urgend, you find me in Roblox (as CNXThomas)

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

Re: how to increase player's max hp?

by Krock » Post

SuperStarSonic wrote:
Sat Jan 20, 2024 23:57
how to make it so changing max health actually changes anything visually when its above 20 HP.
Hardcoded to 10 hearts maximum. The statbar HUD type allows steps of 0.5. Max HP = 10 hearts, actual HP are scaled based on that. Relevant code: https://github.com/minetest/minetest/bl ... ua#L31-L37

To overcome this limitation, use minetest.hud_replace_builtin (see lua_api.md for details) with a HUD type that support finer-grained control about the shown value.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
SuperStarSonic
Member
Posts: 160
Joined: Fri Oct 14, 2022 20:30
GitHub: Python-Sargent
In-game: SuperStarSonic
Location: Earth (may be out of date)

Re: how to increase player's max hp?

by SuperStarSonic » Post

Krock wrote:
Sun Jan 21, 2024 08:16
SuperStarSonic wrote:
Sat Jan 20, 2024 23:57
how to make it so changing max health actually changes anything visually when its above 20 HP.
Hardcoded to 10 hearts maximum. The statbar HUD type allows steps of 0.5. Max HP = 10 hearts, actual HP are scaled based on that. Relevant code: https://github.com/minetest/minetest/bl ... ua#L31-L37

To overcome this limitation, use minetest.hud_replace_builtin (see lua_api.md for details) with a HUD type that support finer-grained control about the shown value.
Thank you this answers my question.

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests