jkhan 3 Posted June 2, 2017 Share Posted June 2, 2017 Hello, I need reset biologist time limit quest's. If you have know and rejoice if you share. Good works. Link to comment Share on other sites More sharing options...
Tasho 243 Posted June 2, 2017 Share Posted June 2, 2017 PS: I didn't tested, but should working. 1. Command mysql (if you want to reset for all people): UPDATE player.quest SET lValue = 0 WHERE szName LIKE ('%collect_quest_lv%') AND szState = 'duration'; 2. Quest (if you want for people can do that alone, you can put like via a special item etc): quest biolog begin state start begin function remove_time() local biologistDict = { "collect_quest_lv30", "collect_quest_lv40", "collect_quest_lv50", "collect_quest_lv60", "collect_quest_lv70", "collect_quest_lv80", "collect_quest_lv85", "collect_quest_lv90", "collect_quest_lv92", "collect_quest_lv94" } for questName = 1, table.getn(biologistDict) do pc.setf(biologistDict[questName], "duration", 0) -- SetFlag(questName + "." + stateName, iValue); syschat(string.format("pc.setf(%s.duration, 0)", biologistDict[questName])) end end when 20084.chat."Reset biologist time" begin say_title("Biologist:") say("Are you sure you want to do that?") if (select("Yes", "Not now") == 1) then biolog.remove_time() end end end end 1 Link to comment Share on other sites More sharing options...
Premium Syreldar 1870 Posted June 2, 2017 Premium Share Posted June 2, 2017 @Tasho Bad local sel = select ("Yes", "Not now") if (sel == 1) then biolog.remove_time() else return end Good if (select("Yes", "Not now") == 1) then biolog.remove_time(); end -- if Saving the select function inside a variable is only useful when the select has 3+ arguments, else it is not. while "else return end" is just useless coding-wise and can be substituted by a simple "end". "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...
Tasho 243 Posted June 2, 2017 Share Posted June 2, 2017 18 minutes ago, Syreldar said: @Tasho Bad Yeah it's same but there we speak just about "good practices". I was know already that, doesn't importantly the else return (in this case) it was just useless coding, but i did that that without to think. Now should be ok, thanks. Link to comment Share on other sites More sharing options...
Premium Syreldar 1870 Posted June 2, 2017 Premium Share Posted June 2, 2017 Just now, Tasho said: Yeah it's same but there we speak just about "good practices". I was know already that, doesn't importantly the else return (in this case) it was just useless coding, but i did that that without to think. Now should be ok, thanks. Yes, sorry, bad coding just triggers me, even tho it does not matter. "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...
jkhan 3 Posted June 3, 2017 Author Share Posted June 3, 2017 On 02.06.2017 at 4:30 AM, Tasho said: PS: I didn't tested, but should working. 1. Command mysql (if you want to reset for all people): UPDATE player.quest SET lValue = 0 WHERE szName LIKE ('%collect_quest_lv%') AND szState = 'duration'; 2. Quest (if you want for people can do that alone, you can put like via a special item etc): quest biolog begin state start begin function remove_time() local biologistDict = { "collect_quest_lv30", "collect_quest_lv40", "collect_quest_lv50", "collect_quest_lv60", "collect_quest_lv70", "collect_quest_lv80", "collect_quest_lv85", "collect_quest_lv90", "collect_quest_lv92", "collect_quest_lv94" } for questName = 1, table.getn(biologistDict) do pc.setf(biologistDict[questName], "duration", 0) -- SetFlag(questName + "." + stateName, iValue); syschat(string.format("pc.setf(%s.duration, 0)", biologistDict[questName])) end end when 20084.chat."Reset biologist time" begin say_title("Biologist:") say("Are you sure you want to do that?") if (select("Yes", "Not now") == 1) then biolog.remove_time() end end end end On 02.06.2017 at 5:24 AM, Syreldar said: @Tasho Bad local sel = select ("Yes", "Not now") if (sel == 1) then biolog.remove_time() else return end Good if (select("Yes", "Not now") == 1) then biolog.remove_time(); end -- if Saving the select function inside a variable is only useful when the select has 3+ arguments, else it is not. while "else return end" is just useless coding-wise and can be substituted by a simple "end". Thanks guys, its work but i have some problems. How can i prevent reuse of active. I want to run through an item. Link to comment Share on other sites More sharing options...
Premium Syreldar 1870 Posted June 4, 2017 Premium Share Posted June 4, 2017 On 3/6/2017 at 10:03 AM, jkhan said: Thanks guys, its work but i have some problems. How can i prevent reuse of active. I want to run through an item. What do you mean by reuse of active? You mean you only want to make it possible to use this only once per player, on an item? if yes: Substitute XXX with the item vnum, and keep in mind the item's type must be 18 in order for the quest to work. quest biologist_reset begin state start begin function ResetBiologist() local quest_names = { [1] = "collect_quest_lv30", [2] = "collect_quest_lv40", [3] = "collect_quest_lv50", [4] = "collect_quest_lv60", [5] = "collect_quest_lv70", [6] = "collect_quest_lv80", [7] = "collect_quest_lv85", [8] = "collect_quest_lv90", [9] = "collect_quest_lv92", [10] = "collect_quest_lv94" }; for i = 1, table.getn(quest_names) do pc.setf(quest_names[i], "duration", 0); end -- for end -- function when XXX.use begin say_title(string.format("%s:[ENTER]", item_name(item.get_vnum()))) if (pc.getqf("biologist_reset") == 0) then say("Are you sure?") say("You can only do this once.[ENTER]") if (select("Yes", "Not now") == 1) then pc.setqf("biologist_reset", 1); biologist_reset.ResetBiologist(); end -- if else say("You already used it.") say("You can't use it anymore.[ENTER]") end -- if/else 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...
jkhan 3 Posted June 5, 2017 Author Share Posted June 5, 2017 1 hour ago, Syreldar said: What do you mean by reuse of active? You mean you only want to make it possible to use this only once per player, on an item? if yes: Substitute XXX with the item vnum, and keep in mind the item's type must be 18 in order for the quest to work. quest biologist_reset begin state start begin function ResetBiologist() local quest_names = { [1] = "collect_quest_lv30", [2] = "collect_quest_lv40", [3] = "collect_quest_lv50", [4] = "collect_quest_lv60", [5] = "collect_quest_lv70", [6] = "collect_quest_lv80", [7] = "collect_quest_lv85", [8] = "collect_quest_lv90", [9] = "collect_quest_lv92", [10] = "collect_quest_lv94" }; for i = 1, table.getn(quest_names) do pc.setf(quest_names[i], "duration", 0); end -- for end -- function when XXX.use begin say_title(string.format("%s:[ENTER]", item_name(item.get_vnum()))) if (pc.getqf("biologist_reset") == 0) then say("Are you sure?") say("You can only do this once.[ENTER]") if (select("Yes", "Not now") == 1) then pc.setqf("biologist_reset", 1); biologist_reset.ResetBiologist(); end -- if else say("You already used it.") say("You can't use it anymore.[ENTER]") end -- if/else end -- when end -- state end -- quest Thank you bro, soory for my bad english. I could not explain exactly I want if the time is reset, prevent it from being used again. I appreciate your help. Thank you! Link to comment Share on other sites More sharing options...
Premium Syreldar 1870 Posted June 5, 2017 Premium Share Posted June 5, 2017 13 hours ago, jkhan said: Thank you bro, soory for my bad english. I could not explain exactly I want if the time is reset, prevent it from being used again. I appreciate your help. Thank you! then that quest fits you, substitute the XXX with the vnum of the item you want to use and you are set. "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...
jkhan 3 Posted June 5, 2017 Author Share Posted June 5, 2017 2 hours ago, Syreldar said: then that quest fits you, substitute the XXX with the vnum of the item you want to use and you are set. Thank you but, This will not happen that. If the time is reset and no task is given the time will not be reset for the 2nd time. If the time is reset and the task is given, The System Will be reset. Sorry for my bad English. Link to comment Share on other sites More sharing options...
Premium Syreldar 1870 Posted June 5, 2017 Premium Share Posted June 5, 2017 Sorry, i do not understand. "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...
Active Member hachiwari 138 Posted June 5, 2017 Active Member Share Posted June 5, 2017 1 godzinę temu, Syreldar napisał: Sorry, i do not understand. Bad Sorry, i do not understand. Good Sorry, i don't understand. Link to comment Share on other sites More sharing options...
jkhan 3 Posted June 6, 2017 Author Share Posted June 6, 2017 9 hours ago, Syreldar said: Sorry, i do not understand. When you click npc and the time is reset If the biologist is not assigned, You can reset the time again after you give the biologist Bro. 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