Jump to content
Sign in to follow this  
PACI

Kind of Belt System for r34083

Recommended Posts

Hello.

I made this quest some time ago, I was still using rev 34083 and iMer posted a very useful lib. So, thanks to the quest functions which this lib has included, it allowed me to do something like belt system, but without belt inventory.

Also, nowadays, we have that crap systems full, and that's why I post this here.

Now first of all, iMer's stuff:

libgame_item2_pc2.so

libstdc++.so.6

And now the quest:

 

quest belt_system begin
    state start begin

        function is_belt()
            return item.vnum >= 18000 and item.vnum <= 18089
        end

        function equip_belt()
            item2.equip(11)
            pc.setqf('belt', item.vnum)
        end

        when 18000.use or 18001.use or 18002.use or 18003.use or 18004.use or 18005.use or 18006.use or 18007.use or
        18008.use or 18009.use or 18010.use or 18011.use or 18012.use or 18013.use or 18014.use or 18015.use or 18016.use or
        18017.use or 18018.use or 18019.use or 18020.use or 18021.use or 18022.use or 18023.use or 18024.use or 18025.use or
        18026.use or 18027.use or 18028.use or 18029.use or 18030.use or 18031.use or 18032.use or 18033.use or 18034.use or
        18035.use or 18036.use or 18037.use or 18038.use or 18039.use or 18040.use or 18041.use or 18042.use or 18043.use or
        18044.use or 18045.use or 18046.use or 18047.use or 18048.use or 18049.use or 18050.use or 18051.use or 18052.use or
        18053.use or 18054.use or 18055.use or 18056.use or 18057.use or 18058.use or 18059.use or 18060.use or 18061.use or
        18062.use or 18063.use or 18064.use or 18065.use or 18066.use or 18067.use or 18068.use or 18069.use or 18070.use or
        18071.use or 18072.use or 18073.use or 18074.use or 18075.use or 18076.use or 18077.use or 18078.use or 18079.use or
        18080.use or 18081.use or 18082.use or 18083.use or 18084.use or 18085.use or 18086.use or 18087.use or 18088.use or 18089.use begin
            local v = item.vnum
            local bonus = {{item2.get_attr(0)}, {item2.get_attr(1)}, {item2.get_attr(2)}, {item2.get_attr(3)}, {item2.get_attr(4)}, {item2.get_attr(5)}, {item2.get_attr(6)}}
            if belt_system.is_belt() and v ~= pc.getqf('belt') then
                belt_system.equip_belt()
            elseif item.select_cell(101) then
                item.remove()
                pc2.give_or_drop_item_and_select(v)
                for i = 1, table.getn(bonus) do
                    if tonumber(bonus[i][1]) > 0 then
                        item2.set_attr(i-1, bonus[i][1], bonus[i][2])
                    end
                end
            else
                belt_system.equip_belt()
            end
        end

        when 20090.take with belt_system.is_belt() begin
            local maintab = {
                [0] = {
                    {18000, 1, 50},
                    {18010, 2, 20},
                    {18020, 44, 1},
                    {18030, 44, 1},
                    {18040, 78, 1},
                    {18050, 79, 1},
                    {18060, 80, 1},
                    {18070, 81, 1},
                    {18080, 63, 1}
                },
                [1] = {
                    {18000, 1, 50},
                    {18010, 2, 20},
                    {18020, 44, 1},
                    {18030, 44, 1},
                    {18040, 78, 1},
                    {18050, 79, 1},
                    {18060, 80, 1},
                    {18070, 81, 1},
                    {18080, 63, 1}
                },
                [2] = {
                    {18000, 1, 100},
                    {18010, 2, 40},
                    {18020, 44, 1},
                    {18030, 44, 1},
                    {18040, 78, 1},
                    {18050, 79, 1},
                    {18060, 80, 1},
                    {18070, 81, 1},
                    {18080, 63, 1}
                }
            }
            if pc.count_item(18900) < 1 then
                syschat("You dont have "..item_name(18900)..".")
                return
            end
            for i = 0, 2 do
                for k = 1, table.getn(maintab[i]) do
                    if item.vnum >= maintab[i][k][1] and item.vnum <= maintab[i][k][1]+9 and item2.get_attr(i) == 0 then
                        if number(1,3) == 1 then
                            item2.set_attr(i, maintab[i][k][2], maintab[i][k][3])
                            syschat('Your belt received a bonus.')
                        else
                            syschat('Wasnt possible to put a bonus in your belt.')
                        end
                    end
                end
                pc.remove_item(18900, 1)
            end
        end
    end
end
It also wasn't possible to add the stones to belt's, so I made also a NPC which gives your belt a bonus in exchange for that item.

All we have to do in clientside, is adding a new line on our inventorywindow.py which is localed in locale.

So we search this:

{"index":EQUIPMENT_START_INDEX+10, "x":75, "y":35, "width":32, "height":32},
And we write down the following line:

{"index":EQUIPMENT_START_INDEX+11, "x":39, "y":106, "width":32, "height":32},
We also need equipment_bg_without_ring.tga, or with_ring as you wish. And change the inventory image path to that file.

That's all.

Special thanks to iMer who had written the lib that made this possible, and without cmdchats and affects, because, since the item is equipped into a true slot, the bonuses are defined on item_proto, like a normal weapon, armor, etc.

  • Love 15

Share this post


Link to post

e2bc3771c9.png

If I made it, it's quite obvious.

 

 

Thanks ! Screen ?

  • Love 3

Share this post


Link to post

What type we put to item?

Where we put libs?

 PS:

 

I installed the quest,added  {"index":EQUIPMENT_START_INDEX+11, "x":39, "y":106, "width":32, "height":32},

i coyped the libs to /usr/lib and still dont work

 

type belts is 34

Share this post


Link to post

I have to make a LD just for libgame_item2_pc2.so ?

 

Share this post


Link to post

I have to make a LD just for libgame_item2_pc2.so ?

 

Yes, sorry I posted without finishing what I wanted to say. Check out my last post again.

Share this post


Link to post

I  made the LD and symlinks in channels etc 

 

SYSERR: Aug 27 16:30:05 :: RunState: LUA_ERROR: [string "belt_system"]:1: attempt to index global `item2' (a nil value)
SYSERR: Aug 27 16:30:05 :: WriteRunningStateToSyserr: LUA_ERROR: quest belt_system.start click
 
Edit : It works, the lib shoud have 444 permisions not 777

Share this post


Link to post

It doesn't load the library, you made something wrong.

Share this post


Link to post

It doesn't load the library, you made something wrong.

 

The permisions shoud be 444 not 777 ,so that's why  :)

 

Thank you!

Share this post


Link to post

What type we put to item?

Where we put libs?

 PS:

 

I installed the quest,added  {"index":EQUIPMENT_START_INDEX+11, "x":39, "y":106, "width":32, "height":32},

i coyped the libs to /usr/lib and still dont work

 

type belts is 34

 

you must add it to your start script (first lib)

the scound one add it to lib (it shouldnt be even add installing gcc should be more then enough + some config on /etc/make.conf

Share this post


Link to post
when use with item.get_vnum() >= 18000 and item.get_vnum() <= 18089 begin 

something like this doesn't work ?

and thanks for sharing

 

  • Love 1

Share this post


Link to post

not wearing belts libgame_item2_pc2.so" ./game core dumped :S

Share this post


Link to post

I think you can duplicate the items in your belt system like guild storage system.

 

Share this post


Link to post

Metin2 PT Client -> locale_pt -> item_proto...

Basically, official clients -> locale -> item proto -.-"

Share this post


Link to post

no work!

library OK

quest OK

icons and querys all OK

but when you click in belt no work ..no equip!

and we need client part ...uiinventory etc etc

 

case $chs in 
1*) 
 
echo -e "033[31m iniciando database ..033[0m"
cd /usr/game/db
env LD_32_PRELOAD="/usr/game/share/dblib/db_notxt.so" ./db &
sleep 2
clear
echo -e "033[31m n Auth inditasa ..033[0m"
cd /usr/game/auth 
./auth &
sleep 2
clear
echo -e "033[31m n CH1 iniciando ..033[0m"
cd /usr/game/channel1
env LD_32_PRELOAD="/usr/game/share/gamelib/kickhackfix.so:/usr/game/share/gamelib/libgame_item2_pc2.so" ./game &
sleep 2
clear
echo -e "033[31m n Game99 iniciando ..033[0m"
cd /usr/game/game99
env LD_32_PRELOAD="/usr/game/share/gamelib/kickhackfix.so:/usr/game/share/gamelib/libgame_item2_pc2.so" ./game &
sleep 2
clear
echo -e "033[32m n servidor iniciado! CH1033[0m"
 

Share this post


Link to post
when use with item.get_vnum() >= 18000 and item.get_vnum() <= 18089 begin 

something like this doesn't work ?

and thanks for sharing

 

"when use" doesn't work

it needs a vnum for the item

it's not like "when kill"

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.