Jump to content
  • 0

+10 Refined Item sold from the NPC


Slowbro

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  11/24/12
  • Last Seen:  

Good day rA! i cant seem to get to work the item2 from the item npc that i have. I am trying to create an NPC that sells +10 Refined items(armors, weapons,shields etc...) for a specific item like a Coin. Anybody has a script for this one? I know its simple but i cant seem to make it work.

Thanks in advance.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  806
  • Reputation:   220
  • Joined:  03/13/12
  • Last Seen:  

item2? do u mean =>

*getitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};

*getitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

with dynamic menu

prontera,156,181,5    script    jfhdksfjhs    100,{
   mes "select an item to buy";
   next;
   .@s = select( .menu$ ) -1;
   if ( countitem( .itemuse ) < .sellcost[.@s] ) {
       mes "not enough "+ getitemname( .itemuse );
       close;
   }
   delitem .itemuse, .sellcost[.@s];
   getitem2 .sellitem[.@s], 1,1,10,0, 0,0,0,0;
   close;
OnInit:
   setarray .sellitem, 1101, 1201, 1301;
   setarray .sellcost, 10, 20, 30;
   set .itemuse, 674;
   .@size = getarraysize( .sellitem );
   for ( .@i = 0; .@i < .@size; .@i++ )
    .menu$ = .menu$ + getitemname( .sellitem[.@i] )+" +10 [Cost -> "+ .sellcost[.@i] +"]:";
   end;
}

with dynamic shop

prontera,156,172,5    script    market    100,{
   dispbottom "You currently have "+ countitem(.itemuse) +" "+ getitemname(.itemuse);
   callshop "market2#hidden", 1;
   end;
OnBuyItem:
   if ( !@bought_quantity ) end;
   .@size = getarraysize( @bought_nameid );
   while ( .@i < .@size ) {
       .@j = 0;
       while ( @bought_nameid[.@i] != .itemid[.@j] && .@j < .shop_size ) .@j++;
       .@itemcost = .@itemcost + .itemcost[.@j] * @bought_quantity[.@i];
       .@i++;
   }
   if ( .@itemcost > countitem(.itemuse) ) {
       mes "you don't have enough "+ getitemname(.itemuse);
       close;
   }
   delitem .itemuse, .@itemcost;
   for ( set .@i,0; .@i < .@size; set .@i, .@i +1 )
       getitem @bought_nameid[.@i], @bought_quantity[.@i];
   deletearray @bought_nameid;
   deletearray @bought_quantity;
   end;
OnInit:
   setarray .itemid,1101,1201,1301,1501,1601;
   setarray .itemcost,10,20,30,40,50;
   set .itemuse, 674;

   .shop_size = getarraysize(.itemid);
   npcshopdelitem "market2#hidden", 512;
   for ( .@i = 0; .@i < .shop_size; .@i++ )
       npcshopadditem "market2#hidden", .itemid[.@i], .itemcost[.@i];
   npcshopattach "market2#hidden";
   end;
}

-    shop    market2#hidden    -1,512:10000

there are many many other ways to tackle this script ....

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  11/24/12
  • Last Seen:  

@Poporing - yea, thaks for that.

@AnnieRuru - that was lovely! much thanks to you!!

please close this thread! <3

Hi Annie!

Here's how the NPC works. (I think the Dynamic Menu is fine)

An NPC that sells, for example +10 (Headgears/Custom Sets). On the same menu (below the +10 items/same NPC), i can include +0 of the same items, the headgears and sets stuff. So its like in one/same NPC, an option to sell +10 items and a +0 items at the same time/menu list. And these items can be bought by a coin (for example) with a given amount.

I would like to add a welcome message too and a short message if they don't have the desired amount to buy the items. Can we also put @effect, once they successfully purchased an item? And lastly, can we add a Preview on the items that are sold by the NPC?

Thanks in advance!!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  11/24/12
  • Last Seen:  

BUMP!! can we re open the thread? seems that Ms. Annie is busy. /ok

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