![]() |
NPC buy limit - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Submissions (/Forum-Script-Submissions) +--- Thread: NPC buy limit (/Thread-NPC-buy-limit) Pages: 1 2 |
NPC buy limit - Staff_Stanic - 11-28-2013 01:27 AM Sometimes a player sell a lot of items to the same vendor, without any problem or wait for something. This script "lock" the vendor for some time, so he can't buy anything from players while locked and the player will have to find another NPC to sell his things. Code: ////////////// Script by: Stanic - Daniel Barbosa Maranhão - Email: pikulinhu@hotmail.com | Skype: daniel.bmaranhao RE: NPC buy limit - amonvangrell - 11-28-2013 05:22 AM Thanks! RE: NPC buy limit - XuN - 11-28-2013 07:50 AM Kinda usefull for RP shards, good job ![]() RE: NPC buy limit - Khaos - 11-28-2013 04:31 PM Code: [DEFNAME VendorsEconomy] Funny, everyone congratulated you on your script but didn't notice it is missing a key element. *smh* Code: tag0.sellstock What is the relevance of this tag on the vendor for every purchase but not the one item type in general? If argn1 > <VendorMaxSell> which you check for.. why are you testing if they are equal? Also... your tag relies on the sale of any item and doesn't record that item being sold; just a total in general. So he/she will only buy 'x' of ANY item and that is it. Was this desired? Plus I am finding your script contradictory. I am working on a rework now. Here is the rework: Code: [defname vendorseconomy] Now in the above script I am sticking to your vendor only buying "x" items. I see where you are coming from with that to a point. I fixed all of your redundancies and contradictions as well. ARGS wasn't needed in the function; just ARGN since it was storing a #. I chose to use two different IF statements to try and exit the code as fast as possible without parsing the extras. If the purchase goes through it will add to the tag0.sellstock. Before you argue you tested this... there is no way you tested the (==) parsing you did above. If the player was selling wares == to what the vendor could hold, then the sale would be successful. Also there was no reason to check what the max items the vendor can hold from the def. That is pointless if he was only able to carry say 50 from the local. Telling the player they could for instance sell 500 from the def would have left them confused and complaining about a bug. Also I'd like to note this is firing on EVERY item sold. Not just the entire lot at once. ACT is the item in question. Just so you know how often this is actually firing. RE: NPC buy limit - Staff_Stanic - 11-29-2013 03:01 AM (11-28-2013 04:31 PM)Khaos Wrote: If argn1 > <VendorMaxSell> which you check for.. why are you testing if they are equal?If <ARGN1> is > then <LOCAL.MaxAmount> this mean that the player is trying to buy more that the npc can sell. The script have 3 situations (Consider "SERV.VendorMaxSell = 50", for example): 1. The player try to buy more than 50 items when the NPC is "restocked": Code: Sorry <NAME>, I don't want to buy all these items. Give me <SERV.VendorMaxSell> and we both will be satisfied! Code: Sorry <NAME>, my stock of items is almost full and I can only carry with me more <dLOCAL.MaxAmount> items. Code: Sorry <NAME>, my stock of items is full and I can't take more anything with me. The script simulates that the Vendor is heavy and can't hold more anything, so the tag relies on the sale of any item because this was the prupose of this script. ![]() RE: NPC buy limit - Khaos - 11-29-2013 07:56 AM Just test what I sent through. Trust me. It fixed it. Calling for the ddef was not even logical if your max limit was set by 100 in a local and serv was 5000. The == line was also odd and unneeded. Several of us looked at the code and agreed something was off. Your script is still missing the def for maxitems in the ddef. I upgraded it even more on my end. I literally just about rewrote the entire thing, cut out that == check (which was a bad check) and added in checks for stolen items, new markup tags (custom mathematics to be a bit more accurate). removed nested IF's (which I showed above and is better to do in most cases). Quote:@ItemSell Has nothing to do with a vendor selling anything to a player. It works as the player is selling things to the vendor. Again... TRY my script. It will fix the issues which I laid out that you aren't understanding it seems. RE: NPC buy limit - Khaos - 11-30-2013 12:26 PM Here is an updated and improved version of this script without the need of the redundancies. Stanic's NPC BUY LIMIT REWORKED AND IMPROVED. RE: NPC buy limit - amonvangrell - 01-19-2014 10:23 AM Gr8 work Stanic and Khaos! I'm going to use this.. ;] RE: NPC buy limit - kn4tseb - 09-19-2014 04:27 AM hey guys, i was checking this script and i have a doubt whats the tag.markup for??? never read of it, only for tag.vendormarkup ... thanks. Spoiler (Click to View) RE: NPC buy limit - Extreme - 09-19-2014 06:34 AM // If the vendor has a markup price; this will reduce the pricing accurately. if (<argo.tag.markup> > 0) && (<argo.tag.vendormarkup> == 0) argn2=(<argn2> - <muldiv <argn2>,<argo.tag.markup>,100>) endif |