Jump to content
  • 0

@REQUEST npc that will shop a player item


Noturn

Question


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  38
  • Reputation:   1
  • Joined:  11/18/13
  • Last Seen:  

Hello everyone, I will try to describe it as simple as I can.

 

 

1. The npc will show a option to take one item from the player for some zeny as payment. After this, the NPC will ask how much zeny the player want to sell that item and it will sell item for all the server.

 

2. Also, it will show a option to player, to take the item back

 

3. Some money will be required depending on the number of days that the NPC will stay with item. Example: 1 day: 500z; 2 days 1500z...

 

 

In other words, it's a NPC that will take your item and sell it for all the server, like a shop. Showing information about who belongs that item, and, of course giving the money of negociation to the player.

 

Sorry bad english. /sry

 

/thx  /thx  /thx

 
Link to comment
Share on other sites

17 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  59
  • Reputation:   4
  • Joined:  11/20/12
  • Last Seen:  

There is a system called Auction that works like that

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

In fact there are some script commands like 'npcshopitem', 'npcshopadditem' and 'npcshopdelitem' which could allow you to do so.

Making an invisible shop and using the npcshopattach func would allow you to give money back to the seller using OnBuyItem label

 

But there are still a few problems:

-You can't create the NPCs so you would have to place a limited amount of NPCs in a defined area.

-I don't know a convenient way to choose the items you want to sell other than inputting the ids and this can be really boring.

 

Even so there's also a good advantage:

-You can sell as many items as you want using npcshopadditem when an item is sold.

-And of course you don't have to sell items yourself.

 

This is something I've been wanting to do for a while so I'll try to make something for you.

But I want to make it the most convenient possible so I'll try to make something really good and so I'll need time to.

 

Sorry for my english too  /sry

Edited by Kurofly
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

Hello there, me again  :rolleyes:

 

I tried out a few things today and everything I wanted to do worked fine so that's cool for you ^^

 

Now here is what I plan to do:

 

-In a defined area and if the amount of shops doesn't exceed a certain value, a player can create his own autoshop by using the command '@shop'.

-He'll select the items he wants to sell by selling them to a fake shop which then ask him how much he wants to sell each item.

-Once done, the shop will be created in the current location of the player and players will be able to buy the items.

-You can give your shop a name since players have to click on the waiting room just above the shop to enter it.

-Of course you can manage your shop by adding, deleting items or changing their prices by clicking it or using commands like '@shopadd' or '@shopchange'

 

However, I still have a few problems:

 

-Players can't see how many of each item can be bought, they'll only be warned if they buy too much

-I don't have a nice sprite for the shop npc

-Normally you can't sell refined or slotted items. I can solve this problem but if I do, I'll have no way to inform players the current item is slotted or refined.

 

*Using this system, I can also add a '@whosells' commands which would list the shops selling a particular item.

Edited by Kurofly
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

Hi again (if there's still somebody :rolleyes: ).

Work in progress...

post-27270-0-11415800-1428867137_thumb.jpg

post-27270-0-74060300-1428867139_thumb.jpg

post-27270-0-89226900-1428867142_thumb.jpg

post-27270-0-06785200-1428867146_thumb.jpg

post-27270-0-56473000-1428867148_thumb.jpg

post-27270-0-76247000-1428867151_thumb.jpg

 

Don't hesitate to give your opinions/suggestions.

And I really need a sprite for the shop NPC.

 

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  38
  • Reputation:   1
  • Joined:  11/18/13
  • Last Seen:  

WOW WOW WOW WOW WOW WOW WOW WOW 

 

It's really good, but I have some questions about the npc.

 

1- Can I sell just itens? Or it's because you don't have any equip in the game?

 

2- Will be one npc per player? Did you try bought the item with another account and the current zeny of negociation goes to you after this?

 

 

About the sprite, don't worry, I will make something to call the npc by one @command.

 

But its becoming really really really good, I appreciate your job, thanks

 

 

~google translator~        :/

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

Ty, appreciate it  /no1

 

Of course you can sell equips xD but you can't sell slotted or refined equips because there's no way to dispay it properly in the shop.

 

There will be a defined amount of shops available (as many as you want) and once a player uses '@shop' command, a shop will be given to him.

So the shops own to no one, once the time limit is exceeded it becomes free again.

 

You will also have the possibility of making the shop creation paying or/and add a taxe on the items you sell.

 

It's gonna take some more time because I don't have much time to script these days and because of the few details below :

 

-When the scripts are reloaded, every items in every shops go back to their respective owners

 if some players aren't logged in at this moment, they'll get these items back on relog.

 

-If a shop's owner isn't connected when he sells an item, he'll get his money on relog.

 

-If a player is disconnected on his shop's deletion, he'll get the items he didn't sell on relog and money for the items he sold on relog too.

 

These three things are gonna be a pain to script because I'll need to make use of global array variables using A LOT of getd() funcs so first I need to make sure all of the unused variables are erased and, plus, it makes my eyes bleeding and my brain melt  :lol:

 

Don't hesitate to give me your opinions/suggestions and to tell me want you want to add in this.

 

Ps: I still need a sprite for the shops because this one actually stinks ^^

 

More power !

Edited by Kurofly
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

 

These three things are gonna be a pain to script because I'll need to make use of global array variables using A LOT of getd() funcs so first I need to make sure all of the unused variables are erased and, plus, it makes my eyes bleeding and my brain melt  :lol:

What about mysql? I believe it would be more efficient

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

It would indeed be the best idea but I'm not used to mysql and it wouldn't be more reader-friendly.

It's almost done anyway so no need to bother anymore.

 

Ty for your advice, appreciate it /no1

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

Hey there, I'm back again  B)

 

I managed to get the hardest part over with some days ago and I'm now working on the details.

So it's almost done and you will probably have it tomorrow or tuesday in worst case.

 

Here is the log:

//= 1.0 first version :
// -player creates his shop by using the '@shop' command
// -possibility to add a cost to the shop creation and a tax to the items sold, PLEASE REFER TO THE "ADDING SHOPS" PART IF YOU WANT TO ADD SHOPS
// -if you are the owner of a shop and buy an item in it, you won't have to pay the tax
// -player can manage his shop by clicking on it or using the '@shopadd' , '@shopdel' , '@shopcancel' commands
// -any owner of any shop can log in and out at any moment, he'll always get his money and items in case he sold something and/or his shop was deleted
//
//= things to do:
// -modify '@shopadd' in case player already sells this item and either it's an equip or or consummable
// -modify '@shopdel' in case player wants to delete equips
// -adding '@shopmod <item id> <new price>' command
 
and a few screenshots:
post-27270-0-15296800-1429389723_thumb.jpg
post-27270-0-71832700-1429389810_thumb.jpg
post-27270-0-03932900-1429389819_thumb.jpg
post-27270-0-48182000-1429389826_thumb.jpg
*here the shop displays 100z but I fixed the problem already*
post-27270-0-48790100-1429389833_thumb.jpg
post-27270-0-98332500-1429389839_thumb.jpg

Ok it's done ! B)

 

shop.txt

shop.txt gave you my previous save sry^^ 

 

I got rid of the non-essentials commands so you only have to remember the '@shop' command.

If you don't have a shop the '@shop' command will create you one and if you already own a shop this command will make you able to manage it.

 

Don't forget to edit this part:

-	script	ShopManager	-1,{
function GetShop ; function CheckOwner ; function CheckNumber ; function SetShop ; function AddToShop ; function CheckShopBound ; function GiveItemsBack;

OnInit:
//===========================player setuo=========================
	.ShopAmount = 10; //amount of shops availables
	.TimeDelay = 24; //amount of time a shop will last (in hours)
	.Cost = 1000; //Cost to create a shop
	.Tax = 10; //tax deducted from sales (in percent)
//=======================end of player setup======================

Currently there are 10 shops but if you want to add more, please refer to this part :

/*=============================================ADDING SHOPS==================================================================
						*if you want to add more shops, please refer to this part:*

1)copy paste this >> -	shop	Subshop<NUMBER OF YOUR SHOP>	-1,512:-1

2)copy paste this V V (you can place the shop wherever you want since it'll be warped on player location)
<SHOP LOCATION>,<X>,<Y>,4	script	Shop#<NUMBER OF YOUR SHOP>	464,{
	@BuyingShopSpec = 1;
	callshop "Subshop"+strnpcinfo(2),1;
	end;
	
OnBuyItem:
	callfunc "BuyItem",getcharid(3,strcharinfo(0)),strnpcinfo(2);
	end;

OnInit:
	npcshopattach "Subshop"+strnpcinfo(2);
	disablenpc strnpcinfo(3) ; setd "$Shop"+strnpcinfo(2)+"enable" , 0;
	end;

OnEnable:
	enablenpc strnpcinfo(3) ; setd "$Shop"+strnpcinfo(2)+"enable" , 1;
	unitwarp getnpcid(0) , .map$ , .x , .y;
	waitingroom .shopname$,0;
	end;
}

3)edit the '.ShopAmount' var in the player setup >> .Shopamount = <AMOUNT OF SHOPS>

===========================================END OF ADDING SHOPS=============================================================*/
 

Hope you'll enjoy  /no1

shop.txt

Edited by Kurofly
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  38
  • Reputation:   1
  • Joined:  11/18/13
  • Last Seen:  

@Kurofly, thanks a lot for your time and disposal to help me. I look superficially to the script today and didn't test yet cause I don't have much time these days, but it's exactly what I want. ty :*

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

No problem noturn, I've been wanting to do something of that kind for a while now and the fact that you asked for it motivated me so that's a good thing.

When you have time please test it and report any bug you find, i had a lot of troubles doing it so I guess it may still have bugs.

 

Have a good time with it  ;)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  91
  • Reputation:   22
  • Joined:  10/24/14
  • Last Seen:  

Oo the time before auctioneer came :D

 

+1 Very nice script. Good if you need to use custom payment methods for selling stuff.

 

But with Zeny involved, i see it as an normal auction just like said.

mes "Close this window to open the Auction window.";
close2;
openauction;
end;

And give commands to players? @auction to open it.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

I can't find any informations about this auction system. When i type @auction it tells me "auction system is disabled".

Do you have a link or something?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  91
  • Reputation:   22
  • Joined:  10/24/14
  • Last Seen:  

I can't find any informations about this auction system. When i type @auction it tells me "auction system is disabled".

Do you have a link or something?

 

Um.. it should be in conf/battle/feature.conf

// Auction (Note 1)
// Feature became unstable on clients 2012 onwards (exact date not known),
// it has been fixed on clients 2013-05-15 onwards however.
feature.auction: on
Edited by Sehrentos
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

Oh cool I'll check that out as soon as I go back home.

Ty

Edited by Kurofly
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

Hmm.

I looked for the feature in features.conf but mine is marked enabled but it still tells me auction system disabled in game  :huh:

 

EDIT: this feature is not stable on 2012-04-10 packetever that's why it's being disabled. I'll maybe change it later to also use the iteminfo

Edited by Kurofly
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  387
  • Reputation:   60
  • Joined:  10/08/13
  • Last Seen:  

Hey there, I'm back again  B)

 

I managed to get the hardest part over with some days ago and I'm now working on the details.

So it's almost done and you will probably have it tomorrow or tuesday in worst case.

 

Here is the log:

//= 1.0 first version :
// -player creates his shop by using the '@shop' command
// -possibility to add a cost to the shop creation and a tax to the items sold, PLEASE REFER TO THE "ADDING SHOPS" PART IF YOU WANT TO ADD SHOPS
// -if you are the owner of a shop and buy an item in it, you won't have to pay the tax
// -player can manage his shop by clicking on it or using the '@shopadd' , '@shopdel' , '@shopcancel' commands
// -any owner of any shop can log in and out at any moment, he'll always get his money and items in case he sold something and/or his shop was deleted
//
//= things to do:
// -modify '@shopadd' in case player already sells this item and either it's an equip or or consummable
// -modify '@shopdel' in case player wants to delete equips
// -adding '@shopmod <item id> <new price>' command
 
and a few screenshots:
*here the shop displays 100z but I fixed the problem already*

Ok it's done ! B)

 

attachicon.gifshop.txt

attachicon.gifshop.txt gave you my previous save sry^^ 

 

I got rid of the non-essentials commands so you only have to remember the '@shop' command.

If you don't have a shop the '@shop' command will create you one and if you already own a shop this command will make you able to manage it.

 

Don't forget to edit this part:

-	script	ShopManager	-1,{
function GetShop ; function CheckOwner ; function CheckNumber ; function SetShop ; function AddToShop ; function CheckShopBound ; function GiveItemsBack;

OnInit:
//===========================player setuo=========================
	.ShopAmount = 10; //amount of shops availables
	.TimeDelay = 24; //amount of time a shop will last (in hours)
	.Cost = 1000; //Cost to create a shop
	.Tax = 10; //tax deducted from sales (in percent)
//=======================end of player setup======================

Currently there are 10 shops but if you want to add more, please refer to this part :

/*=============================================ADDING SHOPS==================================================================
						*if you want to add more shops, please refer to this part:*

1)copy paste this >> -	shop	Subshop<NUMBER OF YOUR SHOP>	-1,512:-1

2)copy paste this V V (you can place the shop wherever you want since it'll be warped on player location)
<SHOP LOCATION>,<X>,<Y>,4	script	Shop#<NUMBER OF YOUR SHOP>	464,{
	@BuyingShopSpec = 1;
	callshop "Subshop"+strnpcinfo(2),1;
	end;
	
OnBuyItem:
	callfunc "BuyItem",getcharid(3,strcharinfo(0)),strnpcinfo(2);
	end;

OnInit:
	npcshopattach "Subshop"+strnpcinfo(2);
	disablenpc strnpcinfo(3) ; setd "$Shop"+strnpcinfo(2)+"enable" , 0;
	end;

OnEnable:
	enablenpc strnpcinfo(3) ; setd "$Shop"+strnpcinfo(2)+"enable" , 1;
	unitwarp getnpcid(0) , .map$ , .x , .y;
	waitingroom .shopname$,0;
	end;
}

3)edit the '.ShopAmount' var in the player setup >> .Shopamount = <AMOUNT OF SHOPS>

===========================================END OF ADDING SHOPS=============================================================*/
 

Hope you'll enjoy  /no1

Nice keep it up...

 

Btw, this can be alternative auction system to the client below 2013-05-15.

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