Town Vendor Npc Command Range

For ideas on how to make Second Age a better shard. Can it get any better? Maybe.
Forum rules
Posts in this forum are expected to be constructive, realistic and civil. Inflamatory or off topic posts will be removed.
Post Reply
Blackhaggie
Posts: 55
Joined: Mon Feb 02, 2009 1:15 am

Town Vendor Npc Command Range

Post by Blackhaggie »

Up until now I've only contributed a few arguments for sake of era accuracy and after being here and playing on UOSA for a while now I feel it's time for me to step up and contribute what I remember of t2a. I started playing UO during it's birth and continued through UO:R until the disappointment of trammel.

One of the few mechanics i remember of t2a was the annoyance of speaking to vendors in town. As I recall I always had to be within 1 tile of a npc to speak with them, whether it be to the side or diagonal from them. I've noticed here I can often spam my "Vendor buy bank guards!" to open my bank box and receive a list of goods from the jeweler in Britian or the mage shop in Delucia.

Now I understand it can be quite a nuisance to be 1 tile away from a vendor to even get their attention, but part of me wants to recreate the era and feel that since of nostalgia about the game . . . the way I remember it. Can anyone else remember this sort of thing? I'd like to think my memory is perfect but we all know what time can do. I have no comment on player Npcs :P

Sandro
Posts: 3906
Joined: Sat Jan 02, 2010 8:43 pm
Location: Korea

Re: Town Vendor Npc Command Range

Post by Sandro »

Yeah this is very annoying when NPC's offer to sell you things from like 15 tiles away.
[14:17] <UOSAPlayer4056> cr3w guild is a joke. Ran by staff members, multi client pking, this shards a joke and a half.
Blaise wrote:Man, you guys are really stepping up your game now that you're not living in the shadow of cr3w

User avatar
MatronDeWinter
UOSA Donor!!
UOSA Donor!!
Posts: 7249
Joined: Wed Mar 04, 2009 3:35 am
Location: 你的錢包

Re: Town Vendor Npc Command Range

Post by MatronDeWinter »

Some vendors only respond within 1 tile. (For example, Yves the blacksmith in moonglow near the bank)

But the tinkerers in the bank will sell you crap clear from the graveyard.

Light Shade
UOSA Subscriber!
UOSA Subscriber!
Posts: 2567
Joined: Sat Oct 23, 2010 12:42 pm
Location: Trammel

Re: Town Vendor Npc Command Range

Post by Light Shade »

Thread Resurrection...

I was just thinking to myself...this would fix a LOT of the AFK buying and selling of items/resources if all NPC Vendors had to be within 1 tile of you. I do remember this being the case with some NPC's and I certainly think the distances we have now need some tweaking. Either way, trimming them all down to 1 tile would certainly make it more difficult for the AFK'ers and actually reward the people that actually play the game.

I certainly think it'd be a good thing for the shard overall. Is it Era Accurate, though?

-L/S
Image
[20:08] <@Kaivan> We have a ridable Maahes in Green Acres.
[10:00] <TheBreadman> leeds did a takeover on secondage
[10:00] <@Derrick> hax


Tom: Get bad bro

Pirul
Posts: 5754
Joined: Wed Jan 27, 2010 8:19 pm
Location: New Windmere

Re: Town Vendor Npc Command Range

Post by Pirul »

Light Shade wrote:Either way, trimming them all down to 1 tile would certainly make it more difficult for the AFK'ers and actually reward the people that actually play the game.

I certainly think it'd be a good thing for the shard overall. Is it Era Accurate, though?

-L/S
Would create alot of possibilities for griefers too. Not too hard to gate in a buttload of tame cats/dogs/birds to a mageshop and completely render it useless.
Image
<ian> 2 chicks making out are not gay

Light Shade
UOSA Subscriber!
UOSA Subscriber!
Posts: 2567
Joined: Sat Oct 23, 2010 12:42 pm
Location: Trammel

Re: Town Vendor Npc Command Range

Post by Light Shade »

Pirul wrote:Would create alot of possibilities for griefers too. Not too hard to gate in a buttload of tame cats/dogs/birds to a mageshop and completely render it useless.
Anything can be griefed, heh. Regardless, they'll fun out of money eventually and it only takes an enticer to clean it up.
Image
[20:08] <@Kaivan> We have a ridable Maahes in Green Acres.
[10:00] <TheBreadman> leeds did a takeover on secondage
[10:00] <@Derrick> hax


Tom: Get bad bro

User avatar
Batlin
wobble llama
wobble llama
Posts: 512
Joined: Fri Dec 19, 2008 4:32 am
Location: Ultima Universe

Re: Town Vendor Npc Command Range

Post by Batlin »

It's been a while since I made a demo-related technical post...
Let's start...

NPC's and vendors

The vendor commands and most NPC command handlers we find in the human script.
Looking at the speech handler:

Code: Select all

trigger speech<"*">(obj speaker, string arg)
{
  ...
  if(!Q4J8(this, speaker, arg))
  {
    if(0x00) // don't show debug messages
    {
      bark(this, "Failed convo facing check");
    }
    return(0x01); // return 1 means: command has not been handled
  }
  ...
  if(!Q4M7(this, speaker, arg))
  {
    return(0x00); // return 0 means: command has been handled
  }
  ... 
The function Q4M7 is responsible for opening the selling or buying window.
That functions starts like this:

Code: Select all

function int Q4M7(obj this, obj speaker, string arg)
{
  if(!isShopkeeper(this))
  {
    return(0x01); // return 1 means: command has not been handled
  }
  loc Q4VS = getLocation(this);
  loc there = getLocation(speaker);
  if(getDistanceInTiles(Q4VS, there) > 0x03)
  {
    return(0x01); // return 1 means: command has not been handled
  }
  ...
That gives you an effective range of 3 tiles.

But wait, playing around in the demo shows that's not how it really works.
Even within 2 tiles the vendors sometimes don't respond.

That's because of the Q4J8 function which is called earlier.
That function is not inside the human script but the human_funcs script.

It's a long function (includes the code to face the NPC to the player) and pasting it here would only clutter op this post.
But these lines are important:

Code: Select all

  ...
  if(isDead(speaker))
  {
    return(0x00);
  }
  if(!canSeeObj(this, speaker))
  {
    return(0x00);
  }
  if(getDistanceInTiles(getLocation(this), getLocation(speaker)) > 0x05)
  {
    return(0x00);
  }
  ...
"canSeeObj" is OSI's Line of Sight and was implemented on this shard earlier. Decompilation and more technical mumbo jumbo, you find here : http://www.joinuo.com/forums/viewtopic.php?f=32&t=629
  • dead = no response from the banker
    no LOS = no response from the NPc
    not within 5 tiles = no response from the NPC

The banker

The banker script inherits from the human script.
It declares an additional speech event trigger to handle the specific banker commands.
That handler does not call Q4J8, instead it contains a direct check to the distance in tiles.
Thereby ignoring LOS (walls) and other tests. This gives an effective range of 8 tiles for a banker to respond to banker commands. Other commands directed to the banker still go to his base human script and follow the rules there (see above).

Code: Select all

  if(isDead(speaker))
  {
    return(0x01);
  }
  if(getDistanceInTiles(getLocation(speaker), getLocation(this)) > 0x08)
  {
    return(0x01);
  }
For banker specific commands:
  • dead = no response from the banker
    LOS = don't care
    not within 8 tiles = no response from the banker

Stablekeeper

This one is more interesting.
The complete trigger:

Code: Select all

trigger speech<"*">(obj speaker, string arg)
{
  if(hasObjListVar(speaker, "petsStoredInStables"))
  {
    removeObjVar(speaker, "petsStoredInStables");
  }
  list Q69B;
  split(Q69B, arg);
  if(isInList(Q69B, "stable"))
  {
    Q5VI(this, speaker);
    return(0x00);
  }
  if(isInList(Q69B, "claim"))
  {
    Q668(this, speaker);
    return(0x00);
  }
  return(0x01);
}
There is no range check! There is no LOS check! The stable function (Q5VI) and the claim function (Q668) do not contain a check either. This means the range scan from inside the EXE is used.

I'll spare you the details.
For "say" this is 9.
For "yell" this is 18.
For "whisper" the speech-event broadcast is non-existant.

Personally, a range-check of 9 or 18, I find this hard to believe, maybe I missed stg... I can only assume for now OSI fixed this silently... (?)

The whispering goes for all NPC's: whispering does nothing! It would be nice to verify this by newsgroup posts or even current OSI...
+ORC: If you give a man a crack he'll be hungry again tomorrow, but if you teach him how to crack, he'll never be hungry again.
chumbucket: I don't collect pixels.

Never trust the client. It's in the hands of the enemy : UO Demo internals @ JoinUO

Pirul
Posts: 5754
Joined: Wed Jan 27, 2010 8:19 pm
Location: New Windmere

Re: Town Vendor Npc Command Range

Post by Pirul »

Batlin wrote: There is no range check! There is no LOS check! The stable function (Q5VI) and the claim function (Q668) do not contain a check either. This means the range scan from inside the EXE is used.

I'll spare you the details.
For "say" this is 9.
For "yell" this is 18.
For "whisper" the speech-event broadcast is non-existant.

Personally, a range-check of 9 or 18, I find this hard to believe, maybe I missed stg... I can only assume for now OSI fixed this silently... (?)
I am not a whiz like you and some other guys here are, but I take this to mean that you can basically stable from anywhere up to 18 tiles away if you yelled the stable comands? And just curious, if it is in the code like so, why is it much harder to believe as opposed to having to be within 8 tiles to bank, or within 3 for vendors?
Image
<ian> 2 chicks making out are not gay

User avatar
Batlin
wobble llama
wobble llama
Posts: 512
Joined: Fri Dec 19, 2008 4:32 am
Location: Ultima Universe

Re: Town Vendor Npc Command Range

Post by Batlin »

I am not a whiz like you and some other guys here are, but I take this to mean that you can basically stable from anywhere up to 18 tiles away if you yelled the stable comands? And just curious, if it is in the code like so, why is it much harder to believe as opposed to having to be within 8 tiles to bank, or within 3 for vendors?
It's like this:
1) Server receives packet 0x03 (speech)
2) The packet handler enumerates all tiles within a specific range (9 for say, 18 for yell)
3) The first 250 objects with an attached script (NPC's + items) are enumareted on those tiles
4) The resulting array is sorted (from close to far)
5) The "speech" trigger handler is called for each script until an handler returns 0 (0 means 'I handled this one')

Now, the banker and vendors have a check in the script and the stable master has no check in his script (step 5) . This means the range for the stable master is 9 or 18, coming from step 2.

It's hard to believe for me too and it sounds more like a OSI bug to me. An OSI programmer forgetting to add a distance check. The question is, did they fix this, if yes, when...
+ORC: If you give a man a crack he'll be hungry again tomorrow, but if you teach him how to crack, he'll never be hungry again.
chumbucket: I don't collect pixels.

Never trust the client. It's in the hands of the enemy : UO Demo internals @ JoinUO

User avatar
Derrick
Posts: 9004
Joined: Thu Dec 13, 2007 7:49 pm
Location: Cove
Contact:

Re: Town Vendor Npc Command Range

Post by Derrick »

Thanks so much for you post Batlin.

I'm going to be working on fixing some of this.

We also need to convert the stable masters to use per-stablemaster stabling. This has been put off due to the disruptive nature of this change, great effort will be made to ensure that the transfer doesn't impact existing creatures in the stables.
Image
"The text in this article or section may be incoherent or very hard to understand, and should be reworded if the intended meaning can be determined."

Pirul
Posts: 5754
Joined: Wed Jan 27, 2010 8:19 pm
Location: New Windmere

Re: Town Vendor Npc Command Range

Post by Pirul »

If I may ask...what is per-stablemaster stabling? Does that mean that what I have stabled will be held by one "individual", and can only be claimed with that individual? How will this affect player town stablemasters?

Also, Baitlin, my question regarding the stable master range is that it is quite possible that OSI left it like that on purpose, and my reasoning is, as I pointed out before, if someone gates in a ridiculous amount of pets, it will disrupt the ability of people to stable (or do business in general in other places). Now this is all fine and good for the l33t d00d that carries 75 red pots and 100 fishsteaks along with his +25 vanq hally, but it represents a real problem for the noob miner who tries to stable his pack-llama and has no food or red pots, as evidenced by this guy who got trapped inside Del bank.
Image
<ian> 2 chicks making out are not gay

User avatar
Derrick
Posts: 9004
Joined: Thu Dec 13, 2007 7:49 pm
Location: Cove
Contact:

Re: Town Vendor Npc Command Range

Post by Derrick »

Yes, on OSI each (invulnerable) stablemaster held creatures individually. This wasn't implemented correctly on Second Age.

So you would have to go see the same NPC that you stabled with.
Image
"The text in this article or section may be incoherent or very hard to understand, and should be reworded if the intended meaning can be determined."

User avatar
Derrick
Posts: 9004
Joined: Thu Dec 13, 2007 7:49 pm
Location: Cove
Contact:

Re: Town Vendor Npc Command Range

Post by Derrick »

Here's some older info on stables masters on the shards:
http://www.tamingarchive.com:8080/old/stables/
Image
"The text in this article or section may be incoherent or very hard to understand, and should be reworded if the intended meaning can be determined."

bolverk
Posts: 52
Joined: Thu Jan 26, 2012 3:41 pm

Re: Town Vendor Npc Command Range

Post by bolverk »

Although era accurate, the speech limitations and squelch threshold introduced make it SUCK to interact with vendors. I don't ever remember being squelched for a full 10 seconds or whatever it is after spamming 4 or 5 vendor sells...there was definitely spam detection that limited speech but the squelch is horrifyingly bad after this patch.

Also, the vendor response time is literally cut in half for some reason this patch. I'm not sure how noticeable it is to others but after this patch it seems like instead of responding right after any command such as bank, vendor buy, vendor sell, etc. there is a 1-2 second delay that was not there before or in any iteration of UO that I remember and I was playing in beta days. It makes it feel like the game lags so I hit the key a couple more times and *BAM* squelched.

I know these are gripes and if they are era accurate, fine...I just wanted to put it out there that this patch has SUCKED for me all around and it makes the server feel more 3rd party for the first time since I've been playing here and definitely not more original in my opinion =/

OhSnap
UOSA Donor!!
UOSA Donor!!
Posts: 156
Joined: Fri Apr 16, 2010 4:48 pm

Re: Town Vendor Npc Command Range

Post by OhSnap »

bolverk wrote:Although era accurate, the speech limitations and squelch threshold introduced make it SUCK to interact with vendors. I don't ever remember being squelched for a full 10 seconds or whatever it is after spamming 4 or 5 vendor sells...there was definitely spam detection that limited speech but the squelch is horrifyingly bad after this patch.

Also, the vendor response time is literally cut in half for some reason this patch. I'm not sure how noticeable it is to others but after this patch it seems like instead of responding right after any command such as bank, vendor buy, vendor sell, etc. there is a 1-2 second delay that was not there before or in any iteration of UO that I remember and I was playing in beta days. It makes it feel like the game lags so I hit the key a couple more times and *BAM* squelched.

I know these are gripes and if they are era accurate, fine...I just wanted to put it out there that this patch has SUCKED for me all around and it makes the server feel more 3rd party for the first time since I've been playing here and definitely not more original in my opinion =/
While I do agree I find the squelch to be too long, I'm pretty sure I NEVER spammed 4-5 vendor sells in era because I never had a Razor sell agent...
The response time is also an intended part of the patch. I'm not a fan, but I'll deal with it in the name of era accuracy. I felt like you for the first 2 hours or so playing after this patch, trying to sell scrolls to vendors was a real pain. After simply playing for a little while, you'll get used to it and forget how it was before the patch. It really isn't a big deal.

Post Reply