Jump to content
  • 0

npc point script needed help pls


Reborn

Question


  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.03
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

can anyone give me a script for the npc that gives a premium points.

the npc required a random card every two hours then a card has a specific amount of point rewarded.

for example the npc needs a poring card and it will reward a character a 20 premium points. but the npc will take all the poring card in your inventory but rewarded each card a 20 points.

every two hour the npc will change the required card.

hope you understand what i mean.

Link to comment
Share on other sites

16 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

prontera,150,150,0	script	Marvin	100,{

	mes "[Marvin]";
	mes "Excuse me, I was wondering if you would mind helping me. You see, I collect cards and curently I'm missing a " +getitemname(.random_card)+ ". If you could provide me with some pristine examples of this card, I can offer " +getitemname(.random_reward)+ " Cedi in return.";
	next;
	menu "What is Cedi?",L_what,"I have your cards!",L_check,"Nevermind",L_close;
L_what:	mes "[Marvin]";
	mes "Cedi is an ancient currency that is still quite valuable in the right circles. I hear Tim-Tom down the road only takes Cedi at his shop.";
	next;
	mes "[Marvin]";
	mes "How much I can give you per card varies, but I'll be sure to tell you how much I'm offering if you bring me some.";
	close;
L_check:
	if (countitem(.random_card) < 1)goto L_nothing;
	getinventorylist;
	for ( set .@i, 0; .@i < @inventorylist_count; set .@i, .@i + 1 )
		if ( @inventorylist_id[.@i] == .random_card )
			set .count, @inventorylist_amount[.@i];
	   mes "[Marvin]";
	mes "Would you like to trade those in now?";
	next;
	menu "Sure thing!",L_sure,"No, thanks",L_close;
L_nothing:
	mes "[Marvin]";
	mes "I'm sorry, I dont believe you actually have any " +getitemname(.random_card)+ " for me.";
	close;
L_sure:
		mes "[Marvin]";
	delitem .random_card, .count;
		set #CEDIPOINTS, #CEDIPOINTS + ( .random_reward * .count );
	mes "Thanks! These will look great in my collection. Oh, and you seem to have a balance of " +#CEDIPOINTS+ " Cedi now.";
		dispbottom "You now have " +#CEDIPOINTS+ " Cedi Points.";
		close;
L_close:
	mes "[Marvin]";
	mes "Alright, if you change your mind, come back and see me.";
	close;
OnMinute00:
		if ( ( gettime(3) % 2 ) != 0 ) end;
		set .index, rand( getarraysize( .set_card ) );
		set .random_card, .set_card[ .index ];
		set .random_reward, .set_reward[ .index ];
	end;
 OnInit:
		setarray .set_card[0],4001,4002,4003,4004,4005;
		setarray .set_reward[0],20,20,50,50,50,50;

		set .npc$, strnpcinfo(1);
		set .index, rand( getarraysize( .set_card ) );
		set .random_card, .set_card[ .index ];
		set .random_reward, .set_reward[ .index ];
		end;
}

This one is working on my test server.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

I don't have my laptop now for testing. So i suggest that you test this first before deployment on your server if any :

prontera,150,150,0    script    Sample    100,{
    OnMinute00:
        if ( ( gettime(3) % 2 ) > 0 ) end;
        set .index, rand( getarraysize( .Cards ) );
        set .random_card, .Cards[ .index ];
        set .random_reward, .Rewards[ .index ];
        announce "I need " +getitemname(.random_card)+ " card for " +.random_reward+ " premium points.",0;
        sleep 2000;
        announce "Talk to me at prontera 150 150 if you have one!",0;
        set .start, 1;
        end;
    if ( !.start ) {
        mes .npc$;
        mes "The event has not been initiated by any Game Master.";
        close;
    }
    mes .npc$;
    mes "So, " +strcharinfo(0)+ " do you have " +getitemname(.random_card)+ "?";
    next;
    if ( select( "Yes:No" ) - 1 ) end;
    getinventorylist;
    for ( set .@i, 0; .@i < @inventorylist_count; set .@i, .@i + 1 )
        if ( @inventorylist_id[.@i] == .random_card )
            set .count, @inventorylist_amount[.@i];
    if ( !.count ) end;
    mes .npc$;
    mes "Alright then. You have " +.count+ "x " +getitemname(.random_card);
    next;
    mes .npc$:
    mes "Here is your reward!";
    delitem .random_card, .count;
    set #PREMIUMPOINTS, #PREMIUMPOINTS + ( .random_reward * .count );
    dispbottom "You now have " +#PREMIUMPOINTS+ " premium points.";
    set .start, 0;
    close;
        
    OnInit:
        setarray .Cards[0],4001;
        setarray .Rewards[0],20;
        set .npc$, strnpcinfo(1);
        end;
}

The configuration part : 

setarray .Cards[0],4001;
setarray .Rewards[0],20;

Meaning item id 4001 corresponds to 20 premium points. You can put cards and rewards as many as you want with the limitation of 128 array content only. Make sure also that the both array have the same size. Meaning if you add a card id in the .Cards array then it is mandatory to put a corresponding prize to it. Set the prize on the .Rewards array

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.03
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

is this cards that the npc needed change evey two hour with randomized cards?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Set all cards on the .Cards array and the npc will randomly get one card every 2 hrs.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.03
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

is it possible to put all the cards in game in the .cards array? i want to put all the cards there and my custom cards too...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Array in rAthena has a limitation of 128 contents

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.03
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

so is there any other way to make it? to be able to put all cards in this npc?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

You can try 

 

http://rathena.org/board/files/file/2959-xynvaroth-array/

 

or 

 

try to increase the size of array here ( src/map/script.c#L176 )

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.03
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

I don't have my laptop now for testing. So i suggest that you test this first before deployment on your server if any :

prontera,150,150,0    script    Sample    100,{
    if ( !.start ) {
        mes .npc$;
        mes "The event has not been initiated by any Game Master.";
        close;
    }
    mes .npc$;
    mes "So, " +strcharinfo(0)+ " do you have " +getitemname(.random_card)+ "?";
    next;
    if ( select( "Yes:No" ) - 1 ) end;
    getinventorylist;
    for ( set .@i, 0; .@i < @inventorylist_count; set .@i, .@i + 1 )
        if ( @inventorylist_id[.@i] == .random_card )
            set .count, @inventorylist_amount[.@i];
    if ( !.count ) end;
    mes .npc$;
    mes "Alright then. You have " +.count+ "x " +getitemname(.random_card);
    next;
    mes .npc$:
    mes "Here is your reward!";
    delitem .random_card, .count;
    set #PREMIUMPOINTS, #PREMIUMPOINTS + ( .random_reward * .count );
    dispbottom "You now have " +#PREMIUMPOINTS+ " premium points.";
    set .start, 0;
    close;

    OnMinute00:
        if ( ( gettime(3) % 2 ) != 0 ) end;
        set .index, rand( getarraysize( .Cards ) );
        set .random_card, .Cards[ .index ];
        set .random_reward, .Rewards[ .index ];
        announce "I need " +getitemname(.random_card)+ " card for " +.random_reward+ " premium points.",0;
        sleep 2000;
        announce "Talk to me at prontera 150 150 if you have one!",0;
        set .start, 1;
        end;
        
    OnInit:
        setarray .Cards[0],4001;
        setarray .Rewards[0],20;
        set .npc$, strnpcinfo(1);
        end;
}

The configuration part : 

setarray .Cards[0],4001;
setarray .Rewards[0],20;

Meaning item id 4001 corresponds to 20 premium points. You can put cards and rewards as many as you want with the limitation of 128 array content only. Make sure also that the both array have the same size. Meaning if you add a card id in the .Cards array then it is mandatory to put a corresponding prize to it. Set the prize on the .Rewards array

 

Why it does not change every two  hour the cards? and besides..

 

can you correct this one cause i change some of this in this one..

 prontera,150,150,0    script    Marvin    100,{
   
    mes "[Marvin]";
    mes "Excuse me, I was wondering if you would mind helping me. You see, I collect cards and curently I'm missing a " +getitemname(.random_card)+ ". If you could provide me with some pristine examples of this card, I can offer " +getitemname(.random_reward)+ " Cedi in return.";
    next;
    menu "What is Cedi?",L_what,"I have your cards!",L_check,"Nevermind",L_close;
L_what:    mes "[Marvin]";
    mes "Cedi is an ancient currency that is still quite valuable in the right circles. I hear Tim-Tom down the road only takes Cedi at his shop.";
    next;
    mes "[Marvin]";
    mes "How much I can give you per card varies, but I'll be sure to tell you how much I'm offering if you bring me some.";
    close;
L_check:
    if (countitem(.random_card) < 1)goto L_nothing;
    getinventorylist;
    for ( set .@i, 0; .@i < @inventorylist_count; set .@i, .@i + 1 )
        if ( @inventorylist_id[.@i] == .random_card )
            set .count, @inventorylist_amount[.@i];
       mes "[Marvin]";
    mes "Would you like to trade those in now?";
    next;
    menu "Sure thing!",L_sure,"No, thanks",L_close;
L_nothing:
    mes "[Marvin]";
    mes "I'm sorry, I dont believe you actually have any " +getitemname(.random_card)+ " for me.";
    close;
L_sure:
        mes "[Marvin]";
    delitem .random_card, .count;
        set #CEDIPOINTS, #CEDIPOINTS + ( .random_reward * .count );
    mes "Thanks! These will look great in my collection. Oh, and you seem to have a balance of " +#CEDIPOINTS+ " Cedi now.";
        dispbottom "You now have " +#CEDIPOINTS+ " Cedi Points.";
        close;
L_close:
    mes "[Marvin]";
    mes "Alright, if you change your mind, come back and see me.";
    close;
OnMinute00:
        if ( ( gettime(3) % 2 ) != 0 ) end;
        set .index, rand( getarraysize( .random_card ) );
        set .random_card, .random_card[ .index ];
        set .random_reward, .random_reward[ .index ];
    end;
 OnInit:
        setarray .random_card[0],4001,4002,4003,4004,4005;
        setarray .random_reward[0],20,20,50,50,50,50;
        set .npc$, strnpcinfo(1);
        end;
}

 

 

 

i want the random card will be change every two hour.  i add four cards to know if this work but it doesnt change and it just only requiring the first card which is the poring card (4001)....

 

in this one i have some difficulties with this because in this one i want to show the players whoever click on this npc i want to show them also that how much does the card cost.... but in my preview of this one it became the word "null"... like this:

 

Excuse me, I was wondering if you

would mind helping me. You see, I

collect cards and currently I'm

missing a Poring Card. If you could

provide me with some pristine

examples of this card, I can offer

null Cedi in return.

 

i want that null to be the cost of the card....

 

can you please correct that script i really need this one....

Edited by Capuche
-> Code!
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Edited my script. Kindly test

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.03
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

i already test your script and its the same it doesnt change the card... that is why i made a new script base on your script. pls edit my script i really need this one.

I solved it by myself..... thanks for the help anyway..

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

if you want a random card id from all the normal card you can use item_db sql in your script

select item_db.id from item_db right join mob_db on item_db.id = mob_db.dropcardid where ~mode & 32 and type = 6 group by name_japanese order by rand() limit 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.03
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

on my editted script from patskie it doest change the card every two hour i change it every 2 minutes but it doesnt change... this script is working except for changing the cards in every hour/minute. kindly pls help me with this? that is the only problem on this script. thanks.

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

 prontera,150,150,0    script    Marvin    100,{
   
    mes "[Marvin]";
    mes "Excuse me, I was wondering if you would mind helping me. You see, I collect cards and curently I'm missing a " +getitemname(.random_card)+ ". If you could provide me with some pristine examples of this card, I can offer " +getitemname(.random_reward)+ " Cedi in return.";
    next;
    menu "What is Cedi?",L_what,"I have your cards!",L_check,"Nevermind",L_close;
L_what:    mes "[Marvin]";
    mes "Cedi is an ancient currency that is still quite valuable in the right circles. I hear Tim-Tom down the road only takes Cedi at his shop.";
    next;
    mes "[Marvin]";
    mes "How much I can give you per card varies, but I'll be sure to tell you how much I'm offering if you bring me some.";
    close;
L_check:
    if (countitem(.random_card) < 1)goto L_nothing;
    getinventorylist;
    for ( set .@i, 0; .@i < @inventorylist_count; set .@i, .@i + 1 )
        if ( @inventorylist_id[.@i] == .random_card )
            set .count, @inventorylist_amount[.@i];
       mes "[Marvin]";
    mes "Would you like to trade those in now?";
    next;
    menu "Sure thing!",L_sure,"No, thanks",L_close;
L_nothing:
    mes "[Marvin]";
    mes "I'm sorry, I dont believe you actually have any " +getitemname(.random_card)+ " for me.";
    close;
L_sure:
        mes "[Marvin]";
    delitem .random_card, .count;
        set #CEDIPOINTS, #CEDIPOINTS + ( .random_reward * .count );
    mes "Thanks! These will look great in my collection. Oh, and you seem to have a balance of " +#CEDIPOINTS+ " Cedi now.";
        dispbottom "You now have " +#CEDIPOINTS+ " Cedi Points.";
        close;
L_close:
    mes "[Marvin]";
    mes "Alright, if you change your mind, come back and see me.";
    close;
OnMinute00:
        if ( ( gettime(3) % 2 ) != 0 ) end;
        set .index, rand( getarraysize( .set_card ) );
        set .random_card, .set_card[ .index ];
        set .random_reward, .set_reward[ .index ];
    end;
 OnInit:
        setarray .set_card[0],4001,4002,4003,4004,4005;
        setarray .set_reward[0],20,20,50,50,50,50;

        set .npc$, strnpcinfo(1);
        set .index, rand( getarraysize( .random_card ) );
        set .random_card, .set_card[ .index ];
        set .random_reward, .set_reward[ .index ];
        end;
}

the random card variable was the same as the setting card array

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.03
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

it doesnt change the card every 2 hour..



everything is settle on this script except for automatically changing the cards every minute/hour...

 

please help me i really wanted this script to be done..



please anyone solve this the only problem is it doesnt automatically change the card every 2 hour.. anyone please fix this problem. my head is cracking for trying to know how to solve this. im not that good in scripting please help me..



no one knows???
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.03
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

no its not working... it does not automatically change the card once the defined hour has reach its just stick on the first card which is the poring card, 

 

u wanted the card will be automatically changed.



once i unload and reload the script there it change the card but now automatically.



okay i have found the answer bymyself. thanks for the help patskie and capuche your script helps me alot to fix this problem your the best.....

 

it change automatically.. thanks again...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...