Jump to content
  • 0

can't work "getinventorylist"


Question

Posted

I'm trying to get this NPC to check the items to make sure they are there and check zeny to make sure it's there. I can't seem to get the "getinventorylist" to work in my script no matter how I try to apply it. May anyone help me here? It keeps accepting Zeny without checking the items to make sure they are there.

//===== Heroes of Vanaheim Online =======================================
//= Item Quest
//============================================================

geffen,194,89,3	script	Astrologer	64,{

	setarray .@Items[0],501,1;
	set .@n$,"[Astrologer]";

	mes .@n$;
	if(n_ring0 == 1) {
		mes "You got them? You got them all? Terrific!";
		close; }
	mes "Oi, adventurer! I need some help.";
	next;
	if(select("What's up?:Nah.")==2) goto M_Leave;

	mes .@n$;
	mes "My magic isn't as strong enough to protect me against the new threats that dwell around...";
	next;
	mes .@n$;
	mes "Please collect some materials for me to complete my.. rock collection.";
	next;
	if(select("Okay:No time")==2) goto M_Leave;

	mes .@n$;
	mes "I'll give you this ^FF0000Night Ring^000000. !";
	next;
	mes .@n$;
	mes "Here's a list of the materials I need:";
        mes "~ 300.000.000 Zeny";
	for(set .@i,0; .@i<getarraysize(.@Items); set .@i,.@i+2) {
		mes " ~ "+.@Items[.@i+1]+"x "+getitemname(.@Items[.@i]);
		if (countitem(.@Items[.@i]) < .@Items[.@i+1]) set .@nr,1; }
	next;
	if(select("I got it all!:I'll go now.")==2) goto M_Leave;

	mes .@n$;
	if (.@nr) {
			getinventorylist .@Items[.@i], .@Items[.@i+1];
            if(Zeny < 300000000) goto Leave;
		mes "You can't trick me! Go get those items.";
		close; }
	for(set .@i,0; .@i<getarraysize(.@Items); set .@i,.@i+2)
		delitem .@Items[.@i], .@Items[.@i+1];
        set Zeny, Zeny - 300000000;
	getitem 35151,1;
        announce "Congratulations!! ["+ strcharinfo(0) +"] has finished Item quest.",0;
	set n_ring0, 1;
	mes "Great job! You have all the items. Here are your ^FF0000Item^000000, as promised.";
	emotion ET_CONGRATULATION;
	close;

Leave:
mes .n$;
mes "Don't forget those stones. They are essential! ";
next;

M_Leave:
	mes .@n$;
	mes "Someone else will help, I'm sure...";
	close;

OnInit:
waitingroom "Night Ring",0;
end;
}

 

2 answers to this question

Recommended Posts

  • 0
Posted

Hello,

Did you actuallty check the documentation?

*getinventorylist {<char_id>};

What you want to use I guess is:

*countitem(<item id>{,<accountID>})
*countitem("<item name>"{,<accountID>})

This function will return the number of items for the specified item ID that the
invoking character has in the inventory.

	mes "[Item Checker]";
	mes "Hmmm, it seems you have " + countitem(502) + " apples";
	close;

Like 'getitem', this function will also accept an 'english name' from the
database as an argument.

If you want to state the number at the end of a sentence, you can do it by
adding up strings:

	mes "[Item Checker]";
	mes "Hmmm, the total number of apples you are holding is " + countitem("APPLE");
	close;

 

  • Upvote 1
  • 0
Posted

Thanks I was able to fix it by adding this.

 

	next;
	if(select("I got it all!:I'll go now.")==2) goto M_Leave;

	mes .@n$;
	if (.@nr) {
	
			  if(countitem(.@Items[.@i], .@Items[.@i+1]) < 1) goto Leave;
            if(Zeny < 300000000) goto Leave;
			
		mes "You can't trick me! Go get those items.";
		close; }
	for(set .@i,0; .@i<getarraysize(.@Items); set .@i,.@i+2)
		delitem .@Items[.@i], .@Items[.@i+1];
        set Zeny, Zeny - 300000000;
	getitem 35151,1;

 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...