GameCrib
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups
    • 🇺🇸 en-US
      • 🇺🇸 English (United States) en-US
      • 🇪🇸 Español es
      • 🇩🇪 Deutsch de
      • 🇮🇹 Italiano (Italia) it
      • 🇵🇱 Polski pl
      • 🇷🇴 Română (România) ro
      • 🇹🇷 Türkçe tr
      • 🇭🇺 Magyar (Hungarian) hu
      • 🇷🇺 Русский ru
    • Register
    • Login

    [Quest] Talent Tree [LUa] - Choose Bonus

    Scheduled Pinned Locked Moved Quests
    1 Posts 1 Posters 1 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • NemberN Nember
      • Posts 12
      • Reputation 0
      • Topics 3
      last edited by

      Summary

      • Upon login, the player receives a letter that sends it to the Guardian.
      • At NPC he can choose one of 3 specializations, different depending on the race: Warrior, Ninja, Sura or Shaman.
      • The specialization is confirmed and permanently saved in quest flags.
      • Depending on the chosen specialization, at each level up they should automatically receive bonus points on certain statistics: VIT (HT), I NT (IQ), ST (ST), DEX (DX).
      • Once the specialization is chosen, it cannot be chosen again. Example: → Barbarian Warrior receives at each level up +2 VIT and +2 STR.

      Code

      quest specialization_intro begin state start begin -- Upon player login when login begin -- Check if the player has already received the letter if pc.getqf("specialization_intro_done") == 0 then -- Send the letter to the player send_letter("Specialization - Talk to the Guardian") end end end end quest specialization_bonus begin state start begin -- Interaction with the NPC to choose specialization when 11000.chat."Choose Specialization" or 11002.chat."Choose Specialization" or 11004.chat."Choose Specialization" begin if pc.getqf("specialization_chosen") == 0 then local job = pc.get_job() local specialization_choices = { [0] = { -- Warrior {"Barbarian", "A brutal warrior with great physical strength. Bonus: Vitality and Strength."}, {"Guardian", "A solid warrior protecting others. Bonus: Vitality and Defense."}, {"Balance", "A warrior who maintains a good balance between strength and defense."} }, [1] = { -- Ninja {"Assassin", "An expert in quick and stealthy attacks. Bonus: Dexterity and Strength."}, {"Shadow Master", "An agile ninja with great precision. Bonus: Dexterity and Precision."}, {"Balance", "A ninja who maintains a good balance between agility and strength."} }, [3] = { -- Shaman {"Earth Shaman", "A shaman who uses earth magic to strengthen vitality. Bonus: Intelligence and Vitality."}, {"Water Shaman", "A shaman who uses water magic to increase mana. Bonus: Intelligence and Mana."}, {"Balance", "A shaman who maintains a good balance between magic and vitality."} }, [2] = { -- Sura {"War Sura", "A powerful sura specialized in physical attacks. Bonus: Strength and Magic."}, {"Magic Sura", "A sura who uses powerful spells to deal damage. Bonus: Strength and Magic."}, {"Balance", "A sura who maintains a good balance between strength and magic."} } } while true do if specialization_choices[job] then local choices = specialization_choices[job] local choice = select(choices[1][1], choices[2][1], choices[3][1], "Return") if choice == 4 then -- If "Return" is chosen, cancel the process say("Choice canceled.") return elseif choice then local selected_choice = choices[choice] local description = selected_choice[2] -- Display the description and ask for confirmation say("You have chosen: " .. selected_choice[1] .. ".") say(description) local confirm = select("Confirm", "Return") if confirm == 1 then -- Save the choice and exit the loop pc.setqf("temp_specialization_choice", choice) pc.setqf("temp_specialization_description", description) break else -- Return to the initial selection say("Returning to the initial choice.") end else say("Choice canceled.") return end else say("You cannot choose a specialization.") return end end -- Confirm the specialization choice if pc.getqf("temp_specialization_choice") then local choice = pc.getqf("temp_specialization_choice") local description = pc.getqf("temp_specialization_description") -- Save the chosen specialization local job = pc.get_job() local specialization_choices = { [0] = { -- Warrior "Barbarian", "Guardian", "Balance" }, [1] = { -- Ninja "Assassin", "Shadow Master", "Balance" }, [3] = { -- Shaman "Earth Shaman", "Water Shaman", "Balance" }, [2] = { -- Sura "War Sura", "Magic Sura", "Balance" } } local selected_specialization = specialization_choices[job][choice] -- Save and confirm the choice pc.setqf("specialization_chosen", 1) pc.setqf("specialization", choice) pc.setqf("specialization_name", selected_specialization) say("You have confirmed your specialization choice: " .. selected_specialization .. ".") say(description) -- Save the chosen specialization to apply the bonuses pc.setqf("specialization_intro_done", 1) pc.setqf("temp_specialization_choice", nil) pc.setqf("temp_specialization_description", nil) end else say("You have already chosen a specialization.") end end end state apply_bonus begin -- Apply bonuses when leveling up when levelup begin if pc.getqf("specialization_chosen") == 1 then local job = pc.get_job() local spec = pc.getqf("specialization") local specialization_bonus = { [0] = { -- Warrior [1] = {ht = 2, st = 2}, -- Barbarian [2] = {ht = 3, st = 1}, -- Guardian [3] = {ht = 1, st = 1, dx = 1} -- Balance }, [1] = { -- Ninja [1] = {dx = 3, st = 1}, -- Assassin [2] = {dx = 2, st = 2}, -- Shadow Master [3] = {dx = 2, st = 1, iq = 1} -- Balance }, [3] = { -- Shaman [1] = {iq = 3, ht = 1}, -- Earth Shaman [2] = {iq = 2, ht = 2}, -- Water Shaman [3] = {iq = 2, ht = 1, dx = 1} -- Balance }, [2] = { -- Sura [1] = {st = 2, iq = 1}, -- War Sura [2] = {st = 1, iq = 2}, -- Magic Sura [3] = {st = 2, iq = 1, dx = 1} -- Balance } } if specialization_bonus[job] and specialization_bonus[job][spec] then -- Apply the bonuses local bonuses = specialization_bonus[job][spec] for stat, value in pairs(bonuses) do if stat == "ht" then pc.set_ht(pc.get_ht() + value) elseif stat == "iq" then pc.set_iq(pc.get_iq() + value) elseif stat == "st" then pc.set_st(pc.get_st() + value) elseif stat == "dx" then pc.set_dx(pc.get_dx() + value) end end end end end end end
      

      Credits: original author SCOOB. Do not remove credits.

      1 Reply Last reply
      Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • First post
        Last post
      gamecrib.dev 1 online / 3 total
      Join us!

      Profile

      ?
      Guest
      User panel Profile Notifications Private messages Saved posts My topics Log out
      • [Quest] Talent Tree [LUa] - Choose Bonus
        NemberN
        Nember
        0
        1
        1

      GameCrib

      Comunidad gaming · foro NodeBB

      Home

      • Categories
      • Recent Topics
      • pages:popular

      GameCrib

      • pages:users
      • Groups
      © GameCrib · Powered by NodeBB · UI inspired by Vasak (MIT)