Jump to content
  • 0

Item trader


vonbad

Question


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  38
  • Reputation:   1
  • Joined:  07/27/12
  • Last Seen:  

requesting for NPC that trades item like 10TCG for 1PODS, and can indicate how many PODS do they want like coin exchanger

Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  276
  • Reputation:   24
  • Joined:  07/06/13
  • Last Seen:  

I think i know whats your problem in chromus post: Use TABS

prontera,158,204,4<TAB>script<TAB>TCG Shop<TAB>98,{

If no appearing try mine:

http://rathena.org/board/topic/86137-item-trader/?p=216167

And also try icetie post.

Congrats you got lot of options!. :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  91
  • Topics Per Day:  0.02
  • Content Count:  263
  • Reputation:   1
  • Joined:  04/25/13
  • Last Seen:  

requesting for NPC that trades item like 10TCG for 1PODS, and can indicate how many PODS do they want like coin exchanger

prontera,158,204,4 script TCG Shop 98,{
mes .name$;
mes "You currently have "+countitem(.tcg_item)+" TCG.";
mes "Would you like to look at the shop?";
next;
if(select("Yes:No") == 2) {
close;
}
close2;
callshop "TCG_SHOP",1;
npcshopattach "TCG_SHOP";
dispbottom "You currently have "+countitem(.tcg_item)+" TCG.";
end;

OnBuyItem:
for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {
for(set @j,0; @j < getarraysize(.TCG_ITEMS); set @j,@j+2) {
if(.TCG_ITEMS[@j] == @bought_nameid[@i]) {
set @itemcost,(.TCG_ITEMS[(@j+1)]*@bought_quantity[@i]);
set @totalcost,(@totalcost+@itemcost);
break;
}
}
}
if(@totalcost > countitem(.tcg_item)) {
dispbottom "You don't have enough TCG.";
}
else {
for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {
getitem @bought_nameid[@i],@bought_quantity[@i];
}
delitem .tcg_item,@totalcost;
dispbottom "Thank you for shopping.";
dispbottom "You now have "+countitem(.tcg_item)+" TCG left.";
}
set @totalcost,0;
deletearray @bought_nameid[0],128;
deletearray @bought_quantity[0],128;
end;

OnInit:
npcshopdelitem "TCG_SHOP",909; // Leave this alone
set .name$,"[TCG Trader]";
set .tcg_item,7227; // Input TCG ID
setarray .TCG_ITEMS[0],12246,40; // Input as many items as you want (item::price)



for(set .@i,0; .@i < getarraysize(.TCG_ITEMS); set .@i,.@i+2) {
npcshopadditem "TCG_SHOP",.TCG_ITEMS[.@i],.TCG_ITEMS[(.@i+1)];
}
}
- shop TCG_SHOP -1,909:1

 

 

 

here just edit the line >> setarray .TCG_ITEMS[0],12246,40; // Input as many items as you want (item::price) 

into >>  setarray .TCG_ITEMS[0],7179,10; // Input as many items as you want (item::price)

 

it will gonna trade for 10TCG for 1 PoDs

Edited by Capuche
bbcode
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  276
  • Reputation:   24
  • Joined:  07/06/13
  • Last Seen:  

Im new to scripting it may not work but this will show you the main idea. Please try it first hide the npc or put in your test server. I haven't tested it because im not home yet, idk if it will work but please tell me. If im mistaking please do correct me.

Edited:

Tested and its working. Please tell me if there is bug.

prontera,150,150,0    script    PODS&&TCG    719,{
    set @name$,"^FF0000Trader^000000";
    mes @name$;
    mes "What do you want to do?";
    next;
    switch(select("Information","Convert")) {
        case 1:
            mes @name$;
            mes "I can convert your TCG CARDS into POD and vice versa.";
            mes "10 TCG CARD = 1 PODS";
            close;
        case 2:
            switch(select("TCG CARDS to POD","POD to TCG CARDS")) {
             case 1:
              mes @name$;
              mes "How many POD you want to have?";
              input .@item_count ;
              if( .@item_count == 0 ) close;
                    if (countitem(7227) < (.@item_count*10)) goto noTCG;
                    if (checkweight(7179,100) == 0 ) goto overWeight;
                    delitem 7227,(.@item_count*10);
                    getitem 7179,.@item_count;
                    next;
                    mes @name$;
              mes "There you go! You got your " + .@item_count + " PODS.  Hope to see you again!";
                    close;
                case 2:
              mes @name$;
              mes "How many TCG CARDS you want to have?";
              input .@item_count;
              if( .@item_count == 0 ) close;
                    if (checkweight(7227,35) == 0 ) goto overWeight;
                    if (countitem(7179) < (.@item_count/10)) goto noPods;
                    delitem 7179,(.@item_count/10);
                    getitem 7227,.@item_count;
                    next;
              mes @name$;
                    mes "There you go! You got your " + .@item_count + " TCG. Hope to see you again!";
                    close;
    }
            }
OnInit:
        waitingroom "PODS TRADER",0;  // WITH WAITING ROOM
end;

noPODS:
    next;
    mes @name$;
    mes "I'm Sorry but you don't have enough PODS.";
    close;

noTCG:
    next;
    mes @name$;
    mes "I'm Sorry you don't have enough TCG";
    close;
    
overWeight:
    next;
    mes @name$;
    mes "Sorry you're overweight.";
    close;
}}
Edited by Lil Troll
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  38
  • Reputation:   1
  • Joined:  07/27/12
  • Last Seen:  

requesting for NPC that trades item like 10TCG for 1PODS, and can indicate how many PODS do they want like coin exchanger

prontera,158,204,4 script TCG Shop 98,{

mes .name$;

mes "You currently have "+countitem(.tcg_item)+" TCG.";

mes "Would you like to look at the shop?";

next;

if(select("Yes:No") == 2) {

close;

}

close2;

callshop "TCG_SHOP",1;

npcshopattach "TCG_SHOP";

dispbottom "You currently have "+countitem(.tcg_item)+" TCG.";

end;

OnBuyItem:

for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {

for(set @j,0; @j < getarraysize(.TCG_ITEMS); set @j,@j+2) {

if(.TCG_ITEMS[@j] == @bought_nameid[@i]) {

set @itemcost,(.TCG_ITEMS[(@j+1)]*@bought_quantity[@i]);

set @totalcost,(@totalcost+@itemcost);

break;

}

}

}

if(@totalcost > countitem(.tcg_item)) {

dispbottom "You don't have enough TCG.";

}

else {

for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {

getitem @bought_nameid[@i],@bought_quantity[@i];

}

delitem .tcg_item,@totalcost;

dispbottom "Thank you for shopping.";

dispbottom "You now have "+countitem(.tcg_item)+" TCG left.";

}

set @totalcost,0;

deletearray @bought_nameid[0],128;

deletearray @bought_quantity[0],128;

end;

OnInit:

npcshopdelitem "TCG_SHOP",909; // Leave this alone

set .name$,"[TCG Trader]";

set .tcg_item,7227; // Input TCG ID

setarray .TCG_ITEMS[0],12246,40; // Input as many items as you want (item::price)

for(set .@i,0; .@i < getarraysize(.TCG_ITEMS); set .@i,.@i+2) {

npcshopadditem "TCG_SHOP",.TCG_ITEMS[.@i],.TCG_ITEMS[(.@i+1)];

}

}

- shop TCG_SHOP -1,909:1

 

here just edit the line >> setarray .TCG_ITEMS[0],12246,40; // Input as many items as you want (item::price) 

into >>  setarray .TCG_ITEMS[0],7179,10; // Input as many items as you want (item::price)

 

it will gonna trade for 10TCG for 1 PoDs

 

 

hello do you have two cases in here? like 100gold=1tcg and 10tcg=1pods in one NPC?

and sir I try you script but it doesn't appear in game? can you please check your whole script?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  91
  • Topics Per Day:  0.02
  • Content Count:  263
  • Reputation:   1
  • Joined:  04/25/13
  • Last Seen:  

 

requesting for NPC that trades item like 10TCG for 1PODS, and can indicate how many PODS do they want like coin exchanger

prontera,158,204,4 script TCG Shop 98,{

mes .name$;

mes "You currently have "+countitem(.tcg_item)+" TCG.";

mes "Would you like to look at the shop?";

next;

if(select("Yes:No") == 2) {

close;

}

close2;

callshop "TCG_SHOP",1;

npcshopattach "TCG_SHOP";

dispbottom "You currently have "+countitem(.tcg_item)+" TCG.";

end;

OnBuyItem:

for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {

for(set @j,0; @j < getarraysize(.TCG_ITEMS); set @j,@j+2) {

if(.TCG_ITEMS[@j] == @bought_nameid[@i]) {

set @itemcost,(.TCG_ITEMS[(@j+1)]*@bought_quantity[@i]);

set @totalcost,(@totalcost+@itemcost);

break;

}

}

}

if(@totalcost > countitem(.tcg_item)) {

dispbottom "You don't have enough TCG.";

}

else {

for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {

getitem @bought_nameid[@i],@bought_quantity[@i];

}

delitem .tcg_item,@totalcost;

dispbottom "Thank you for shopping.";

dispbottom "You now have "+countitem(.tcg_item)+" TCG left.";

}

set @totalcost,0;

deletearray @bought_nameid[0],128;

deletearray @bought_quantity[0],128;

end;

OnInit:

npcshopdelitem "TCG_SHOP",909; // Leave this alone

set .name$,"[TCG Trader]";

set .tcg_item,7227; // Input TCG ID

setarray .TCG_ITEMS[0],12246,40; // Input as many items as you want (item::price)

for(set .@i,0; .@i < getarraysize(.TCG_ITEMS); set .@i,.@i+2) {

npcshopadditem "TCG_SHOP",.TCG_ITEMS[.@i],.TCG_ITEMS[(.@i+1)];

}

}

- shop TCG_SHOP -1,909:1

 

here just edit the line >> setarray .TCG_ITEMS[0],12246,40; // Input as many items as you want (item::price) 

into >>  setarray .TCG_ITEMS[0],7179,10; // Input as many items as you want (item::price)

 

it will gonna trade for 10TCG for 1 PoDs

 

 

hello do you have two cases in here? like 100gold=1tcg and 10tcg=1pods in one NPC?

and sir I try you script but it doesn't appear in game? can you please check your whole script?

it's fine with me..did you put it too on script_custom.conf? 

if u put it already.. try to Example>>@loadnpc npc/npc/TCG.txt then @reloadscript

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   0
  • Joined:  10/06/12
  • Last Seen:  

Try this. Haven't tested it yet. But i'm pretty sure it'll work ^^,

 


Edited by IceTea
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  38
  • Reputation:   1
  • Joined:  07/27/12
  • Last Seen:  

thanks guys.^_^ Im now using Ice tea's link that he gave me, working but you need to have Lil troll advice for it to work. thanks again. done

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...