Weirdly enough, when I try to sell a single card, the NPC displays the message "Deal Completed", but when I sell 2 types of cards, the deal is completed with no message. If I try to sell 3 or more type of cards, only 2 of then are effectively sold.
I need a clean script that fulfills the same function.
Question
lttrmn
Good evening,
So... Weeks ago, here in the forums, I found a very useful script of a NPC who can trade itens for cashpoints.
Even knowing nothing about what was happening in this particular script, I did some changes and it is partially functional for my purposes now.
The NPC calls directly for a SELL window, as I wished. The problem now is:
The script seems to have an uncecessary amount of content, which probably causes the player to sell only 2 types of card at a time.
- shop exg_exp -1,501:50.
prontera,161,185,3 script Card Dealer 10187,{
callshop "exg_exp",2;
npcshopattach "exg_exp";
end;
OnSellItem:
if( !getarraysize(.@choice$) )
setarray .@choice$, "@sold_", "sold", "1", "@delitem";
.@len = getarraysize(getd(.@choice$+"nameid"));
for ( .@i = 0; .@i < .@len; .@i++ ) {
if( .@choice$[1] == "sold" ) {
if ( countitem(@sold_nameid[.@i]) < @sold_quantity[.@i] || @sold_quantity[.@i] <= 0 ) {
mes "Something went wrong!";
close;
}
} else {
if ( @bought_quantity[.@i] <= 0 ) {
mes "Something went wrong...";
close;
}
}
for ( .@a = 0; .@a < .len; .@a = .@a + 2 ) {
if( getd(.@choice$+"nameid["+.@i+"]") == .item_base[.@a] ) {
if ( #CASHPOINTS < .item_base[.@a+1] * @bought_quantity[.@i]
&& .@choice$[1] != "sold" ) {
mes "You have insufficient cashpoints.";
close;
}
atcommand .@choice$[3]+" "+.item_base[.@a]+" "+getd(.@choice$+"quantity["+.@i+"]");
.@cashpoints = ( getd(.@choice$+"quantity["+.@i+"]") * .item_base[.@a+1] ) * atoi(.@choice$[2]);
#CASHPOINTS = #CASHPOINTS + .@cashpoints;
dispbottom getitemname(.item_base[.@a]) +" x"+ getd(.@choice$+"quantity["+.@i+"]") +" "+ .@choice$[1] +" for "+ .@cashpoints +" CASHPOINTS!";
}
}
}
deletearray getd(.@choice$+"quantity");
deletearray getd(.@choice$+"nameid");
mes "Deal completed.";
close;
OnInit:
setarray .item_base, 4001, 3, 4006, 3, 4002, 3;
.len = getarraysize(.item_base);
npcshopdelitem "exg_exp",501;
for ( .@a = 0; .@a < .len; .@a = .@a + 2 )
npcshopadditem "exg_exp",.item_base[.@a],.item_base[.@a+1];
}
Weirdly enough, when I try to sell a single card, the NPC displays the message "Deal Completed", but when I sell 2 types of cards, the deal is completed with no message. If I try to sell 3 or more type of cards, only 2 of then are effectively sold.
I need a clean script that fulfills the same function.
Thanks in advance.
Edited by lttrmnLink to comment
Share on other sites
0 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.