icaloxi 36 Posted January 18, 2020 Share Posted January 18, 2020 Hello freinds. i want the rainbow quest whit timer i try this: Spoiler quest regenbogen begin state start begin function TimeToUse() local timeleft = (pc.getqf("regiwait") - get_time()) timeleft = math.ceil(timeleft / 60) if timeleft > 60 then timeleft = math.ceil(timeleft / 60) chat("Verbleibende Zeit: "..timeleft.." Stunden.") else chat("Verbleibende Zeit: "..timeleft.." Minuten.") end end when 50512.use begin if get_time() > pc.getqf("regiwait") then say_title("Regenbogenstein:") say("Du kannst den Regenbogenstein noch nicht benutzen!") regenbogen.TimeToUse() wait() else say_title("Regenbogenstein:") say("Du möchtest also deine Skills ") say("Perfektionieren?") if pc.job ==0 then say("Wähle deine Lehre aus") local s=select("Körper","Mental") if s==1 then pc.set_skill_group(1) pc.set_skill_level(1 ,59) pc.set_skill_level(2 ,59) pc.set_skill_level(3 ,59) pc.set_skill_level(4 ,59) pc.set_skill_level(5 ,59) say("Alle deine Skills sind nun Perfekt!") pc.setqf("regiwait", get_time() + 60*60*1) else pc.set_skill_group(2) pc.set_skill_level(16 ,59) pc.set_skill_level(17 ,59) pc.set_skill_level(18 ,59) pc.set_skill_level(19 ,59) pc.set_skill_level(20 ,59) say("Alle deine Skills sind nun Perfekt!") pc.setqf("regiwait", get_time() + 60*60*1) end elseif pc.job ==1 then say("Wähle deine Lehre aus") local s=select("Nahkampf","Fernkampf") if s==1 then pc.set_skill_group(3) pc.set_skill_level(31 ,59) pc.set_skill_level(32 ,59) pc.set_skill_level(33 ,59) pc.set_skill_level(34 ,59) pc.set_skill_level(35 ,59) say("Alle deine Skills sind nun Perfekt!") pc.setqf("regiwait", get_time() + 60*60*1) else pc.set_skill_group(4) pc.set_skill_level(46 ,59) pc.set_skill_level(47 ,59) pc.set_skill_level(48 ,59) pc.set_skill_level(49 ,59) pc.set_skill_level(50 ,59) say("Alle deine Skills sind nun Perfekt!") pc.setqf("regiwait", get_time() + 60*60*1) end elseif pc.job ==2 then say("Wähle deine Lehre aus") local s=select("Magie","Waffe") if s==1 then pc.set_skill_group(5) pc.set_skill_level(76 ,59) pc.set_skill_level(77 ,59) pc.set_skill_level(78 ,59) pc.set_skill_level(79 ,59) pc.set_skill_level(80 ,59) pc.set_skill_level(81, 59) say("Alle deine Skills sind nun Perfekt!") pc.setqf("regiwait", get_time() + 60*60*1) else pc.set_skill_group(6) pc.set_skill_level(61 ,59) pc.set_skill_level(62 ,59) pc.set_skill_level(63 ,59) pc.set_skill_level(64 ,59) pc.set_skill_level(65 ,59) pc.set_skill_level(66 ,59) say("Alle deine Skills sind nun Perfekt!") pc.setqf("regiwait", get_time() + 60*60*1) end elseif pc.job ==3 then say("Wähle deine Lehre aus") local s=select("Heilung","Drache") if s==1 then pc.set_skill_group(7) pc.set_skill_level(106 ,59) pc.set_skill_level(107 ,59) pc.set_skill_level(108 ,59) pc.set_skill_level(109 ,59) pc.set_skill_level(110 ,59) pc.set_skill_level(111 ,59) say("Alle deine Skills sind nun Perfekt!") pc.setqf("regiwait", get_time() + 60*60*1) else pc.set_skill_group(8) pc.set_skill_level(91 ,59) pc.set_skill_level(92 ,59) pc.set_skill_level(93 ,59) pc.set_skill_level(94 ,59) pc.set_skill_level(95 ,59) pc.set_skill_level(96 ,59) say("Alle deine Skills sind nun Perfekt!") pc.setqf("regiwait", get_time() + 60*60*1) end end end end end end but after i use it again it say. you can dont use it now. an then it say "you must wait -2617237127 minutes" can anyone help me pls ? thx. SORRY FOR MY ENGLISH Link to comment Share on other sites More sharing options...
Vanilla 1456 Posted January 18, 2020 Share Posted January 18, 2020 what is get_time() and how is it defined? Looks like that one is broken. Due to it being broken you may get weird values. Please also check your player.quest table and look for the "regiwait" questflag for this specific player. I'm pretty much sure it's the get_time() function that's wrong here. Maybe you wanted to use get_global_time() instead? We are the tortured. We're not your friends. As long as we're not visible. We are unfixable. Link to comment Share on other sites More sharing options...
icaloxi 36 Posted January 18, 2020 Author Share Posted January 18, 2020 i just want a quest who dont allow to use this item again because i have this rainbow stone in shop for make P skills, and you can buy it and use it again...and have like Aura and mental warroir skill.... both then i want a timer who prevented that to switch it all the time i hope you know what i mean Link to comment Share on other sites More sharing options...
Premium Syreldar 1885 Posted January 18, 2020 Premium Share Posted January 18, 2020 @Vanilla No, they're the same thing. That quest is just poorly written. This should do: Global: PERFECT_MASTER_SKILL_LEVEL = 40; ACTIVE_SKILL_LIST = { --** Warrior [0] = { [1] = {1, 2, 3, 4, 5, 6}, --** Body [2] = {16, 17, 18, 19, 20, 21} --** Mental }, --** Assassin [1] = { [1] = {31, 32, 33, 34, 35, 36}, --** Blade Fight [2] = {46, 47, 48, 49, 50, 51} --** Archery }, --** Sura [2] = { [1] = {61, 62, 63, 64, 65, 66}, --** Weaponry [2] = {76, 77, 78, 79, 80, 81} --** Black Magic }, --** Shaman [3] = { [1] = {91, 92, 93, 94, 95, 96}, --** Dragon Power [2] = {106, 107, 108, 109, 110, 111} --** Healing Power }, --** Lycan [4] = { [1] = {170, 171, 172, 173, 174, 175}, --** Instinct } }; Quest: quest regenbogen begin state start begin function BuildSkillVnumList(job, group) local skill_list = ACTIVE_SKILL_LIST[job][group]; local vnum_list = {}; for _, skill_vnum in ipairs(skill_list) do local skill_level = pc.get_skill_level(skill_vnum); if (skill_level < PERFECT_MASTER_SKILL_LEVEL) then table.insert(vnum_list, skill_vnum); end -- if end -- for return vnum_list; end -- function when 50512.use begin say_title(string.format("%s:[ENTER]", item_name(item.get_vnum()))) if (pc.get_skill_group() == 0) then return say_reward("You have to choose your skill group first.[ENTER]"); elseif (get_time() < pc.getqf("next_regenbogenstein_use_time")) then -- https://metin2.dev/board/index.php?/topic/15905-functionssyreldars-quest-functions/ - get_time_format(sec) return say_reward(string.format("Time remaining: %s", get_time_format(pc.getqf("next_regenbogenstein_use_time") - get_time()))) end -- if/elseif -- https://metin2.dev/board/index.php?/topic/15905-functionssyreldars-quest-functions/ - time_hour_to_sec(hours) pc.setqf("next_regenbogenstein_use_time", get_time() + time_hour_to_sec(1)); local skill_vnum_list = regenbogen.BuildSkillVnumList(pc.get_job(), pc.get_skill_group()); for _, skill_vnum in ipairs(skill_vnum_list) do pc.set_skill_level(skill_vnum, PERFECT_MASTER_SKILL_LEVEL); end -- for say("Your skills' level has been set to Perfect Master.[ENTER]") end -- when end -- state end -- quest "Nothing's free in this life. Ignorant people have an obligation to make up for their ignorance by paying those who help them. Either you got the brains or cash, if you lack both you're useless." Syreldar Link to comment Share on other sites More sharing options...
icaloxi 36 Posted January 18, 2020 Author Share Posted January 18, 2020 can anyone pls do a quest for me for that ? Link to comment Share on other sites More sharing options...
Premium Syreldar 1885 Posted January 19, 2020 Premium Share Posted January 19, 2020 39 minutes ago, icaloxi said: can anyone pls do a quest for me for that ? I just did? Next time use the Services channel though. https://metin2.dev/board/index.php?/forum/56-coding/ This channel is meant for people to answer your questions, not make your requests. "Nothing's free in this life. Ignorant people have an obligation to make up for their ignorance by paying those who help them. Either you got the brains or cash, if you lack both you're useless." Syreldar Link to comment Share on other sites More sharing options...
icaloxi 36 Posted January 19, 2020 Author Share Posted January 19, 2020 Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now