Guih Posted July 28, 2015 Posted July 28, 2015 Hello everyone, I'd like to have an NPC where I could collect about 20 Apples per day and only one time independent of the person who collected. Is that possible? Thanks in advance! Quote
0 Emistry Posted July 29, 2015 Posted July 29, 2015 - script apple_tree -1,{ .@i = atoi( strnpcinfo(2) ); mes "[ ^0000FFApple Giver^000000 ]"; if ( getd( ".apple_tree_"+.@i ) ) { mes "Look someone was already here and got all my apples..."; } else { mes "Whoa! It must be your lucky day here are some yummy apples for you!"; setd( ".apple_tree_"+.@i ),1; } close; OnClock0000: setd( ".apple_tree_"+strnpcinfo(2) ),0; end; } prontera,1,1,4 duplicate(apple_tree) Apple Tree#01 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#02 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#03 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#04 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#05 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#06 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#07 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#08 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#09 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#10 111 Quote
0 Waken Posted July 28, 2015 Posted July 28, 2015 You can make a permanent global variable when the player "takes" the apples, a variable like this "$APPLES". And you can reset the valor every day using that : OnClock<hour><minute>: It's only a thought Quote
0 Skorm Posted July 28, 2015 Posted July 28, 2015 Hello everyone, I'd like to have an NPC where I could collect about 20 Apples per day and only one time independent of the person who collected. Is that possible? Thanks in advance! prontera,100,100,5 script Apple Giver 100,{ if( !.apples ) { .apples++; mes "[ ^0000FFApple Giver^000000 ]"; mes "Whoa! It must be your lucky day here are some yummy apples for you!"; getitem 501, 20; } else { mes "[ ^0000FFApple Giver^000000 ]"; mes "Look someone was already here and got all my apples..."; } close; OnClock0000: .apples = 0; } Quote
0 Guih Posted July 28, 2015 Author Posted July 28, 2015 Okay, that worked, thanks Skorm! But I need to duplicate it to a lot of maps, and with this script of yours I can't use the NPC on the other map if I've used it already... How can I make it usable per map? Thanks ;D Quote
0 Vykimo Posted July 29, 2015 Posted July 29, 2015 geffen,100,100,5 duplicate(Apple Giver) Apple Giver#2 100 will work without problem Quote
0 Guih Posted July 29, 2015 Author Posted July 29, 2015 geffen,100,100,5 duplicate(Apple Giver) Apple Giver#2 100 will work without problem I tried it, but it didn't work =/ It seems that the duplicates also get the variable of the main NPC, so I can't get the apples in the duplicates Quote
0 Guih Posted July 29, 2015 Author Posted July 29, 2015 - script apple_tree -1,{ .@i = atoi( strnpcinfo(2) ); mes "[ ^0000FFApple Giver^000000 ]"; if ( getd( ".apple_tree_"+.@i ) ) { mes "Look someone was already here and got all my apples..."; } else { mes "Whoa! It must be your lucky day here are some yummy apples for you!"; setd( ".apple_tree_"+.@i ),1; } close; OnClock0000: setd( ".apple_tree_"+strnpcinfo(2) ),0; end; } prontera,1,1,4 duplicate(apple_tree) Apple Tree#01 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#02 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#03 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#04 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#05 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#06 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#07 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#08 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#09 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#10 111 Thank you Emistry, it worked perfectly! Quote
0 Azeroth Posted November 21, 2015 Posted November 21, 2015 - script apple_tree -1,{ .@i = atoi( strnpcinfo(2) ); mes "[ ^0000FFApple Giver^000000 ]"; if ( getd( ".apple_tree_"+.@i ) ) { mes "Look someone was already here and got all my apples..."; } else { mes "Whoa! It must be your lucky day here are some yummy apples for you!"; setd( ".apple_tree_"+.@i ),1; } close; OnClock0000: setd( ".apple_tree_"+strnpcinfo(2) ),0; end; } prontera,1,1,4 duplicate(apple_tree) Apple Tree#01 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#02 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#03 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#04 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#05 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#06 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#07 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#08 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#09 111 prontera,1,1,4 duplicate(apple_tree) Apple Tree#10 111 Uhm, possible to add timestamp? name of char | job class | date and time i know this one is through sql VERSION can you please add. .item = 5; quantity of apples? Quote
Question
Guih
Hello everyone, I'd like to have an NPC where I could collect about 20 Apples per day and only one time independent of the person who collected. Is that possible?
Thanks in advance!
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.