Jiji 0 Posted April 29, 2019 Hello i wanted to request a custom npc that gives an item to a specific range of IDs. Example: Account IDs : 2000009 - 2000030 gets 20 apples upon logging in game and has a timer of 24 hours. Thank you in advance. ☺️ Quote Share this post Link to post Share on other sites
0 Kuroe 5 Posted April 30, 2019 - script Sample FAKE_NPC,{ OnInit: detachrid(); .cdtime = 24*60*60; for (set .accid, 2000009; .accid<=2000030 ; .accid++) end; OnPCLoginEvent: attachrid(.accid); if (#gotone + .cdtime> gettimetick(2)) { dispbottom "Daily reward have been distributed"; end; } else { dispbottom "An apple a day takes the doctor away."; getitem Apple,20; #gotone = gettimetick(2); end; } } Quote Share this post Link to post Share on other sites
0 Luciar 14 Posted April 30, 2019 (edited) 9 hours ago, Kuroe said: - script Sample FAKE_NPC,{ OnInit: detachrid(); .cdtime = 24*60*60; for (set .accid, 2000009; .accid<=2000030 ; .accid++) end; OnPCLoginEvent: attachrid(.accid); if (#gotone + .cdtime> gettimetick(2)) { dispbottom "Daily reward have been distributed"; end; } else { dispbottom "An apple a day takes the doctor away."; getitem Apple,20; #gotone = gettimetick(2); end; } } Thanks for trying to help the OP. However, this script isn’t written correctly. The OnInit label inherently does not have an attached RID, using detachrid() is pointless. You then use a for loop without any defined action: syntax for(index set; condition; increment) { action } Note that you are missing the action portion of the for loop. The OnPCLoginEvent label inherently DOES have an RID attached (namely, the player that just logged in). There is no need to use attachrid here. If you were to fix all of the issues I listed above, your script would distribute the items to all accounts as you have not implemented any check to ensure the account ID is within the specified range described by the OP. Edited April 30, 2019 by Luciar 1 Kuroe reacted to this Quote Share this post Link to post Share on other sites
0 skymia 0 Posted February 20, 2020 On 4/30/2019 at 2:46 PM, Kuroe said: - script Sample FAKE_NPC,{ OnInit: detachrid(); .cdtime = 24*60*60; for (set .accid, 2000009; .accid<=2000030 ; .accid++) end; OnPCLoginEvent: attachrid(.accid); if (#gotone + .cdtime> gettimetick(2)) { dispbottom "Daily reward have been distributed"; end; } else { dispbottom "An apple a day takes the doctor away."; getitem Apple,20; #gotone = gettimetick(2); end; } } - script Sample FAKE_NPC,{ OnInit: detachrid(); .cdtime = 24*60*60; for (set .accid, 2000009; .accid<=2000030 ; .accid++) end; OnPCLoginEvent: attachrid(.accid); if (#gotone + .cdtime> gettimetick(2)) { dispbottom "Daily reward have been distributed"; end; } else { dispbottom "An apple a day takes the doctor away."; getitem Apple,20; #gotone = gettimetick(2); end; } } how about random account id's? and if its possible it is also a random item to the random players that will be rewarded. Quote Share this post Link to post Share on other sites
0 Patskie 88 Posted April 12, 2020 On 2/20/2020 at 3:32 PM, skymia said: how about random account id's? and if its possible it is also a random item to the random players that will be rewarded. getitem Apple, 20, rand(2000009, 2000030); Quote Share this post Link to post Share on other sites
0 sootil 0 Posted April 15, 2020 On 5/1/2019 at 12:10 AM, Luciar said: Thanks for trying to help the OP. However, this script isn’t written correctly. The OnInit label inherently does not have an attached RID, using detachrid() is pointless. You then use a for loop without any defined action: syntax for(index set; condition; increment) { action } Note that you are missing the action portion of the for loop. The OnPCLoginEvent label inherently DOES have an RID attached (namely, the player that just logged in). There is no need to use attachrid here. If you were to fix all of the issues I listed above, your script would distribute the items to all accounts as you have not implemented any check to ensure the account ID is within the specified range described by the OP. Thanks for this Sir, Can u share the correct one? The one that will work. Newbie here. Thanks for the help in advance! Quote Share this post Link to post Share on other sites
Hello i wanted to request a custom npc that gives an item to a specific range of IDs.
Example:
Account IDs : 2000009 - 2000030
gets 20 apples upon logging in game and has a timer of 24 hours.
Thank you in advance. ☺️
Share this post
Link to post
Share on other sites