Wilson

Member
Kita submitted a new resource:

Dynamic NPC System - Vendors need love too!

Dynamic NPC
Intro
The Dynamic NPC is designed to enhance the player's vendor experience by offering rewards for consistent usage of the NPC vendor. The vendor has been integrated with an aging and skill system, where player activity can increase the vendor's skill, resulting in better rewards for the player. To keep the...

Read more about this resource...
 
Before you changed your signature I'm pretty sure you had this on there haha, I've been waiting for you to release it! Very interesting.
 
Before you changed your signature I'm pretty sure you had this on there haha, I've been waiting for you to release it! Very interesting.

This is fresh out of the oven, but I think I know what you mean, it was a mix up on my original posting of the AI system, which I still am unsure what happened with it, but anyways, its been clear sailing ahead lately, enjoy the new vendor system if you decide to use it, and give feedback, I left plenty of room to expand system!
 
Thanks for releasing this, looks good!

When the vendor dies and the new vendor takes over, I assume the loyalty is reset? (That would be a good, self-maintaining way to keep the player data on the vendors from continually growing and growing over time, and avoid maintaining player data on old accounts or deleted characters, etc.)
 
The loyalty doesn't reset, but the skill of the vendor does which effects overall chances for extras!

good catch on players not being around, not to taxing on the system but good to clean up!

I will add a slow burning removal, if not visited today, lose a point, if have no points, remove!
 
What did I mess up on that is giving me the cliloc errors?
 

Attachments

  • Screenshot 2024-03-23 223950.png
    Screenshot 2024-03-23 223950.png
    1.1 MB · Views: 26
That isn't much to go off of, I don't use cliloc in that system, I need more details to pin point your issue!
53 is a common hue I use for strings, so it probably a old server and it can't read newer string methods with hue support! <-Me thinking out loud!
 
It is happening when players sell something to a vendor. That is really all I know. The shard was downloaded a month ago so it isnt that old. But I honestly couldnt tell you if I downloaded 57 or 58 because I hadnt at the time really thought about starting my shard back up. (Just looked in the downloads above and it has 57 as a default. So I am sure that is what I have)
 
Last edited:
I'll do some research and see if I can reproduce it, I'll post a fix as soon as I find something!
 
Last edited:
caught a crash, can you help me fix it?

crash:
Exception:
System.IO.IOException: Unable to access the file "C:...\Output\AIPrompt........._Tatyana.txt" as it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost)
at Server.Custom.UOOpenAI.UOOpenAICore.EventSink_Speech(SpeechEventArgs e) in C:...\UOOpenAICore.cs:line 92
at Server.SpeechEventHandler.Invoke(SpeechEventArgs e)
at Server.EventSink.InvokeSpeech(SpeechEventArgs e) in C:...\EventSink.cs:line 2137
at Server.Mobile.DoSpeech(String text, Int32[] keywords, MessageType type, Int32 hue) in C:...\Mobile.cs:line 5115
at Server.Network.PacketHandlers.UnicodeSpeech(NetState state, PacketReader pvSrc) in C:...\PacketHandlers.cs:line 1627
at Server.Network.MessagePump.HandleReceive(NetState ns) in C:...\MessagePump.cs:line 344
at Server.Network.MessagePump.Slice() in C:...\MessagePump.cs:line 130
at Server.Core.Main(String[] args) in C:...\Main.cs:line 731

Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Server.Services.DynamicNPC.Commands.DynCmdSpeech.CheckVendorTarget(PlayerMobile player, Mobile m, String txt) in C:...\DynCmdSpeech.cs:line 66
at Server.Services.DynamicNPC.Commands.DynCmdSpeech.OnSpeech(SpeechEventArgs e) in C:...\DynCmdSpeech.cs:line 58
at Server.Services.DynamicNPC.Tasks.TaskHandler.OnSpeech(SpeechEventArgs e) in C:...\TaskHandler.cs:line 155
at Server.SpeechEventHandler.Invoke(SpeechEventArgs e)
at Server.EventSink.InvokeSpeech(SpeechEventArgs e) in C:...\EventSink.cs:line 2135
at Server.Mobile.DoSpeech(String text, Int32[] keywords, MessageType type, Int32 hue) in C:...\Mobile.cs:line 5115
at Server.Network.PacketHandlers.UnicodeSpeech(NetState state, PacketReader pvSrc) in C:...\PacketHandlers.cs:line 1625
at Server.Network.MessagePump.HandleReceive(NetState ns) in C:...\MessagePump.cs:line 209
at Server.Network.MessagePump.Slice() in C:...\MessagePump.cs:line 136
at Server.Core.Main(String[] args) in C:...\Main.cs:line 729
 
ServUO 54 is not supported : I don't think I'll ever get the time to do anything for 54, nothing to stop you, the errors you posted are due to me using the latest c#, you can revert them to the old way if you want, but iirc, this system needs other methods and support from ServUO that 54 doesn't have, so if you change the strings and fix these errors, there might be more to deal with etc etc! Sorry I couldn't help you!
 
LOL and I have 117 errors $ part lol Nice to meet you:) I am running pub 54 View attachment 23496
Interpolated strings require the roslyn csc to compile.
ServUO 57 ships with it, you can probably take ScriptCompiler.cs and replace yours with it directly, just make sure to also take the bin/roslyn/ directory that contains the roslyn compiler.
Your only other alternative would be to convert all of the interpolated strings to String.Format, for example;
Code:
$"Hello, {from.Name}, have a look around!"
Can be translated to
Code:
String.Format("Hello, {0}, have a look around!", from.Name)
 
Interpolated strings require the roslyn csc to compile.
ServUO 57 ships with it, you can probably take ScriptCompiler.cs and replace yours with it directly, just make sure to also take the bin/roslyn/ directory that contains the roslyn compiler.
Your only other alternative would be to convert all of the interpolated strings to String.Format, for example;
Code:
$"Hello, {from.Name}, have a look around!"
Can be translated to
Code:
String.Format("Hello, {0}, have a look around!", from.Name)
the whole line or just starting at the $?
 
Replace just
Code:
$"Hello, {from.Name}, have a look around!"
with
Code:
String.Format("Hello, {0}, have a look around!", from.Name)
as an example, in the first line, using $ prior to the "" allows us to input values right into the string whereas the older way was to use a StringFormat() method, which you input the string into String.Format("string") and to add values we use a {0}, {1}, {2}, each number reflects the values that follow the string in the method
Code:
String.Format("string {0}, {1}", From.Name, From.Age)
so the 0 would be replaced by the name and 1 would be replaced by the age! Hope that helps! Here is a video the covers the above except He uses the other older string interp, where we use + in between our strings
Code:
"My name is " + From.Name + ", Hi"
:
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
 
Last edited:
@Wilson this is awesome, thank you so much for releasing it to the community. Giving NPC vendors a 'life' has always been an area of interest for me, as it provides a lot more realism to the player experience and the need to do a little exploration and learning.

I have not played UO with dark nights in over a decade, so I have no idea how that entire system works throughout the map. Will there always be a vendor, somewhere, that's available for players? One of those 24/7 Targets? :)

We're excited to see how players respond to the system, but I just wanted to check in with you as that was my only real question regarding how it functions.

Thanks again, appreciate you!
 
Default the vendors are not out at night, players can use a clock to tell the time where they are, as UO has time zones, there is always a vendor out somewhere, at night they can see the criminal element lol... But if you do not want the night system on, in settings, just toggle the night setting to off! ;)
 
Default the vendors are not out at night, players can use a clock to tell the time where they are, as UO has time zones, there is always a vendor out somewhere, at night they can see the criminal element lol... But if you do not want the night system on, in settings, just toggle the night setting to off! ;)

Awesome, love it! That's what I was not sure about - there being 'time zones' within UO. So that's perfect!
 
Not sure if this has been addressed or not but we have had 2 different server crashes on 2 separate occasions due to this system. It seems that it is during saves that it is happening. This from the crash today.
System.ArgumentException: An item with the same key has already been added. Key: 0x5500 "Alben"
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at Server.Services.DynamicNPC.ProfileStore.AddVendor(Mobile vendor, VendorProfile profile) in F:\TitanX\UO Shards\Faerham Citadel\Scripts\_Custom\DynamicNPC\Data\ProfileStore.cs:line 28
at Server.Services.DynamicNPC.DynamicVendorMobile.OnVendorCreated(MobileCreatedEventArgs e) in F:\TitanX\UO Shards\Faerham Citadel\Scripts\_Custom\DynamicNPC\Core\DynamicVendorMobile.cs:line 12
at Server.Mobile.<.ctor>b__1179_0() in F:\TitanX\UO Shards\Faerham Citadel\Server\Mobile.cs:line 10544
at Server.Timer.Slice() in F:\TitanX\UO Shards\Faerham Citadel\Server\Timer.cs:line 405
at Server.Core.Run() in F:\TitanX\UO Shards\Faerham Citadel\Server\Main.cs:line 678
And this is from the crash 2 days ago.
System.ArgumentException: An item with the same key has already been added. Key: 0x66B2 "Jerrilyn"
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at Server.Services.DynamicNPC.ProfileStore.AddVendor(Mobile vendor, VendorProfile profile) in F:\TitanX\UO Shards\Faerham Citadel\Scripts\_Custom\DynamicNPC\Data\ProfileStore.cs:line 28
at Server.Services.DynamicNPC.DynamicVendorMobile.OnVendorCreated(MobileCreatedEventArgs e) in F:\TitanX\UO Shards\Faerham Citadel\Scripts\_Custom\DynamicNPC\Core\DynamicVendorMobile.cs:line 12
at Server.Mobile.<.ctor>b__1179_0() in F:\TitanX\UO Shards\Faerham Citadel\Server\Mobile.cs:line 10544
at Server.Timer.Slice() in F:\TitanX\UO Shards\Faerham Citadel\Server\Timer.cs:line 405
at Server.Core.Run() in F:\TitanX\UO Shards\Faerham Citadel\Server\Main.cs:line 678
 

Active Shards

Donations

Total amount
$80.00
Goal
$1,000.00
Back