Jump to content
  • 0

Basic Item exchange NPC


Question

Posted

Hello I need a NPC that allows player to exchange item A to item B, and vice versa.

The NPC needs two options, a player can trade 1 itemA for 8 itemB.
Or trade 10 itemB for 1 item A.

The player must also be able to tell how many they want to exchange with a input box. If the players says they want to exchange 7 item A's, then the NPC will check to make sure they have enough then remove those items from the players inventory and give them 56 (8*7) item B. The same for when trading from item B -> item A.

 

You can use any placeholder item id for both of the item A and B. I will change it to my custom item later when I have decided on the item ID.

 

Hopefully I explained that well enough.

Any help is appreciated, thanks.

3 answers to this question

Recommended Posts

Posted (edited)

Yes they are different. The reason for this is that item A is not tradable but B is, so if players want to trade their item A's they need to exchange them at a lower rate to item B.

Item A -> Item B (1:8)
For every 1 item A you exchange you recieve 8 item B. (exmaple: A players gives NPC 4 Item A, they recieve 32 item B in exchange)


Item B -> Item A (10:1)

For every 10 item B you exchange you recieve 1 item A (example: A player gives NPC 30 Item B, they revieve 3 item A in exchange)

EDIT: I have managed to write the script myself. If I encounter any errors I will reply again otherwise don't worry about posting anything else in the topic for now.

Edited by windston
Posted

Maybe with this file in the svn : trunk/npc/custom/quests/quest_shop.txt

and the setting

prontera,164,203,6	script	Quest Shop#1	998,{ callfunc "qshop",1; }

 

    Add(1,501,8,0,0,502,1);
    Add(1,502,1,0,0,501,10);

 

Yes they are different. The reason for this is that item A is not tradable but B is, so if players want to trade their item A's they need to exchange them at a lower rate to item B.

Item A -> Item B (1:8)
For every 1 item A you exchange you recieve 8 item B. (exmaple: A players gives NPC 4 Item A, they recieve 32 item B in exchange)


Item B -> Item A (10:1)

For every 10 item B you exchange you recieve 1 item A (example: A player gives NPC 30 Item B, they revieve 3 item A in exchange)
 

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