[MOD] Tool ranks [toolranks]
Re: [MOD] Tool ranks [toolranks]
Is there a limit to how many levels a tool can gain?
- lisacvuk
- Member
- Posts: 274
- Joined: Sat Jul 19, 2014 11:52
- GitHub: lisacvuk
- IRC: lisac
- In-game: lisacvuk
- Location: Serbia, Užice
Re: [MOD] Tool ranks [toolranks]
6, at 1600 nodes
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
- azekill_DIABLO
- Member
- Posts: 7507
- Joined: Wed Oct 29, 2014 20:05
- GitHub: azekillDIABLO
- In-game: azekill_DIABLO
- Location: OMICRON
- Contact:
Re: [MOD] Tool ranks [toolranks]
cuz otherwise my pick would have somethin' like: lvl 78...
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!
DMs are always open if you want to get in touch!
- TumeniNodes
- Member
- Posts: 2943
- Joined: Fri Feb 26, 2016 19:49
- GitHub: TumeniNodes
- IRC: tumeninodes
- In-game: TumeniNodes
- Location: in the dark recesses of the mind
- Contact:
-
- Member
- Posts: 195
- Joined: Sun Dec 07, 2014 09:39
- GitHub: auouymous
- IRC: air
- In-game: auouymous
Re: [MOD] Tool ranks [toolranks]
For levels 1-6 that code multiplies wear by 1.0, 0.67, 0.57, 0.5, 0.44, and 0.4. The following code is more balanced and offers more than just 6 levels and 1600 broken nodes to get a max level tool.lisacvuk wrote:I simply brute-forced the above code. No idea how it works, but it seems about right in-game.Code: Select all
wear = digparams.wear / (1 + level / 4)
Code: Select all
toolranks = {
-- these two settings can be tweaked by the server admin
min_bits = 6, -- 64 nodes to get level 1
-- min_bits = 7, -- 128 nodes to get level 1
max_level = 15
}
toolranks.min_nodes = math.pow(2, toolranks.min_bits)
toolranks.max_level_nodes = math.pow(2, toolranks.max_level+toolranks.min_bits-1)
function toolranks.get_level(uses)
if uses < toolranks.min_nodes then return 0 end
if uses >= toolranks.max_level_nodes then return toolranks.max_level end
return 1 + math.log(math.floor(uses / toolranks.min_nodes)) / math.log(2)
end
-- the level>1 check is not needed
local wear = digparams.wear * (1 - (level / toolranks.max_level))
With min_bits=6 a level 15 tool must break 1,048,576 nodes (2,097,152 nodes for min_bits=7). Max level can be decreased to 10 and only require 32,768 or 65,536 nodes. Or it could be increased to 20 and require 33,554,432 or 67,108,864 nodes. Quite flexible.
- lisacvuk
- Member
- Posts: 274
- Joined: Sat Jul 19, 2014 11:52
- GitHub: lisacvuk
- IRC: lisac
- In-game: lisacvuk
- Location: Serbia, Užice
Re: [MOD] Tool ranks [toolranks]
Okay, that seems to have took some effort. Thanks for your input.
There were some previous attempts at more levels on GitHub, but they aren't very much liked by server admins. 6 levels seems to be the best possible amount.
Only thing I might change is the number of nodes needed for levels. It doesn't take long for level 6 right now.
There were some previous attempts at more levels on GitHub, but they aren't very much liked by server admins. 6 levels seems to be the best possible amount.
Only thing I might change is the number of nodes needed for levels. It doesn't take long for level 6 right now.
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
-
- Member
- Posts: 195
- Joined: Sun Dec 07, 2014 09:39
- GitHub: auouymous
- IRC: air
- In-game: auouymous
Re: [MOD] Tool ranks [toolranks]
I haven't looked at the rest of the toolranks code but would it be possible to show something like "next level at N nodes" in the tooltip? It would let the player know if another level exists and how many nodes are needed to reach it.
With bits=7, max=5 and unbreakable=15 you get 6 levels with similar node counts but more balanced wear multipliers. Bumping max_level to 9 adds 4 more levels with level 9 requiring 32768 nodes and giving the same 0.4 wear multiplier your current level 6 gives. Bumping min_bits to 8 would double all the node counts. It allows admins to easily tweak node count and wear multiplier scales, and add more levels. It even has a debug mode to see the values for each level.
The new code below has an additional unbreakable_level setting that can be same as or higher than max_level. It controls the actual scale of the wear multiplier while max_level < unbreakable_level disables unbreakable tools.lisacvuk wrote:There were some previous attempts at more levels on GitHub, but they aren't very much liked by server admins. 6 levels seems to be the best possible amount.
With bits=7, max=5 and unbreakable=15 you get 6 levels with similar node counts but more balanced wear multipliers. Bumping max_level to 9 adds 4 more levels with level 9 requiring 32768 nodes and giving the same 0.4 wear multiplier your current level 6 gives. Bumping min_bits to 8 would double all the node counts. It allows admins to easily tweak node count and wear multiplier scales, and add more levels. It even has a debug mode to see the values for each level.
Code: Select all
lvl nodes wear multiplier
0 0 1
1 128 0.93
2 256 0.87
3 512 0.8
4 1024 0.73
5 2048 0.67 (current level 2 gives this wear)
6 4096 0.6
7 8192 0.53
8 16384 0.47
9 32768 0.4 (current level 6 gives this wear)
Code: Select all
toolranks = {
-- these three settings can be tweaked by the server admin
-- min_bits = 6, -- 64 nodes to get level 1
min_bits = 7, -- 128 nodes to get level 1
-- min_bits = 8, -- 256 nodes to get level 1
max_level = 6,
unbreakable_level = 15,
debug = false -- set to true to view node counts and wear multipliers for each level
}
if toolranks.max_level > toolranks.unbreakable_level then
minetest.log("error", "[toolranks] max_level("..toolranks.max_level..") must be less than or equal to unbreakable_level("..toolranks.unbreakable_level..")")
toolranks.max_level = toolranks.unbreakable_level
end
toolranks.min_nodes = math.pow(2, toolranks.min_bits)
toolranks.max_level_nodes = math.pow(2, toolranks.max_level+toolranks.min_bits-1)
function toolranks.get_level(uses)
if uses < toolranks.min_nodes then return 0 end
if uses >= toolranks.max_level_nodes then return toolranks.max_level end
return 1 + math.log(math.floor(uses / toolranks.min_nodes)) / math.log(2)
end
-- the level>1 check is not needed
local wear = digparams.wear * (1 - (level / toolranks.unbreakable_level))
-- or maybe get rid of debug setting and always display this info, without the error message
if toolranks.debug then
print("[toolranks] DEBUG", toolranks.get_level(0), 0, 1)
for i=1,toolranks.max_level,1 do
local nodes = math.pow(2, i-1+toolranks.min_bits)
-- current wear multiplier
-- local wear = 1 / (1 + (i+1) / 4)
-- new wear multiplier
local wear = 1 - (i / toolranks.unbreakable_level)
print("[toolranks] DEBUG", toolranks.get_level(nodes), nodes, wear)
end
minetest.log("error", "[toolranks] DEBUG enabled")
end
- lisacvuk
- Member
- Posts: 274
- Joined: Sat Jul 19, 2014 11:52
- GitHub: lisacvuk
- IRC: lisac
- In-game: lisacvuk
- Location: Serbia, Užice
Re: [MOD] Tool ranks [toolranks]
First of all, thank you for your interest in my mod, and for the effort of improving it. I know more levels sounds good to multiple players, but I'd like to keep this mod simple. The code looks good and is probably a lot cleaner then mine. I also don't think forum is a good way for developer communication, so I'd appreciate it if you could make a pull request next time.
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
- ToyElf
- Member
- Posts: 13
- Joined: Fri Apr 21, 2017 19:23
- In-game: ToyElf Toy_Elf
- Location: Carboard Box
- Contact:
Re: [MOD] Tool ranks [toolranks]
I run into this error whenever i try to play with this mod. I changed the name of the folder to toolranks, and i DID launch the game, but whenever I broke any node it instantly crashed the game. Any ideas? :(
- Attachments
-
- 000326.png (58.51 KiB) Viewed 1113 times
- kingoscargames
- Member
- Posts: 216
- Joined: Fri Jul 28, 2017 12:06
- GitHub: kingoscargames
- In-game: kingoscargames
- Location: Netherlands
Re: [MOD] Tool ranks [toolranks]
You are using a outdated minetest version so try updating that.
- Napiophelios
- Member
- Posts: 1035
- Joined: Mon Jul 07, 2014 01:14
- GitHub: Napiophelios
- IRC: Nappi
- In-game: Nappi
Re: [MOD] Tool ranks [toolranks]
make a blank file called--> mod.confToyElf wrote:I run into this error whenever i try to play with this mod. I changed the name of the folder to toolranks, and i DID launch the game, but whenever I broke any node it instantly crashed the game. Any ideas? :(
open it with a text editor and write this:
Code: Select all
name = toolranks
inside the mod folder (next to the init.lua file)
and see if it helps
edit: never mind.
why do you have that screen shot if you know that's not the problem?
yeah...what he said :)kingoscargames wrote:You are using a outdated minetest version so try updating that.
- lisacvuk
- Member
- Posts: 274
- Joined: Sat Jul 19, 2014 11:52
- GitHub: lisacvuk
- IRC: lisac
- In-game: lisacvuk
- Location: Serbia, Užice
Re: [MOD] Tool ranks [toolranks]
Rename the mod dir to 'toolranks'ToyElf wrote:I run into this error whenever i try to play with this mod. I changed the name of the folder to toolranks, and i DID launch the game, but whenever I broke any node it instantly crashed the game. Any ideas? :(
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
- kingoscargames
- Member
- Posts: 216
- Joined: Fri Jul 28, 2017 12:06
- GitHub: kingoscargames
- In-game: kingoscargames
- Location: Netherlands
Re: [MOD] Tool ranks [toolranks]
lisacvuk wrote: Rename the mod dir to 'toolranks'
ToyElf wrote:I changed the name of the folder to toolranks,
- the_raven_262
- Member
- Posts: 343
- Joined: Mon Sep 22, 2014 09:30
- GitHub: theraven262
- IRC: [Discord unfortunately] corvus262
Re: [MOD] Tool ranks [toolranks]
You've got outdated minetest, as others already said. It is wise to update at least when a new release is out.ToyElf wrote:I run into this error whenever i try to play with this mod. I changed the name of the folder to toolranks, and i DID launch the game, but whenever I broke any node it instantly crashed the game. Any ideas? :(
- lisacvuk
- Member
- Posts: 274
- Joined: Sat Jul 19, 2014 11:52
- GitHub: lisacvuk
- IRC: lisac
- In-game: lisacvuk
- Location: Serbia, Užice
Re: [MOD] Tool ranks [toolranks]
Kill mekingoscargames wrote:lisacvuk wrote: Rename the mod dir to 'toolranks'ToyElf wrote:I changed the name of the folder to toolranks,
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
- the_raven_262
- Member
- Posts: 343
- Joined: Mon Sep 22, 2014 09:30
- GitHub: theraven262
- IRC: [Discord unfortunately] corvus262
Re: [MOD] Tool ranks [toolranks]
Sure thing.lisacvuk wrote:Kill me
- ToyElf
- Member
- Posts: 13
- Joined: Fri Apr 21, 2017 19:23
- In-game: ToyElf Toy_Elf
- Location: Carboard Box
- Contact:
Re: [MOD] Tool ranks [toolranks]
Yup, updating fixed it, thanks! I didn't even realise i was using an outdated version >_> Cheers guys!
- azekill_DIABLO
- Member
- Posts: 7507
- Joined: Wed Oct 29, 2014 20:05
- GitHub: azekillDIABLO
- In-game: azekill_DIABLO
- Location: OMICRON
- Contact:
Re: [MOD] Tool ranks [toolranks]
will help too! a little bucket of lava?the_raven_262 wrote:Sure thing.lisacvuk wrote:Kill me
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!
DMs are always open if you want to get in touch!
- lisacvuk
- Member
- Posts: 274
- Joined: Sat Jul 19, 2014 11:52
- GitHub: lisacvuk
- IRC: lisac
- In-game: lisacvuk
- Location: Serbia, Užice
Re: [MOD] Tool ranks [toolranks]
azekill_DIABLO wrote:will help too! a little bucket of lava?the_raven_262 wrote:Sure thing.lisacvuk wrote:Kill me
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
- azekill_DIABLO
- Member
- Posts: 7507
- Joined: Wed Oct 29, 2014 20:05
- GitHub: azekillDIABLO
- In-game: azekill_DIABLO
- Location: OMICRON
- Contact:
Re: [MOD] Tool ranks [toolranks]
Cool! Barman? 2 buckets of lava for me and my friend!
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!
DMs are always open if you want to get in touch!
- lisacvuk
- Member
- Posts: 274
- Joined: Sat Jul 19, 2014 11:52
- GitHub: lisacvuk
- IRC: lisac
- In-game: lisacvuk
- Location: Serbia, Užice
Re: [MOD] Tool ranks [toolranks]
I am honored to warrant a custom MS paint artwork, good sir.azekill_DIABLO wrote:Cool! Barman? 2 buckets of lava for me and my friend!
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
- azekill_DIABLO
- Member
- Posts: 7507
- Joined: Wed Oct 29, 2014 20:05
- GitHub: azekillDIABLO
- In-game: azekill_DIABLO
- Location: OMICRON
- Contact:
Re: [MOD] Tool ranks [toolranks]
that not mein work, found it on image sections xD i'm better at drawing (hmm wait no, it would be worst.)
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!
DMs are always open if you want to get in touch!
-
- New member
- Posts: 5
- Joined: Wed Sep 20, 2017 02:04
Re: [MOD] Tool ranks [toolranks]
I had an issue, game said:
Someone can help me?
Code: Select all
/home/einar/.minetest/mods/toolranks/init.lua:30: attempt to concatenate local 'uses' (a nil value)
stack traceback:
/home/einar/.minetest/mods/toolranks/init.lua:30: in function 'create_description'
- lisacvuk
- Member
- Posts: 274
- Joined: Sat Jul 19, 2014 11:52
- GitHub: lisacvuk
- IRC: lisac
- In-game: lisacvuk
- Location: Serbia, Užice
Re: [MOD] Tool ranks [toolranks]
I don't see how could that happen. There is a check to prevent it.einarromero wrote:I had an issue, game said:Someone can help me?Code: Select all
/home/einar/.minetest/mods/toolranks/init.lua:30: attempt to concatenate local 'uses' (a nil value) stack traceback: /home/einar/.minetest/mods/toolranks/init.lua:30: in function 'create_description'
1. What mods have you got enabled?
2. What is your MT version?
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
Who is online
Users browsing this forum: Desour and 23 guests