Brothers 24 Report post Posted February 8, 2019 Hello guys, instead of making a NPC where you can buy skills, i want to have a NPC give the character all the skills he could get. Like you go to NPC: Choose Class -> Crus -> You are cruss, with full skills.. I guess there isnt a difficult code for it, but couldnt find it yet. Maybe anyone can help me? - Ivy Quote Share this post Link to post Share on other sites
DangThao 80 Report post Posted February 8, 2019 You can do custom code like the one npc give all skill(class get their skills upon clicking) with a little tweak you can trigger to do like that. Inside the code you should do multiple one and make it check for profession of 1st job. Ex. Swordsman > Crusader Explorer > Voyager and so on.... When they click the one they want, it will setprofession on it and give skill. (not sure if work but this should be one way for it) Quote Share this post Link to post Share on other sites
V3ct0r 2,116 Report post Posted February 9, 2019 Hello @Brothers Add the following code to your functions.lua -- 0 = Newbie -- 1 = Swordsman -- 2 = Hunter -- 3 = Sailor -- 4 = Explorer -- 5 = Herbalist -- 6 = Artisan -- 7 = Merchant -- 8 = Champion -- 9 = Crusader -- 10 = White Knight -- 11 = Animal Tamer -- 12 = Sharpshooter -- 13 = Cleric -- 14 = Seal Master -- 15 = Captain -- 16 = Voyager -- 17 = Upstart -- 18 = Engineer function GiveJobToCha(role, job_id) -- Table -- Race ID => Allowed jobs local job_requirements = { [1] = {1, 2, 4, 9, 12, 16}, -- Lance [2] = {1, 8}, -- Carsise [3] = {2, 4, 5, 12, 13, 14, 16}, -- Phyliss [4] = {4, 5, 13, 14, 16} -- Ami } -- Table -- Job ID => Skills local job_skills = { -- Swordsman [1] = { {id = 66, lv = 10}, -- Concentration Lv10 {id = 62, lv = 10}, -- Sword Mastery Lv10 {id = 222, lv = 10}, -- Break Armor Lv10 {id = 84, lv = 10}, -- Berserk Lv 10 {id = 81, lv = 10} -- Illusion Slash Lv 10 }, -- Crusader [9] = { {id = 66, lv = 10}, -- Concentration Lv10 {id = 62, lv = 10}, -- Sword Mastery Lv10 {id = 222, lv = 10}, -- Break Armor Lv10 {id = 84, lv = 10}, -- Berserk Lv 10 {id = 81, lv = 10}, -- Illusion Slash Lv 10 {id = 109, lv = 10}, -- Dual sword Lv 10 {id = 65, lv = 10}, -- Deftness Lv 10 {id = 70, lv = 10}, -- Blood Frenzy Lv 10 {id = 87, lv = 10}, -- Poison Dart Lv 10 {id = 86, lv = 10}, -- Shadow Slash Lv 10 {id = 123, lv = 10} -- Stealth Lv 10 }, } -- Table -- Job ID => Name local job_name = { [0] = "Newbie", [1] = "Swordsman", [2] = "Hunter", [3] = "Sailor", [4] = "Explorer", [5] = "Herbalist", [6] = "Artisan", [7] = "Merchant", [8] = "Champion", [9] = "Crusader", [10] = "White Knight", [11] = "Animal Timer", [12] = "Sharpshooter", [13] = "Cleric", [14] = "Seal Master", [15] = "Captain", [16] = "Voyager", [17] = "Upstart", [18] = "Engineer" } -- Check given job id if (job_id < 0 or job_id > (table.getn(job_name) - 1)) then SystemNotice(role, "Job ID should be from 0 to 18!") return end -- Check given character descriptor if (role == nil or IsPlayer(role) == 0) then SystemNotice(role, "Wrong role descriptor is given! Should be player character.") return end -- Check job requirements local cha_icon = GetChaTypeID(role) local ok = false for i = 1, table.getn(job_requirements[cha_icon]), 1 do if (job_id == job_requirements[cha_icon][i]) then ok = true break end end if (ok == false) then SystemNotice( role, string.format("The character of your race cannot become %s!", job_name[job_id]) ) return end -- Set job ID SetChaAttrI(role, ATTR_JOB, job_id) -- Add skills if (job_skills[job_id] ~= nil) then for key, value in pairs(job_skills[job_id]) do local skill_lv = GetSkillLv(role, value.id) if (skill_lv < value.lv) then AddChaSkill(role, value.id, value.lv, 1, 0) end end end -- Synchronize the character RefreshCha(role) end Then add script for new NPC in file NPCScript01.lua: -- Class Promotion NPC function PD_ClassNpc() Talk(1, "Hello! Choose your class:") Text(1, "Swordsman", GiveJobToCha, 1) Text(1, "Hunter", GiveJobToCha, 2) Text(1, "Explorer", GiveJobToCha, 4) Text(1, "Herbalist", GiveJobToCha, 5) Text(1, "Champion", GiveJobToCha, 8) Text(1, "Next page --->", JumpPage, 2) Text(1, "Close", CloseTalk) Talk(2, "Hello! Choose your class:") Text(2, "Crusader", GiveJobToCha, 9) Text(2, "Sharpshooter", GiveJobToCha, 12) Text(2, "Cleric", GiveJobToCha, 13) Text(2, "Seal Master", GiveJobToCha, 14) Text(2, "Voyager", GiveJobToCha, 16) Text(2, "<--- Previous page", JumpPage, 1) Text(2, "Close", CloseTalk) end In file NpcSdk.lua add function GiveJobCha() between lines "return SetSpawnPos( character, item.p1 )" and "elseif item.func == TransferDiamond then" in function MsgProc(): elseif item.func == SetSpawnPos then return SetSpawnPos( character, item.p1 ) elseif item.func == GiveJobToCha then return GiveJobToCha( character, item.p1 ) elseif item.func == TransferDiamond then return TransferDiamond( character, item.p1 ) Finally create NPC in file <map>npc.txt with function PD_ClassNpc. All you have to do is fill out the table job_skills following the examples for Swordsman and Crusader classes. It will be great if you then share with us the completed table for all classes. 2 1 Quote Some useful links / Полезные ссылки Tips for making a topic in 'Questions & Help' / Рекомендации по созданию тем в разделе "Помощь" Server Advertising Section Rules / Правила раздела "Реклама серверов" Available e-mail domains for registration / Допустимые e-mail домены для регистрации User groups / Группы пользователей User ranks / Звания пользователей "Broken" pictures on the forum / "Битые" изображения на форуме Beware of scammers! / Осторожно, мошенники! My developments / Мои разработки Mods for client and server / Моды для клиента и сервера PKOdev.NET website for Tales of Pirates Server / PKOdev.NET веб-обвязка для сервера Пиратии I do not provide any help in private messages and outside the forum. Use 'Questions & Help' section please. Thank you for understanding! Я не оказываю какую-либо помощь в личных сообщениях и вне форума. Пожалуйста, используйте раздел "Пиратия: Помощь". Благодарю за понимание! Share this post Link to post Share on other sites
mkhzaleh 131 Report post Posted February 9, 2019 (edited) Helo! this @V3ct0r Function but this will allow u change your class anytime , put this in Function.lua function SkillReset(Player) local Skills = {{0453, 0}, {0454, 0}, {0455, 0}, {0456, 0}, {0457, 0}, {0458, 0}, {0459, 0}, {0256, 0}, {0255,0}, {0467,0} } --this table for skills you won't reset them local Points = 0 for A = 1, table.getn(Skills), 1 do Skills[A][2] = GetSkillLv(Player, Skills[A][1]) Points = Points - Skills[A][2] end Points = Points + GetChaAttr(Player, ATTR_TP) Points = Points + ClearFightSkill(Player) if Points >= 200 then Points = 200 end for B = 1, table.getn(Skills), 1 do if Skills[B][2] ~= 0 then AddChaSkill(Player, Skills[B][1], Skills[B][2], Skills[B][2], 0) end end SetChaAttr(Player, ATTR_TP, Points) RefreshCha(Player) end ------------------ --NPC CLass Promotsion -- 0 = Newbie -- 1 = Swordsman -- 2 = Hunter -- 3 = Sailor -- 4 = Explorer -- 5 = Herbalist -- 6 = Artisan -- 7 = Merchant -- 8 = Champion -- 9 = Crusader -- 10 = White Knight -- 11 = Animal Tamer -- 12 = Sharpshooter -- 13 = Cleric -- 14 = Seal Master -- 15 = Captain -- 16 = Voyager -- 17 = Upstart -- 18 = Engineer function GiveJobToCha(role, job_id) -- Table -- Race ID => Allowed jobs local job_requirements = { [1] = {1, 2, 4, 9, 12, 16}, -- Lance [2] = {1, 8}, -- Carsise [3] = {2, 4, 5, 12, 13, 14, 16}, -- Phyliss [4] = {4, 5, 13, 14, 16} -- Ami } -- Table -- Job ID => Skills local job_skills = { -- Swordsman [1] = { {id = 66, lv = 10}, -- Concentration Lv10 {id = 0222, lv = 10}, -- Break Armor Lv10 {id = 62, lv = 10}, -- Sword Mastery Lv10 {id = 81, lv = 10}, -- Illusion Slash Lv 10 {id = 84, lv = 10}, -- Berserk Lv 10 {id = 0242, lv = 10} -- Taunt Lv 10 }, -- Crusader [9] = { {id = 66, lv = 10}, -- Concentration Lv10 {id = 0222, lv = 10}, -- Break Armor Lv10 {id = 62, lv = 10}, -- Sword Mastery Lv10 {id = 81, lv = 10}, -- Illusion Slash Lv 10 {id = 84, lv = 10}, -- Berserk Lv 10 {id = 109, lv = 10}, -- Dual Sword Mastery Lv 10 {id = 87, lv = 10}, -- Poison Dart Lv 10 {id = 70, lv = 10}, -- Blood Frenzy Lv 10 {id = 123, lv = 10}, -- Stealth Lv 10 {id = 65, lv = 10}, -- Deftness Lv 10 {id = 86, lv = 10}, -- Shadow Slash 10 {id = 0242, lv = 10} -- Taunt Lv 10 }, -- Champion [8] = { {id = 66, lv = 10}, -- Concentration Lv10 {id = 0222, lv = 10}, -- Break Armor Lv10 {id = 62, lv = 10}, -- Sword Mastery Lv10 {id = 81, lv = 10}, -- Illusion Slash Lv 10 {id = 84, lv = 10}, -- Berserk Lv 10 {id = 67, lv = 10}, -- Greatsword Mastery Lv 10 {id = 64, lv = 10}, -- Strengthen Lv 10 {id = 68, lv = 10}, -- Blood Bull Lv 10 {id = 82, lv = 10}, -- Mighty Strike Lv 10 {id = 107, lv = 10}, -- Howl Lv 10 {id = 83, lv = 10}, -- Primal Rage Lv 10 {id = 83, lv = 10}, -- Primal Rage Lv 10 {id = 0243, lv = 10} -- Roar Lv 10 }, -- Explorer [4] = { {id = 210, lv = 10}, -- Diligence Lv10 {id = 211, lv = 10}, -- Current Lv10 {id = 212, lv = 10}, -- Conch Armor Lv10 {id = 213, lv = 10}, -- Tornado Lv 10 {id = 214, lv = 10}, -- Lightning Bolt Lv 10 {id = 215, lv = 10}, -- Algae Entanglement Lv 10 -- Land skill {id = 0473, lv = 10} -- Algae Entanglement Lv 10 -- sea skill }, -- Voyager [16] = { {id = 210, lv = 10}, -- Diligence Lv10 {id = 211, lv = 10}, -- Current Lv10 {id = 212, lv = 10}, -- Conch Armor Lv10 {id = 213, lv = 10}, -- Tornado Lv 10 {id = 214, lv = 10}, -- Lightning Bolt Lv 10 {id = 215, lv = 10}, -- Algae Entanglement Lv 10 -- Land skill {id = 216, lv = 10}, -- Conch Ray Lv 10 {id = 220, lv = 10}, -- Lightning Curtain Lv 10 --Sea Skill {id = 0474, lv = 10}, -- Lightning Curtain Lv 10 --Land Skill {id = 217, lv = 10}, -- Tail Wind Lv 10 {id = 219, lv = 10}, -- Fog Lv 10 {id = 218, lv = 10}, -- Whirlpool Lv 10 {id = 0473, lv = 10} -- Algae Entanglement Lv 10 -- sea skill }, -- Herbalist [5] = { {id = 79, lv = 10}, -- Vigor Lv10 {id = 97, lv = 10}, -- Heal Lv10 {id = 99, lv = 10}, -- Spiritual Bolt Lv10 {id = 100, lv = 10}, -- Spiritual Fire Lv 10 {id = 101, lv = 10}, -- Tempest Boost Lv 10 {id = 225, lv = 10}, -- Harden Lv 10 {id = 124, lv = 10}, -- Revival Lv 10 {id = 98, lv = 10} -- Recover Lv 10 }, -- Cleric [13] = { {id = 79, lv = 10}, -- Vigor Lv10 {id = 97, lv = 10}, -- Heal Lv10 {id = 99, lv = 10}, -- Spiritual Bolt Lv10 {id = 100, lv = 10}, -- Spiritual Fire Lv 10 {id = 101, lv = 10}, -- Tempest Boost Lv 10 {id = 225, lv = 10}, -- Harden Lv 10 {id = 124, lv = 10}, -- Revival Lv 10 {id = 106, lv = 10}, -- Energy Shield Lv 10 {id = 102, lv = 10}, -- Tornado Swirl Lv 10 {id = 103, lv = 10}, -- Angelic Shield Lv 10 {id = 122, lv = 10}, -- Healing Spring Lv 10 {id = 80, lv = 10}, -- Divine Grace Lv 10 {id = 116, lv = 10}, -- True Sight Lv 10 {id = 98, lv = 10} -- Recover Lv 10 }, -- Seal Master [14] = { {id = 79, lv = 10}, -- Vigor Lv10 {id = 97, lv = 10}, -- Heal Lv10 {id = 99, lv = 10}, -- Spiritual Bolt Lv10 {id = 100, lv = 10}, -- Spiritual Fire Lv 10 {id = 101, lv = 10}, -- Tempest Boost Lv 10 {id = 225, lv = 10}, -- Harden Lv 10 {id = 124, lv = 10}, -- Revival Lv 10 {id = 119, lv = 10}, -- Cursed Fire Lv 10 {id = 121, lv = 10}, -- Abyss Mire Lv 10 {id = 105, lv = 10}, -- Shadow Insignia Lv 10 {id = 104, lv = 10}, -- Seal of Elder Lv 10 {id = 80, lv = 10}, -- Divine Grace Lv 10 {id = 116, lv = 10}, -- True Sight Lv 10 {id = 98, lv = 10} -- Recover Lv 10 }, -- Hunter [2] = { {id = 74, lv = 10}, -- Range Mastery Lv10 {id = 75, lv = 10}, -- Wind Walk Lv10 {id = 90, lv = 10}, -- Dual Shot Lv10 {id = 223, lv = 10}, -- Rousing Lv 10 {id = 93, lv = 10}, -- Frozen Arrow Lv 10 {id = 224, lv = 10}, -- Venom Arrow Lv 10 {id = 112, lv = 10} -- Meteor Shower Lv 10 }, -- Sharpshooter [12] = { {id = 74, lv = 10}, -- Range Mastery Lv10 {id = 75, lv = 10}, -- Wind Walk Lv10 {id = 90, lv = 10}, -- Dual Shot Lv10 {id = 223, lv = 10}, -- Rousing Lv 10 {id = 93, lv = 10}, -- Frozen Arrow Lv 10 {id = 224, lv = 10}, -- Venom Arrow Lv 10 {id = 78, lv = 10}, -- Firegun Mastery Lv 10 {id = 94, lv = 10}, -- Cripple Lv 10 {id = 95, lv = 10}, -- Enfeeble Lv 10 {id = 96, lv = 10}, -- Headshot Lv 10 {id = 113, lv = 10}, -- Magma Bullet Lv 10 {id = 112, lv = 10} -- Meteor Shower Lv 10 }, } -- Table -- Job ID => Name local job_name = { [0] = "Newbie", [1] = "Swordsman", [2] = "Hunter", [3] = "Sailor", [4] = "Explorer", [5] = "Herbalist", [6] = "Artisan", [7] = "Merchant", [8] = "Champion", [9] = "Crusader", [10] = "White Knight", [11] = "Animal Timer", [12] = "Sharpshooter", [13] = "Cleric", [14] = "Seal Master", [15] = "Captain", [16] = "Voyager", [17] = "Upstart", [18] = "Engineer" } -- Check given job id if (job_id < 0 or job_id > (table.getn(job_name) - 1)) then SystemNotice(role, "Job ID should be from 0 to 18!") return end -- Check given character descriptor if (role == nil or IsPlayer(role) == 0) then SystemNotice(role, "Wrong role descriptor is given! Should be player character.") return end -- Check job requirements local cha_icon = GetChaTypeID(role) local ok = false for i = 1, table.getn(job_requirements[cha_icon]), 1 do if (job_id == job_requirements[cha_icon][i]) then ok = true break end end if (ok == false) then SystemNotice( role, string.format("The character of your race cannot become %s!", job_name[job_id]) ) return end if job_id > 0 then SkillReset(role) --remove all old skills -- Set job ID SetChaAttrI(role, ATTR_JOB, job_id) -----move player in his place to remove any extra max-- local x, y = GetChaPos(role) x = math.floor(x / 100) y = math.floor(y / 100) local GoTo01M = GetChaMapName(role) GoTo(role, x, y, GoTo01M) -- Add skills if (job_skills[job_id] ~= nil) then for key, value in pairs(job_skills[job_id]) do local skill_lv = GetSkillLv(role, value.id) if (skill_lv < value.lv) then AddChaSkill(role, value.id, value.lv, 1, 0) end end end end -- Synchronize the character RefreshCha(role) end Edited February 9, 2019 by mkhzaleh 2 Quote Share this post Link to post Share on other sites
Brothers 24 Report post Posted February 9, 2019 @V3ct0r & @mkhzaleh Wow, this is just what i needed! Thanks both! And @V3ct0r, i guess mkhzaleh has put in all the skills allready =) - Ivy 1 1 Quote Share this post Link to post Share on other sites
Brothers 24 Report post Posted February 11, 2019 (edited) The only "bug" this add has, is that you are able to change class, even when you wear items. Like you are crus, wear dual swords.. Change class to Voy, and you still wear Swords. But i really enjoy it :) Edited February 11, 2019 by Brothers Quote Share this post Link to post Share on other sites
mkhzaleh 131 Report post Posted February 11, 2019 9 hours ago, Brothers said: The only "bug" this add has, is that you are able to change class, even when you wear items. Like you are crus, wear dual swords.. Change class to Voy, and you still wear Swords. But i really enjoy it :) ------check if player using any equipment ------- if IsEquip(role) == LUA_TRUE then SystemNotice(role, "You must remove your equipment!") return end ------------------ put this inside the function "GiveJobToCha" 1 1 Quote Share this post Link to post Share on other sites
V3ct0r 2,116 Report post Posted February 12, 2019 Hello, @Brothers! This is not a bug, I made the NPC, taking into consideration the fact that players can not change the profession after receiving it. You can add a simple check to the script, as @mkhzaleh suggests 1 1 Quote Some useful links / Полезные ссылки Tips for making a topic in 'Questions & Help' / Рекомендации по созданию тем в разделе "Помощь" Server Advertising Section Rules / Правила раздела "Реклама серверов" Available e-mail domains for registration / Допустимые e-mail домены для регистрации User groups / Группы пользователей User ranks / Звания пользователей "Broken" pictures on the forum / "Битые" изображения на форуме Beware of scammers! / Осторожно, мошенники! My developments / Мои разработки Mods for client and server / Моды для клиента и сервера PKOdev.NET website for Tales of Pirates Server / PKOdev.NET веб-обвязка для сервера Пиратии I do not provide any help in private messages and outside the forum. Use 'Questions & Help' section please. Thank you for understanding! Я не оказываю какую-либо помощь в личных сообщениях и вне форума. Пожалуйста, используйте раздел "Пиратия: Помощь". Благодарю за понимание! Share this post Link to post Share on other sites
Brothers 24 Report post Posted February 12, 2019 Again guys, you both are amazing, i hope u both do know =) As a reflection to you both, you speak in an easy language, not just a few short words and difficult words, but clear! You guys make forums like this great! Thanks alot, - Ivy 2 Quote Share this post Link to post Share on other sites
Brothers 24 Report post Posted February 22, 2019 Hello guys, heres your favorite spammer again. I was wondering, i want people to do a quest before getting promotion. Is it possible i can put a HaveItem TakeItem into this, what will look like: Talk(1, "Hello! Choose your class:") Text(1, "Swordsman", GiveJobToCha, 1) TriggerCondition( 1, HasItem, 68, 1 ) TriggerAction( 1, TakeItem, 68,1 ) ?? Hope you guys still like to help =) Quote Share this post Link to post Share on other sites
mkhzaleh 131 Report post Posted February 22, 2019 (edited) 57 minutes ago, Brothers said: Hello guys, heres your favorite spammer again. I was wondering, i want people to do a quest before getting promotion. Is it possible i can put a HaveItem TakeItem into this, what will look like: Talk(1, "Hello! Choose your class:") Text(1, "Swordsman", GiveJobToCha, 1) TriggerCondition( 1, HasItem, 68, 1 ) TriggerAction( 1, TakeItem, 68,1 ) ?? Hope you guys still like to help =) yes you can use like this GiveJobToCha Text(1, "[Champion]", MultiTrigger, GetMultiTrigger(), 1) InitTrigger() TriggerCondition(1, HasItem, 3457, 1) TriggerAction(1, TakeItem, 3457, 1) TriggerAction(1, GiveJobToCha, 8) TriggerFailure(1, JumpPage, 3) Text(1, "[Crusader]", MultiTrigger, GetMultiTrigger(), 1) InitTrigger() TriggerCondition(1, HasItem, 3458, 1) TriggerAction(1, TakeItem, 3458, 1) TriggerAction(1, GiveJobToCha, 9) TriggerFailure(1, JumpPage, 3) or can add a function inside function.lua GiveJobToCha if CheckBagItem(role,68) >= 1 then TakeItem(role, 0, 68, 1) else SystemNotice(role, "You must have >>x item namex<<!") return end Edited February 22, 2019 by mkhzaleh 1 Quote Share this post Link to post Share on other sites
Brothers 24 Report post Posted February 22, 2019 You are my hero! Thanks :) i rather choose the last option, have a nice weekend :) 1 Quote Share this post Link to post Share on other sites
mkhzaleh 131 Report post Posted February 23, 2019 9 hours ago, Brothers said: You are my hero! Thanks :) i rather choose the last option, have a nice weekend :) you too :) 1 Quote Share this post Link to post Share on other sites
Brothers 24 Report post Posted March 13, 2019 Hello @mkhzaleh, its kinda strange, but just found out some skills wont be added, like my crus wont have stealth after all skills.. May know a sollution? Quote Share this post Link to post Share on other sites
mkhzaleh 131 Report post Posted March 13, 2019 34 minutes ago, Brothers said: Hello @mkhzaleh, its kinda strange, but just found out some skills wont be added, like my crus wont have stealth after all skills.. May know a sollution? edit the skills ids same as your skillinfo Quote Share this post Link to post Share on other sites
Brothers 24 Report post Posted September 26, 2022 (edited) You can throw away this reaction. I found an error, but its gone Edited September 26, 2022 by Brothers You can throw away this reaction. I found an error, but its gone Quote Share this post Link to post Share on other sites
Brothers 24 Report post Posted October 5, 2022 @mkhzaleh @V3ct0r Hey guys, Do you also think its avaible when someone choose his first rebirth, choosing class and earn fully skills? Quote Share this post Link to post Share on other sites
AlGhoul 66 Report post Posted October 6, 2022 21 hours ago, Brothers said: @mkhzaleh @V3ct0r Hey guys, Do you also think its avaible when someone choose his first rebirth, choosing class and earn fully skills? Of course it is, there's no limit. If you need some help regarding this, post your Reb NPC function. 1 Quote Kind regards, AG. Share this post Link to post Share on other sites