Jump to content

Recommended Posts

Hello everyone , i've made a script for soul stones . Each time you run a soul stone it requires you to have 1x Soul stone & 1x Exorcism scroll  
Decide how many soul stones you wanna run and it will loop until it succeds || it runs out of soul stones

 

Spoiler
quest training_grandmaster_skill begin
    state start begin

        when 50513.use begin
            training_grandmaster_skill.open_menu()
        end

        function open_menu()
            if pc.get_skill_group() == 0 then
                say_title("Grand Master Training")
                say("You must first choose a skill group.")
                return
            end

            if pc.get_real_alignment() <= -20000 then
                say_title("Grand Master Training")
                say("Your alignment is too low.")
                say("You cannot train below -20000 karma.")
                return
            end

            local result = training_grandmaster_skill.BuildSkillList(pc.get_job(), pc.get_skill_group())
            local vnum_list = result[1]
            local name_list = result[2]

            if table.getn(vnum_list) == 0 then
                say_title("Grand Master Training")
                say("You have no skills between G1 and P.")
                return
            end

            local menu_list = {}
            table.foreach(name_list, function(i, name) table.insert(menu_list, name) end)
            table.insert(menu_list, "Cancel")

            say_title("Grand Master Training")
            say("Choose the skill you want to train:")
            local s = select_table(menu_list)

            if s == table.getn(menu_list) then return end

            training_grandmaster_skill.train_skill(vnum_list[s])
        end


function train_skill(skill_vnum)
    local skill_name = locale.GM_SKILL_NAME_DICT[skill_vnum] or tostring(skill_vnum)

    say_title("Train "..skill_name)
    say("How many times do you want to train?")
    say_reward("• 1x Soul Stone (50513)")
    say_reward("• 1x Exorcism Scroll (39008 or 71001)")

    local max_train = math.min(pc.count_item(50513), pc.count_item(39008) + pc.count_item(71001))
    if max_train <= 0 then
        say("You do not have enough materials.")
        return
    end

    say("")
    say("You can train up to "..max_train.." times. [Enter the times you wanna train]")
    local count = tonumber(input())

    if count == nil or count < 1 then return end
    if count > max_train then count = max_train end

    local success_total = 0
    local fail_total = 0
    local lost_alignment = 0

    for i = 1, count do

        local lvl = pc.get_skill_level(skill_vnum)
        if lvl >= 40 then   -- P REACHED
            break
        end

        if pc.get_real_alignment() <= -20000 then
            break
        end

        if pc.count_item(50513) < 1 then break end
        pc.remove_item(50513, 1)

        if pc.count_item(39008) > 0 then
            pc.remove_item(39008, 1)
        elseif pc.count_item(71001) > 0 then
            pc.remove_item(71001, 1)
        else
            break
        end

        local chance = number(1, 100)
        if chance <= 30 then
            pc.learn_grand_master_skill(skill_vnum)
            success_total = success_total + 1
        else
            local lose = number(100, 300)
            pc.change_alignment(-lose)
            lost_alignment = lost_alignment + lose
            fail_total = fail_total + 1
        end
    end

    say_title("Training Summary")
    say_reward("Attempts: "..(success_total + fail_total))
    say_reward("Successful: "..success_total)
    say_reward("Failed: "..fail_total)
    say_reward("Alignment lost: "..lost_alignment)

    if pc.get_skill_level(skill_vnum) >= 40 then
        say("")
        say("Your skill reached Perfect (P).")
        say("No more training is required.")
    end

    if pc.get_real_alignment() <= -20000 then
        say("")
        say("Training stopped because your karma reached -20000.")
    end
end



        function BuildSkillList(job, group)
            local G = 30
            local P = 40

            local skill_list = special.active_skill_list[job+1][group]
            local ret_vnum = {}
            local ret_name = {}

            table.foreach(skill_list, function(i, skill_vnum)
                local lvl = pc.get_skill_level(skill_vnum)
                if lvl >= G and lvl < P then
                    table.insert(ret_vnum, skill_vnum)
                    table.insert(ret_name, locale.GM_SKILL_NAME_DICT[skill_vnum] or skill_vnum)
                end
            end)

            return {ret_vnum, ret_name}
        end

    end
end

 

 

Edited by VegaS™
removed ads

spacer.png

Link to comment
https://metin2.dev/topic/34136-repeated-soul-stone-training-quest/
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.