Denis 1477 Posted March 1, 2014 Share Posted March 1, 2014 M2 Download Center This is the hidden content, please Sign In or Sign Up ( Internal ) I know it's nothing hard/special but for somebody it maybe be usefull Lib: Spoiler Hunting_Quest = Hunting_Quest or {} Hunting_Quest.say_title_ = { "Hunting Mission - Level ", } Hunting_Quest.mobs = {101, 102, 103} Hunting_Quest.information = { {"Your quest is to 50 kill "..mob_name(npc.get_race()),"Your reward will be: [COLOR r;"..(255/255.0).."|g;"..(0/255.0).."|b;"..(0/255.0).."]"..item_name(19)..", "..item_name(19).."[/COLOR]"}, } Hunting_Quest.price_list = { [1] = {{19, 1}, {19, 1}}, [2] = {{19, 1}, {19, 1}}, [3] = {{19, 1}, {19, 1}}, } function Hunting_Quest.count(mob) local getf_list = { [101] = {"Quest_Hunting1", "mission1"} [102] = {"Quest_Hunting2", "mission1"} [103] = {"Quest_Hunting3", "mission1"} } return pc.getf(getf_list[mob][1], getf_list[mob][2]) end function Hunting_Quest.change_count(mob) local getf_list = { [101] = {"Quest_Hunting1", "mission1"}, [102] = {"Quest_Hunting2", "mission2"}, [103] = {"Quest_Hunting3", "mission3"}, } pc.setf(getf_list[mob][1], getf_list[mob][2], Hunting_Quest.count(mob)+1) end function Hunting_Quest.set_finish(quest_id) local state_numb = { [1] = {"Quest_Hunting1", "mission1"}, [2] = {"Quest_Hunting2", "mission2"}, [3] = {"Quest_Hunting3", "mission3"}, } pc.setf(state_numb[quest_id][1], state_numb[quest_id][2], 1) for a = 1, table.getn(Hunting_Quest.price_list[quest_id]) do pc.give_item2(Hunting_Quest.price_list[quest_id][a][1], Hunting_Quest.price_list[quest_id][a][2]) end end function Hunting_Quest.is_available(quest_id) local getf_list = { [1] = {"Quest_Hunting1", "mission1"}, [2] = {"Quest_Hunting2", "mission2"}, [3] = {"Quest_Hunting3", "mission3"}, } if pc.getf(getf_list[quest_id][1], getf_list[quest_id][2]) == 0 then return true else return false end end function Hunting_Quest.send_letter(quest_id) local letter_list = { [1] = "Hunting Quest Lv. 5", [2] = "Hunting Quest Lv. 10", [3] = "Hunting Quest Lv. 15", } send_letter(letter_list[quest_id]) end function Hunting_Quest.get_mission_level(quest_id) local missions = { [1] = {"5"} [2] = {"10"} [3] = {"15"} } return missions[quest_id][1] end Quest: quest test_quest begin state start begin when login or levelup with pc.get_level() == 5 and Hunting_Quest.is_available(1) begin Hunting_Quest.send_letter(1) end when button or info begin say_title(Hunting_Quest.say_title_[1]..Hunting_Quest.get_mission_level(1)) say() for a = 1, table.getn(Hunting_Quest.information[1]) do say(Hunting_Quest.information[1][a]) end select("Accept the Mission!") end when kill with npc.get_race() == (tonumber(Hunting_Quest.mobs[1])) and Hunting_Quest.is_available(1) begin if Hunting_Quest.count(npc.get_race()) >= 50 then Hunting_Quest.set_finish(1) else chat("Remains: "..(50-Hunting_Quest.count(npc.get_race())).." "..mob_name(npc.get_race())) Hunting_Quest.change_count(npc.get_race()) end end end end Quest Functions: Hunting_Quest.say_title_ Hunting_Quest.mobs Hunting_Quest.price_list Hunting_Quest.count Hunting_Quest.change_count Hunting_Quest.set_finish Hunting_Quest.is_available Hunting_Quest.send_letter Hunting_Quest.get_mission_level Update: I decide to make this quest much easier for me and the others so I make one table with all data.I didn't have time to test it,if anyone can test it tell me if there are some errors. Lib: Spoiler function reward(text) return "Your reward will be: [COLOR r;"..(255/255.0).."|g;"..(0/255.0).."|b;"..(0/255.0).."]"..text.."[/COLOR]" end function Hunting_Quest() local table = { [5] = { [101] = { ["level"] = {(pc.get_level() == 5 and true or false)}, ["is_available"] = {(pc.getf("Quest_Hunting1","mission1") == 0 and true or false)}, ["letter"] = {"Mission Wild Dog"}, ["title"] = {"Hunting Mission - Level 5"}, ["information"] = {{"Your quest is to kill 50 "..mob_name(101),reward(item_name(19).." , "..item_name(29))}}, [101] = {101}, ["count"] = {pc.getf("Quest_Hunting1", "mission1")}, ["set_finish"] = {pc.setf("Quest_Hunting1", "mission1", 1)}, ["reward"] = {{19,1},{29,1}}, ["total_count"] = {50}, ["change_count"] = {pc.setf("Quest_Hunting1", "mission1", pc.getf("Quest_Hunting1", "mission1")+1)}, }, [102] = { ["level"] = {(pc.get_level() == 5 and true or false)}, ["is_available"] = {(pc.getf("Quest_Hunting2","mission2") == 0 and true or false)}, ["letter"] = {"Mission 2"}, ["title"] = {"Hunting Mission - Level 5"}, ["information"] = {{"Your quest is to kill 50 "..mob_name(102),reward(item_name(39).." , "..item_name(49))}}, [102] = {102}, ["count"] = {pc.getf("Quest_Hunting2", "mission2")}, ["set_finish"] = {pc.setf("Quest_Hunting2", "mission2", 1)}, ["reward"] = {{39,1},{49,1}}, ["total_count"] = {10}, ["change_count"] = {pc.setf("Quest_Hunting2", "mission2", pc.getf("Quest_Hunting2", "mission2")+1)}, }, }, [30] = { [105] = { ["level"] = {(pc.get_level() == 30 and true or false)}, ["is_available"] = {(pc.getf("Quest_Hunting3","mission3") == 0 and true or false)}, ["letter"] = {"30 level mission"}, ["title"] = {"Hunting Mission - Level 30"}, ["information"] = {{"Your quest is to kill 50 "..mob_name(105),reward(item_name(299).." , "..item_name(11259))}}, [105] = {105}, ["count"] = {pc.getf("Quest_Hunting3", "mission3")}, ["set_finish"] = {pc.setf("Quest_Hunting3", "mission3", 1)}, ["reward"] = {{299,1},{11259,1}}, ["total_count"] = {100}, ["change_count"] = {pc.setf("Quest_Hunting3", "mission3", pc.getf("Quest_Hunting3", "mission3")+1)}, }, }, } return table end Quest: quest test_quest begin state start begin when login or levelup with Hunting_Quest()[pc.get_level()][101]["level"][1] and Hunting_Quest()[pc.get_level()][101]["is_available"][1] begin Hunting_Quest()[pc.get_level()][101]["letter"][1] end when button or info begin say_title(Hunting_Quest()[pc.get_level()][101]["title"][1]) say() for a = 1, table.getn(Hunting_Quest()[pc.get_level()][101]["information"][1]) do say(Hunting_Quest()[pc.get_level()][101]["information"][1][a]) end select("Accept the Mission!") end when kill with npc.get_race() == (tonumber(Hunting_Quest()[pc.get_level()][101][npc.get_race()])) and Hunting_Quest()[pc.get_level()][101]["is_available"][1] begin if Hunting_Quest()[pc.get_level()][101]["count"][1] >= 50 then Hunting_Quest()[pc.get_level()][101]["set_finish"][1] for a = 1, table.getn(Hunting_Quest()[pc.get_level()][101]["reward"]) do pc.give_item2(Hunting_Quest()[pc.get_level()][101]["reward"][a][1], Hunting_Quest()[pc.get_level()][101]["reward"][a][2]) end else chat("Remains: "..(50-Hunting_Quest()[pc.get_level()][101]["count"][1]).." "..mob_name(npc.get_race())) Hunting_Quest()[pc.get_level()][101]["change_count"][1] end end end end Quest Function: Hunting_Quest reward For any questions feel free to ask! Regards. 7 5 2 15 Link to comment Share on other sites More sharing options...
Premium Shogun 4613 Posted March 4, 2014 Premium Share Posted March 4, 2014 About the lib: I think you could improve this code to have a single table which would making it easier to setup. At this moment you have several tables which have similar data. Link to comment Share on other sites More sharing options...
Former Staff .InyaProduction 1138 Posted March 4, 2014 Former Staff Share Posted March 4, 2014 Its a short quest now but a hard to understand quest lib Link to comment Share on other sites More sharing options...
Denis 1477 Posted March 4, 2014 Author Share Posted March 4, 2014 About the lib: I think you could improve this code to have a single table which would making it easier to setup. At this moment you have several tables which have similar data. I will try it. @.InyaProduction: If you run the quest I think you will understand it 1 Link to comment Share on other sites More sharing options...
Former Staff .InyaProduction 1138 Posted March 4, 2014 Former Staff Share Posted March 4, 2014 I understand the lib dont worry. But beginners wont Link to comment Share on other sites More sharing options...
Remix 45 Posted March 4, 2014 Share Posted March 4, 2014 About the lib: I think you could improve this code to have a single table which would making it easier to setup. At this moment you have several tables which have similar data. You could put everything in a single table. It would be easier Link to comment Share on other sites More sharing options...
Denis 1477 Posted March 4, 2014 Author Share Posted March 4, 2014 I update the topic with some changes.Check it 1 Link to comment Share on other sites More sharing options...
Remix 45 Posted March 5, 2014 Share Posted March 5, 2014 You could do it better again Link to comment Share on other sites More sharing options...
Denis 1477 Posted March 5, 2014 Author Share Posted March 5, 2014 Can you give an example?I know this table it's ugly Link to comment Share on other sites More sharing options...
Remix 45 Posted March 8, 2014 Share Posted March 8, 2014 For example at an entry with just one index you don't need the {} Link to comment Share on other sites More sharing options...
Nemesis23 0 Posted May 28, 2020 Share Posted May 28, 2020 Somebody can tell me please where can I find the default Hunting Quests for edit please? Thank you so much! 1 Link to comment Share on other sites More sharing options...
Recommended Posts