IsabelaFernandez Posted December 6, 2023 Group: Members Topic Count: 146 Topics Per Day: 0.06 Content Count: 355 Reputation: 8 Joined: 04/16/18 Last Seen: October 21, 2024 Share Posted December 6, 2023 Hi friends. I'm having trouble getting this gift script to randomly deliver just one rentitem. Spoiler prontera,142,173,5 script Recompensas Diarias 911,{ .@cd = 60*60*24; // 24 hrs .@time = gettimetick(2); if ( #DAILYRENTREWARD+.@cd > .@time ) { mes "Volte novamente em "+Time2Str(#DAILYRENTREWARD+.@cd)+" para pegar sua recompensa!"; close; } mes "Aqui está sua recompensa, aproveite-a!"; close2; rentitem 4302, 7200; // <id>, <time in seconds> rentitem 4403, 7200; #DAILYRENTREWARD = .@time; end; } Quote Link to comment Share on other sites More sharing options...
0 Winterfox Posted December 6, 2023 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 245 Reputation: 93 Joined: 06/30/18 Last Seen: November 27, 2024 Share Posted December 6, 2023 prontera,142,173,5 script Recompensas Diarias 911,{ .@cd = 60 * 60 * 24; // 24 hrs .@time = gettimetick(2); if ( #DAILYRENTREWARD + .@cd > .@time ) { mes "Volte novamente em " + Time2Str(#DAILYRENTREWARD + .@cd) + " para pegar sua recompensa!"; close; } mes "Aqui está sua recompensa, aproveite-a!"; close2; // Pick one item index randomly as reference. .@reward_item_index = rand(getarraysize(.reward_items)); // Use the reference to get the item id and duration of the referenced item. rentitem(.reward_items[.@reward_item_index], .reward_item_durations[.@reward_item_index]); #DAILYRENTREWARD = .@time; end; OnInit: // Set the list of possible items and how long they should be rentable. setarray(.reward_items, 4302, 720); setarray(.reward_item_durations, 7200, 7200); } 1 Quote Link to comment Share on other sites More sharing options...
0 IsabelaFernandez Posted December 6, 2023 Group: Members Topic Count: 146 Topics Per Day: 0.06 Content Count: 355 Reputation: 8 Joined: 04/16/18 Last Seen: October 21, 2024 Author Share Posted December 6, 2023 1 hour ago, Winterfox said: prontera,142,173,5 script Recompensas Diarias 911,{ .@cd = 60 * 60 * 24; // 24 hrs .@time = gettimetick(2); if ( #DAILYRENTREWARD + .@cd > .@time ) { mes "Volte novamente em " + Time2Str(#DAILYRENTREWARD + .@cd) + " para pegar sua recompensa!"; close; } mes "Aqui está sua recompensa, aproveite-a!"; close2; // Pick one item index randomly as reference. .@reward_item_index = rand(getarraysize(.reward_items)); // Use the reference to get the item id and duration of the referenced item. rentitem(.reward_items[.@reward_item_index], .reward_item_durations[.@reward_item_index]); #DAILYRENTREWARD = .@time; end; OnInit: // Set the list of possible items and how long they should be rentable. setarray(.reward_items, 4302, 720); setarray(.reward_item_durations, 7200, 7200); } Perfect my friend, thank you very much! I have a question, I tried to copy my old script to deliver rentitem gifts to a random NPC and another to give several rentitems but it didn't work, is it due to the 24h waiting time? I thought creating another NPC wouldn't count your script: Spoiler prontera,142,173,5 script Recompensas Diarias 911,{ .@cd = 60 * 60 * 24; // 24 hrs .@time = gettimetick(2); if ( #DAILYRENTREWARD + .@cd > .@time ) { mes "Volte novamente em " + Time2Str(#DAILYRENTREWARD + .@cd) + " para pegar sua recompensa!"; close; } mes "Aqui está sua recompensa, aproveite-a!"; close2; // Pick one item index randomly as reference. .@reward_item_index = rand(getarraysize(.reward_items)); // Use the reference to get the item id and duration of the referenced item. rentitem(.reward_items[.@reward_item_index], .reward_item_durations[.@reward_item_index]); #DAILYRENTREWARD = .@time; end; OnInit: // Set the list of possible items and how long they should be rentable. setarray(.reward_items, 30023,30024,30025,30026,30027,30028,30029,30030,30031); setarray(.reward_item_durations, 10800,10800,10800,10800,10800,10800,10800,10800); } Mine: Spoiler prontera,139,173,5 script Recompensas Diarias 911,{ .@cd = 60*60*24; // 24 hrs .@time = gettimetick(2); if ( #DAILYRENTREWARD+.@cd > .@time ) { mes "Volte novamente em "+Time2Str(#DAILYRENTREWARD+.@cd)+" para pegar sua recompensa!"; close; } mes "Aqui está sua recompensa, aproveite-a!"; close2; rentitem 30023, 10800; // <id>, <time in seconds> rentitem 30024, 10800; rentitem 30025, 10800; rentitem 30026, 10800; rentitem 30027, 10800; rentitem 30028, 10800; rentitem 30029, 10800; rentitem 30030, 10800; rentitem 30031, 10800; #DAILYRENTREWARD = .@time; end; } Quote Link to comment Share on other sites More sharing options...
0 Winterfox Posted December 6, 2023 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 245 Reputation: 93 Joined: 06/30/18 Last Seen: November 27, 2024 Share Posted December 6, 2023 #DAILYRENTREWARD is a global account variable, that means it is the same for all NPCs and all characters of one account. So if the cooldown is set, it will be set for all NPCs that check for it. Quote Link to comment Share on other sites More sharing options...
Question
IsabelaFernandez
Hi friends. I'm having trouble getting this gift script to randomly deliver just one rentitem.
Link to comment
Share on other sites
3 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.