• 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...
I am having a problem where when i purchase runes from npcs
1 = 1
3 = 6
5 = 15?
10 = 55??
its somehow multiplying i dont understand why though.


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


SOLVED COMMENT TYPE RUNE IN ITEMS.XML then manually add description of spell name to rune?

XML:
<item id="2260" article="a" name="blank rune">
        <attribute key="weight" value="120"/>
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adori blank"/>
    </item>
    <item id="2261" article="an" name="destroy field rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adito grav"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2262" article="an" name="energy bomb rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo mas vis"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2263" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2264" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2265" article="an" name="intense healing rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adura gran"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2266" article="an" name="antidote rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adana pox"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2267" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2268" article="an" name="sudden death rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adori vita vis"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2269" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2270" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2271" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2272" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2273" article="an" name="ultimate healing rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adura vita"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2274" article="a" name="big magicwall rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="weight" value="120"/>

    </item>
    <item id="2275" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2276" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2277" article="an" name="energy field rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo grav vis"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2278" article="an" name="paralyze rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adana ani"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2279" article="an" name="energy wall rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo mas grav vis"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2280" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2281" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2282" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2283" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2284" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2285" article="an" name="poison field rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo grav pox"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2286" article="an" name="poison bomb rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo mas pox"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2287" article="an" name="light magic missile rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adori"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2288" article="a" name="stoneshower rune">
        <attribute key="weight" value="120"/>
        <attribute key="runeSpellName" value="adori gran tera"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2289" article="an" name="poison wall rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo mas grav pox"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2290" article="an" name="convince creature rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adeta sio"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2291" article="an" name="chameleon rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo ina"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2292" article="an" name="spell rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo res pox"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2293" article="an" name="magic wall rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo grav tera"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2294" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2295" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2296" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2297" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2298" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2299" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2300" article="an" name="Antibot Checker">
    <attribute key="runeSpellName" value="Auto heal detector."/>
        <attribute key="weight" value="120"/>
    </item>
    <item id="2301" article="an" name="fire field rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo grav flam"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2302" article="an" name="fireball rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adori flam"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2303" article="an" name="fire wall rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo mas grav flam"/>
        <attribute key="weight" value="120"/>
    
    </item>
    <item id="2304" article="an" name="great fireball rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adori gran flam"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2305" article="an" name="firebomb rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo mas flam"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2306" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2307" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2308" article="an" name="soulfire rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo res flam"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2309" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2310" article="an" name="desintegrate rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adito tera"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2311" article="an" name="heavy magic missile rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adori gran"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2312" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2313" article="an" name="explosion rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo mas hur"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2314" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2315" article="a" name="massive energy rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adori gran vis"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2316" article="an" name="animate dead rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adana mort"/>
        <attribute key="weight" value="120"/>

    </item>
 
Last edited:
I am having a problem where when i purchase runes from npcs
1 = 1
3 = 6
5 = 15?
10 = 55??
its somehow multiplying i dont understand why though.





SOLVED COMMENT TYPE RUNE IN ITEMS.XML then manually add description of spell name to rune?

XML:
<item id="2260" article="a" name="blank rune">
        <attribute key="weight" value="120"/>
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adori blank"/>
    </item>
    <item id="2261" article="an" name="destroy field rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adito grav"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2262" article="an" name="energy bomb rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo mas vis"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2263" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2264" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2265" article="an" name="intense healing rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adura gran"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2266" article="an" name="antidote rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adana pox"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2267" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2268" article="an" name="sudden death rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adori vita vis"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2269" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2270" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2271" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2272" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2273" article="an" name="ultimate healing rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adura vita"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2274" article="a" name="big magicwall rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="weight" value="120"/>

    </item>
    <item id="2275" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2276" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2277" article="an" name="energy field rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo grav vis"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2278" article="an" name="paralyze rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adana ani"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2279" article="an" name="energy wall rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo mas grav vis"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2280" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2281" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2282" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2283" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2284" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2285" article="an" name="poison field rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo grav pox"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2286" article="an" name="poison bomb rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo mas pox"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2287" article="an" name="light magic missile rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adori"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2288" article="a" name="stoneshower rune">
        <attribute key="weight" value="120"/>
        <attribute key="runeSpellName" value="adori gran tera"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2289" article="an" name="poison wall rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo mas grav pox"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2290" article="an" name="convince creature rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adeta sio"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2291" article="an" name="chameleon rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo ina"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2292" article="an" name="spell rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo res pox"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2293" article="an" name="magic wall rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo grav tera"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2294" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2295" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2296" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2297" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2298" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2299" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2300" article="an" name="Antibot Checker">
    <attribute key="runeSpellName" value="Auto heal detector."/>
        <attribute key="weight" value="120"/>
    </item>
    <item id="2301" article="an" name="fire field rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo grav flam"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2302" article="an" name="fireball rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adori flam"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2303" article="an" name="fire wall rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo mas grav flam"/>
        <attribute key="weight" value="120"/>
   
    </item>
    <item id="2304" article="an" name="great fireball rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adori gran flam"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2305" article="an" name="firebomb rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo mas flam"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2306" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2307" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2308" article="an" name="soulfire rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo res flam"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2309" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2310" article="an" name="desintegrate rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adito tera"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2311" article="an" name="heavy magic missile rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adori gran"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2312" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2313" article="an" name="explosion rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adevo mas hur"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2314" article="a" name="spell rune">
        <attribute key="weight" value="120"/>
    </item>
    <item id="2315" article="a" name="massive energy rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adori gran vis"/>
        <attribute key="weight" value="120"/>

    </item>
    <item id="2316" article="an" name="animate dead rune">
        <!--attribute key="type" value="rune"/ -->
        <attribute key="runeSpellName" value="adana mort"/>
        <attribute key="weight" value="120"/>

    </item>
thanks bro. i solved my problem xD
 
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 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.
im using sabrehaven tfs 1.2, i changed using code othire and works for me.
Code:
       int32_t newCount = std::max<int32_t>(0, item->getItemCount() - 1);
        g_game.transformItem(item, item->getID(), newCount);
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
1706840548627.png

1706841414825.gif
 
Last edited:
Back
Top