Jump to content
  • 0
Sign in to follow this  
utofaery

H>How to make it report actual sold item count?

Question

I need help to make this npc work correctly to tell how much item count it has sell.

Spoiler

prontera,164,175,4    script    Mass Junk Seller    1_M_MERCHANT,{
    .@x = 0;
    getinventorylist();
    for ( set .@i,0; .@i < @inventorylist_count; set .@i,.@i + 1) {
        // Check if the Item Type is in the ignore list
        if(getiteminfo(@inventorylist_id[.@i],2) == 3 ) {
            setarray .@sellid[getarraysize(.@sellid)],@inventorylist_id[.@i];
        }
    }
    mes (.n$);
    if(getarraysize(.@sellid) > 0) {
        for ( set .@s,0; .@s < getarraysize(.@sellid); set .@s,.@s + 1) {
            set .@total,.@total + (getiteminfo(.@sellid[.@s],1)*countitem(.@sellid[.@s]));
            delitem2 .@sellid[.@s],countitem(.@sellid[.@s]),1,0,0,0,0,0,0;
            .@x = .@x + 1;//this one is not working correctly
        }
        mes ("Your items were sold.");
        mes ("and you received "+.@total+" Zeny.");
        mes ("for "+.@x+" Item Count");//Part I need help to fix.
        set Zeny,Zeny + .@total;
    } else {
        mes ("No Items were sold,");
        mes ("therefore you don't");
        mes ("receive any Zeny.");
    }
    close2;
    end;
}

 

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0
prontera,155,185,4	script	Mass Junk Seller	1_M_MERCHANT,{
	disable_items;
	getinventorylist;
	for ( .@i = 0; .@i < @inventorylist_count; ++.@i ) {
		if ( getiteminfo( @inventorylist_id[.@i], ITEMINFO_TYPE ) == IT_ETC ) {
			.@id[.@c] = @inventorylist_id[.@i];
			.@amount[.@c] = @inventorylist_amount[.@i];
			.@zeny_total += getiteminfo( .@id[.@c], ITEMINFO_SELLPRICE ) * .@amount[.@c] *(100 + .Overcharge[ getskilllv(MC_OVERCHARGE)] )/100;
			++.@c;
		}
	}
	if ( !.@c ) {
		mes "you don't have any items to sell";
		close;
	}
	mes "Are you sure selling :";
	for ( .@i = 0; .@i < .@c; ++.@i )
		mes .@amount[.@i] +"x "+ getitemname(.@id[.@i]);
	mes "for "+ F_InsertComma(.@zeny_total) +" Zeny ?";
	next;
	if ( select( "Yes", "No" ) == 2 ) close;
	if ( Zeny + .@zeny_total > MAX_ZENY ) {
		mes "You can't carry that much Zeny.";
		close;
	}
	for ( .@i = 0; .@i < .@c; ++.@i )
		delitem .@id[.@i], .@amount[.@i];
	mes "All item sold for "+ F_InsertComma(.@zeny_total) +" Zeny";
	Zeny += .@zeny_total;
	close;
OnInit:
	setarray .Overcharge[0], 0, 7,9,11,13,15,17,19,21,23,24;
	end;
}

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.