• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Stack Runes / Potions

DiegoRulez

Member
Joined
Apr 16, 2012
Messages
93
Reaction score
11
Location
Feira de Santana - Brasil
I'm trying to create a 7.4 server from a downgrade of TFS 1.2.

I would like to know the correct way to prevent runes and potions from being 100x.
I do not want them stacked.

I have already made attempts in .dat and items.otb and I did not succeed.
Any solution?
 
Solution
I'm trying to create a 7.4 server from a downgrade of TFS 1.2.

I would like to know the correct way to prevent runes and potions from being 100x.
I do not want them stacked.

I have already made attempts in .dat and items.otb and I did not succeed.
Any solution?

There are old potions in TFS 1.2, that shouldn't be a trouble, what problem you got with them?

Regarding runes. In spells.cpp search for this tfs1041_oldschool/spells.cpp at master · peonso/tfs1041_oldschool · GitHub and replace with:
Code:
        int32_t newCharge = std::max((int32_t)0, ((int32_t)item->getCharges()) - 1);
        g_game.transformItem(item, item->getID(), newCharge);

You should need the changes at Tibia.dat and items.otb, I hope you succeed...
You also need to add charges on sources. It's a simple change, once I'm home I will post it here (probably only next year), if it took too long tag me here again, since I might forget.
 
You also need to add charges on sources. It's a simple change, once I'm home I will post it here (probably only next year), if it took too long tag me here again, since I might forget.
Peonso, Did you know how to make runes stackables on othire?
 
Peonso, Did you know how to make runes stackables on othire?
It just the inverse process, you make runes stackable (item.otb tibia.dat) and make it to remove count instead of charges(sources). Gonna try to figure something out and post here also.
 
I'm trying to create a 7.4 server from a downgrade of TFS 1.2.

I would like to know the correct way to prevent runes and potions from being 100x.
I do not want them stacked.

I have already made attempts in .dat and items.otb and I did not succeed.
Any solution?

There are old potions in TFS 1.2, that shouldn't be a trouble, what problem you got with them?

Regarding runes. In spells.cpp search for this tfs1041_oldschool/spells.cpp at master · peonso/tfs1041_oldschool · GitHub and replace with:
Code:
        int32_t newCharge = std::max((int32_t)0, ((int32_t)item->getCharges()) - 1);
        g_game.transformItem(item, item->getID(), newCharge);

You should need the changes at Tibia.dat and items.otb, I hope you succeed.

Peonso, Did you know how to make runes stackables on othire?

You also need to change rune items to stackable items with edits to Tibia.dat and items.otb.

At sources find this OTHire/spells.cpp at 9747064479259a392271669263c9b6e2c57131d7 · TwistedScorpio/OTHire · GitHub and change to:
Code:
       int32_t newCount = std::max<int32_t>(0, item->getItemCount() - 1);
        g_game.transformItem(item, item->getID(), newCount);

Maybe you will get some weird item description, you would need to test to see if any other issue comes up.
 
Last edited:
Solution
There are old potions in TFS 1.2, that shouldn't be a trouble, what you problem you got with them?

Regarding runes. In spells.cpp search for this tfs1041_oldschool/spells.cpp at master · peonso/tfs1041_oldschool · GitHub and replace with:
Code:
        int32_t newCharge = std::max((int32_t)0, ((int32_t)item->getCharges()) - 1);
        g_game.transformItem(item, item->getID(), newCharge);

You should need the changes at Tibia.dat and items.otb, I hope you succeed.



You also need to change rune items to stackable items with edits to Tibia.dat and items.otb.

At sources find this OTHire/spells.cpp at 9747064479259a392271669263c9b6e2c57131d7 · TwistedScorpio/OTHire · GitHub and change to:
Code:
       int32_t newCount = std::max<int32_t>(0, item->getItemCount() - 1);
        g_game.transformItem(item, item->getID(), newCount);

Maybe you would get some weird item description, you would need to test to see if any other issue comes up.
thanks, its the beginning,I will test soon, and post the results here, thanks, happpy new year xD
 
@Peonso
Problem solved but lacked visual detail

I changed the source code as you explained. And I unselected the "Stackable" option in items.otb and my result was a 3x rune as configured in spells.xml by me. His appearance was "160x"
So I unselected the "stackable" option in tibia.dat as you explained. The result was a 3x rune, but the appearance is not good.
When looking at item: 17:40 You see a sudden death rune. It can only be used by players with level 45 and magic level 15 or higher.

It does not display "3x" to say that the rune has 3 charges. What I want is not to be able to group them, but the grouping appears when it is cast

And by disabling the "stackable" option in tibia.dat it causes a lot of image bugs for those who use otclient
 
Last edited:
@Peonso
Problem solved but lacked visual detail

I changed the source code as you explained. And I unselected the "Stackable" option in items.otb and my result was a 3x rune as configured in spells.xml by me. His appearance was "160x"
So I unselected the "stackable" option in tibia.dat as you explained. The result was a 3x rune, but the appearance is not good.
When looking at item: 17:40 You see a sudden death rune. It can only be used by players with level 45 and magic level 15 or higher.

It does not display "3x" to say that the rune has 3 charges. What I want is not to be able to group them, but the grouping appears when it is cast

And by disabling the "stackable" option in tibia.dat it causes a lot of image bugs for those who use otclient

Previous created items will probably bug. They will still have the stackable flag. If you create new items they also glitch? You might need to change getDescription function to handle charges as old distributions did OTHire/item.cpp at 9747064479259a392271669263c9b6e2c57131d7 · TwistedScorpio/OTHire · GitHub
 
I know this post is from one year ago, but im trying it now. @Peonso i did the change on source spell.cpp and i have the runes stackables on othire, but the runes are showing the charges, how can I remove this?

like this
16:10 You see 3 explosion runes for magic level 6. It's an "adevo mas hur"-spell (1x).
It weighs 3.60 oz.

i want it to be like this:
16:10 You see 3 explosion runes for magic level 6. It's an "adevo mas hur"-spell.
It weighs 3.60 oz.
 
i added a new items, with sprite on mana fluid, and a new item with sprite on empty vial stackables.
but i dont now how to do the action
to use the mana fluid and get the empty vial and add mana
i dont know how to do the script, i know it simple, but idk how

the manafluid ID is 5998 and the empty vial ID is 6000
if someone can help to create this script, i know any ppl with some knowledge can do this
 
I know this post is from one year ago, but im trying it now. @Peonso i did the change on source spell.cpp and i have the runes stackables on othire, but the runes are showing the charges, how can I remove this?

like this
16:10 You see 3 explosion runes for magic level 6. It's an "adevo mas hur"-spell (1x).
It weighs 3.60 oz.

i want it to be like this:
16:10 You see 3 explosion runes for magic level 6. It's an "adevo mas hur"-spell.
It weighs 3.60 oz.
Lua - Stack Runes / Potions (https://otland.net/threads/stack-runes-potions.256214/#post-2482692)
 
I did this but now NPC's when selling they give the amount of runes asked in a funky matter

Input: buy 3 sd
Output: 1x rune, 2x rune, 3x rune

Input: buy 5 sd
Output: 1x, 2x, 3x, 4, and 5x

Seems has to be with modules.lua on npc/lib
Lua:
isItemRune(itemid)
Any suggestion? I'm using OTHire
 
Last edited:
Back
Top