Tassadar Posted January 23, 2020 Posted January 23, 2020 (edited) Good evening to all. Happy New Year. We are back. How to leave this daily quest, renewing every day 06:00 AM? Thanks. * npc by Emistry! prontera,155,181,5 script Sample 4_F_KAFRA1,{ if (!quest_random) { quest_random = rand(1, 2); mes "You have been assigned with a new quest."; next; } switch(quest_random) { case 1: setarray .@reward, 4001, 1; setarray .@item, 512; setarray .@amount, 100; break; case 2: setarray .@reward, 4002, 1; setarray .@item, 501, 502, 503; setarray .@amount, 3, 1, 2; break; default: mes "invalid quest."; close; } mes "Quest Requirement(s):"; .@size = getarraysize(.@item); for (.@i = 0; .@i < .@size; .@i++) { mes " > "+.@amount[.@i]+"x "+getitemname(.@item[.@i]); if (countitem(.@item[.@i]) < .@amount[.@i]) .@fail++; } if (!.@fail) { next; if (select("Submit Quest", "Cancel") == 1) { for (.@i = 0; .@i < .@size; .@i++) delitem .@item[.@i], .@amount[.@i]; getitem .@reward[0], .@reward[1]; quest_random = 0; } } close; } Edited January 23, 2020 by Tassadar give credits to the author. Quote
0 Emistry Posted March 15, 2020 Posted March 15, 2020 (edited) you can try this. prontera,155,181,5 script Sample 4_F_KAFRA1,{ if (quest_random_cd > gettimetick(2)) { mes "You will be assigned with a new quest by tomorrow 6AM."; mes "Cooldown: "+(quest_random_cd - gettimetick(2))+" seconds"; close; } if (!quest_random) { quest_random = rand(1, 2); mes "You have been assigned with a new quest."; next; } switch(quest_random) { case 1: setarray .@reward, 4001, 1; setarray .@item, 512; setarray .@amount, 100; break; case 2: setarray .@reward, 4002, 1; setarray .@item, 501, 502, 503; setarray .@amount, 3, 1, 2; break; default: mes "invalid quest."; close; } mes "Quest Requirement(s):"; .@size = getarraysize(.@item); for (.@i = 0; .@i < .@size; .@i++) { mes " > "+.@amount[.@i]+"x "+getitemname(.@item[.@i]); if (countitem(.@item[.@i]) < .@amount[.@i]) .@fail++; } if (!.@fail) { next; if (select("Submit Quest", "Cancel") == 1) { for (.@i = 0; .@i < .@size; .@i++) delitem .@item[.@i], .@amount[.@i]; getitem .@reward[0], .@reward[1]; quest_random = 0; quest_random_cd = gettimetick(2) + (86400 - gettimetick(1)) + (6 * 3600); // till 6AM next day. } } close; } or this prontera,155,181,5 script Sample 4_F_KAFRA1,{ if (quest_random_cd == gettime(8)) { mes "You will be assigned with a new quest by tomorrow 6AM."; close; } if (!quest_random) { if (gettime(3) < 6) { mes "You will be assigned with a new quest by 6AM today."; close; } quest_random_cd = 0; quest_random = rand(1, 2); mes "You have been assigned with a new quest."; next; } switch(quest_random) { case 1: setarray .@reward, 4001, 1; setarray .@item, 512; setarray .@amount, 100; break; case 2: setarray .@reward, 4002, 1; setarray .@item, 501, 502, 503; setarray .@amount, 3, 1, 2; break; default: mes "invalid quest."; close; } mes "Quest Requirement(s):"; .@size = getarraysize(.@item); for (.@i = 0; .@i < .@size; .@i++) { mes " > "+.@amount[.@i]+"x "+getitemname(.@item[.@i]); if (countitem(.@item[.@i]) < .@amount[.@i]) .@fail++; } if (!.@fail) { next; if (select("Submit Quest", "Cancel") == 1) { for (.@i = 0; .@i < .@size; .@i++) delitem .@item[.@i], .@amount[.@i]; getitem .@reward[0], .@reward[1]; quest_random = 0; quest_random_cd = gettime(8); } } close; } Edited March 15, 2020 by Emistry 1 Quote
0 fictionx Posted January 24, 2020 Posted January 24, 2020 prontera,155,181,5 script Sample 4_F_KAFRA1,{ OnClock0600: quest_random = 0; end; if (!quest_random) { quest_random = rand(1, 2); mes "You have been assigned with a new quest."; next; } switch(quest_random) { case 1: setarray .@reward, 4001, 1; setarray .@item, 512; setarray .@amount, 100; break; case 2: setarray .@reward, 4002, 1; setarray .@item, 501, 502, 503; setarray .@amount, 3, 1, 2; break; default: mes "invalid quest."; close; } mes "Quest Requirement(s):"; .@size = getarraysize(.@item); for (.@i = 0; .@i < .@size; .@i++) { mes " > "+.@amount[.@i]+"x "+getitemname(.@item[.@i]); if (countitem(.@item[.@i]) < .@amount[.@i]) .@fail++; } if (!.@fail) { next; if (select("Submit Quest", "Cancel") == 1) { for (.@i = 0; .@i < .@size; .@i++) delitem .@item[.@i], .@amount[.@i]; getitem .@reward[0], .@reward[1]; } } close; OnInit: quest_random = 0; end; } Probably this should work. Quote
0 Tassadar Posted January 25, 2020 Author Posted January 25, 2020 (edited) 11 hours ago, fictionx said: Probably this should work. Thanks for the help, but unfortunately it didn't work. The npc appears but is not clickable. Does not open any dialog boxes. I'm posting the error that gave in the putty. I didn't understand what removes the player's variable preventing him from doing the quest 2 times in the same day. Edited January 25, 2020 by Tassadar thank for the help. Quote
0 Litro Endemic Posted January 25, 2020 Posted January 25, 2020 (edited) prontera,155,181,5 script Sample 4_F_KAFRA1,{ if (!quest_random) { // quest not taken or completed, check the date and time. if (quest_random_next <= gettime(DT_DAYOFYEAR) && gettime(DT_HOUR) < 6) { mes "you have completed today quest, come again tomorrow, thank you!"; close; } quest_random = rand(1, 2); mes "You have been assigned with a new quest."; next; } switch(quest_random) { case 1: setarray .@reward, 4001, 1; setarray .@item, 512; setarray .@amount, 100; break; case 2: setarray .@reward, 4002, 1; setarray .@item, 501, 502, 503; setarray .@amount, 3, 1, 2; break; default: mes "invalid quest."; close; } mes "Quest Requirement(s):"; .@size = getarraysize(.@item); for (.@i = 0; .@i < .@size; .@i++) { mes " > "+.@amount[.@i]+"x "+getitemname(.@item[.@i]); if (countitem(.@item[.@i]) < .@amount[.@i]) .@fail++; } if (!.@fail) { next; if (select("Submit Quest", "Cancel") == 1) { for (.@i = 0; .@i < .@size; .@i++) delitem .@item[.@i], .@amount[.@i]; getitem .@reward[0], .@reward[1]; quest_random = 0; // Set next day limitation to take the quest. quest_random_next = gettime(DT_DAYOFYEAR); } } close; } you can try this Edited January 25, 2020 by Litro Endemic Quote
0 Tassadar Posted February 1, 2020 Author Posted February 1, 2020 On 1/25/2020 at 3:54 AM, Litro Endemic said: you can try this it didn't work .. he delivers all quests on the same day. He is not turning on a 24-hour timer. Quote
0 Litro Endemic Posted February 3, 2020 Posted February 3, 2020 you want 24 hours delay or every day reset at 6 AM ? prontera,155,181,5 script Sample 4_F_KAFRA1,{ if (!quest_random) { // today quest has been, completed. if (quest_random_next <= gettime(DT_DAYOFYEAR)) { mes "you have completed today quest, come again tomorrow, thank you!"; close; } // its new day after the last quest submission, but yet 06 am today. if (quest_random_next > gettime(DT_DAYOFYEAR) && gettime(DT_HOUR) < 6) { mes "new quest will be available at 06 AM today"; close; } quest_random = rand(1, 2); mes "You have been assigned with a new quest."; next; } switch(quest_random) { case 1: setarray .@reward, 4001, 1; setarray .@item, 512; setarray .@amount, 100; break; case 2: setarray .@reward, 4002, 1; setarray .@item, 501, 502, 503; setarray .@amount, 3, 1, 2; break; default: mes "invalid quest."; close; } mes "Quest Requirement(s):"; .@size = getarraysize(.@item); for (.@i = 0; .@i < .@size; .@i++) { mes " > "+.@amount[.@i]+"x "+getitemname(.@item[.@i]); if (countitem(.@item[.@i]) < .@amount[.@i]) .@fail++; } if (!.@fail) { next; if (select("Submit Quest", "Cancel") == 1) { for (.@i = 0; .@i < .@size; .@i++) delitem .@item[.@i], .@amount[.@i]; getitem .@reward[0], .@reward[1]; quest_random = 0; // Set next day limitation to take the quest. quest_random_next = gettime(DT_DAYOFYEAR); } } close; } Quote
0 Tassadar Posted February 5, 2020 Author Posted February 5, 2020 just once a day. resetting at 06:00 am. On 2/3/2020 at 12:59 PM, Litro Endemic said: you want 24 hours delay or every day reset at 6 AM ? prontera,155,181,5 script Sample 4_F_KAFRA1,{ if (!quest_random) { // today quest has been, completed. if (quest_random_next <= gettime(DT_DAYOFYEAR)) { mes "you have completed today quest, come again tomorrow, thank you!"; close; } // its new day after the last quest submission, but yet 06 am today. if (quest_random_next > gettime(DT_DAYOFYEAR) && gettime(DT_HOUR) < 6) { mes "new quest will be available at 06 AM today"; close; } quest_random = rand(1, 2); mes "You have been assigned with a new quest."; next; } switch(quest_random) { case 1: setarray .@reward, 4001, 1; setarray .@item, 512; setarray .@amount, 100; break; case 2: setarray .@reward, 4002, 1; setarray .@item, 501, 502, 503; setarray .@amount, 3, 1, 2; break; default: mes "invalid quest."; close; } mes "Quest Requirement(s):"; .@size = getarraysize(.@item); for (.@i = 0; .@i < .@size; .@i++) { mes " > "+.@amount[.@i]+"x "+getitemname(.@item[.@i]); if (countitem(.@item[.@i]) < .@amount[.@i]) .@fail++; } if (!.@fail) { next; if (select("Submit Quest", "Cancel") == 1) { for (.@i = 0; .@i < .@size; .@i++) delitem .@item[.@i], .@amount[.@i]; getitem .@reward[0], .@reward[1]; quest_random = 0; // Set next day limitation to take the quest. quest_random_next = gettime(DT_DAYOFYEAR); } } close; } what if the npc resets midnight? programming is easier. because that's fine with me. Quote
0 Litro Endemic Posted February 6, 2020 Posted February 6, 2020 please describe the npc behaviour step by step, i don't really understand what you want anymore.... Quote
Question
Tassadar
Good evening to all. Happy New Year. We are back.
How to leave this daily quest, renewing every day 06:00 AM?
Thanks.
* npc by Emistry!
give credits to the author.
8 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.