Register for your free account! | Forgot your password?

You last visited: Today at 23:00

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release] - First Item LUA.

Discussion on [Release] - First Item LUA. within the Metin2 PServer Guides & Strategies forum part of the Metin2 Private Server category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Aug 2011
Posts: 17
Received Thanks: 1
[Release] - First Item LUA.

Hi there, i don't know if i should release this here. I am a Lua dev who likes to spend some times to do some coding so here is my first simple release.

This is intended to be a first item quest that simply gives the player a set of first items.

If you want something, ask me

Code:
quest give_basic_equipment begin
    state start begin
        when login with pc.getqf("received_basic_equipment") == 0 begin
            -- Mark that the basic equipment has been received
            pc.setqf("received_basic_equipment", 1)
            
            -- Determine the player's class
            local job = pc.get_job()
            
            -- Assign equipment based on class
            if job == 0 then
                -- Warrior
                pc.give_item2(10, 1)    -- Sword
                pc.give_item2(11200, 1) -- Armor
                pc.give_item2(16000, 1) -- Helmet
                pc.give_item2(14000, 1) -- Shield
                pc.give_item2(15000, 1) -- Bracelets
                pc.give_item2(13000, 1) -- Necklace
                pc.give_item2(12200, 1) -- Boots
                pc.give_item2(17000, 1) -- Ring
            elseif job == 1 then
                -- Ninja
                pc.give_item2(17000, 1) -- Ring
                pc.give_item2(13000, 1) -- Necklace
                pc.give_item2(15000, 1) -- Bracelets
                pc.give_item2(16000, 1) -- Helmet
                pc.give_item2(14000, 1) -- Shield
                pc.give_item2(9002, 1)  -- Throwing weapons
                pc.give_item2(1000, 1)  -- Daggers
            elseif job == 2 then
                -- Sura
                pc.give_item2(17000, 1) -- Ring
                pc.give_item2(13000, 1) -- Necklace
                pc.give_item2(15000, 1) -- Bracelets
                pc.give_item2(16000, 1) -- Helmet
                pc.give_item2(14000, 1) -- Shield
                pc.give_item2(9003, 1)  -- Magic Sword
                pc.give_item2(12480, 1) -- Armor
                pc.give_item2(10, 1)    -- Sword
            elseif job == 3 then
                -- Shaman
                pc.give_item2(17000, 1) -- Ring
                pc.give_item2(13000, 1) -- Necklace
                pc.give_item2(15000, 1) -- Bracelets
                pc.give_item2(16000, 1) -- Helmet
                pc.give_item2(14000, 1) -- Shield
                pc.give_item2(7000, 1)  -- Bell
                pc.give_item2(9004, 1)  -- Fan
                pc.give_item2(12620, 1) -- Armor
            end
            
            -- Send a message to the player
            notice("You have received your basic equipment. Good luck!")
        end
    end
end
agronaque512 is offline  
Thanks
1 User
Old 10/31/2024, 14:06   #2

 
Mr. 'Avenue™'s Avatar
 
elite*gold: 222
The Black Market: 101/0/0
Join Date: Oct 2012
Posts: 2,369
Received Thanks: 3,389
Code:
quest give_basic_equipment begin
    state start begin
        when login with pc.getqf("received_basic_equipment") == 0 begin
            -- Mark that the basic equipment has been received
            pc.setqf("received_basic_equipment", 1)
            
            -- Define equipment per class
            local basic_equipment = {
                [0] = { -- Warrior
                    {10, 1},    -- Sword
                    {11200, 1}, -- Armor
                    {16000, 1}, -- Helmet
                    {14000, 1}, -- Shield
                    {15000, 1}, -- Bracelets
                    {13000, 1}, -- Necklace
                    {12200, 1}, -- Boots
                    {17000, 1}, -- Ring
                },
                [1] = { -- Ninja
                    {1000, 1},  -- Daggers
                    {9002, 1},  -- Throwing weapons
                    {16000, 1}, -- Helmet
                    {14000, 1}, -- Shield
                    {15000, 1}, -- Bracelets
                    {13000, 1}, -- Necklace
                    {17000, 1}, -- Ring
                },
                [2] = { -- Sura
                    {10, 1},    -- Sword
                    {9003, 1},  -- Magic Sword
                    {12480, 1}, -- Armor
                    {16000, 1}, -- Helmet
                    {14000, 1}, -- Shield
                    {15000, 1}, -- Bracelets
                    {13000, 1}, -- Necklace
                    {17000, 1}, -- Ring
                },
                [3] = { -- Shaman
                    {7000, 1},  -- Bell
                    {9004, 1},  -- Fan
                    {12620, 1}, -- Armor
                    {16000, 1}, -- Helmet
                    {14000, 1}, -- Shield
                    {15000, 1}, -- Bracelets
                    {13000, 1}, -- Necklace
                    {17000, 1}, -- Ring
                }
            }
            
            -- Determine the player's class
            local job = pc.get_job()
            local equipment = basic_equipment[job]
            
            -- Give equipment based on class
            if equipment then
                for _, item in ipairs(equipment) do
                    pc.give_item2(item[1], item[2])
                end
            end
            
            -- Send a message to the player
            notice("You have received your basic equipment. Good luck!")
        end
    end
end

much cleaner.
Mr. 'Avenue™ is offline  
Old 11/08/2024, 10:34   #3
 
Webkronix's Avatar
 
elite*gold: 83
Join Date: Apr 2024
Posts: 14
Received Thanks: 4
gibt es bereits viele davon.
Danke trotzdem fürs Release
Webkronix is offline  
Reply


Similar Threads Similar Threads
[Realase]Décripteur de fichier lua ressource 7.3 /Décripteur resource file lua 7.3
04/08/2012 - Rappelz Private Server - 5 Replies
Closed
Sehr weit geführte locale_.lua (locale_big5.lua)
08/02/2010 - Metin2 PServer Guides & Strategies - 50 Replies
Abend^^ Habe hier mal selber eine locale_.lua übersetzt! Ich habe mich von anderen localen inspirieren lassen habe sie aber bis auf 6 Zeilen selber geschrieben!! Ich werde sie, wenn ihr mir sagt welche quests die von zeile 300 - 900 sind, noch vervollständigen aber erstes Ziel... Website mit allen Quests zum Ansehen und einzelnen Download! Hoffe konnte euch weiterhelfen! Locale_.lua + skill_group.quest damit auch die Lehrer deutsch sind! Updatestand: 22.01.2010 Version 1: locale_.lua...



All times are GMT +1. The time now is 23:00.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.