RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Active NPC Adventurers

blackmajik13

Traveler
I didn't know where else to put this post, so here it goes.
NPC's that wander around the world and go into dungeons(maybe) or that actively seek out monsters to fight and loot, then return to town once their bag is full to buy food and drink, sell stuff and go back out adventuring. This is probably too much to ask for UO but you never know.
 

_Epila_

Sorceror
It is not "that much", you can separate your work by steps:
-Pathfind algorithm (A*, Dijikstra, etc...) that contains every road, city and dungeon pre-mapped so you reduce the amount of data to process. You could also cache the pathfind result
-The base AI that contains basic living needs and implement the Pathfind algorithm, also able to be derived to fit more complex AIs

Example of simple Fighter AI pseudo algorithm
Code:
Start:
if hungry
Eat untill not hungry
 
if not contains weap/armor
Buy weap/armor then start
else
Go fight
endif
 
Fight:
if not in dungeon
Pathfind to dungeon
else
acquire target then attack
loop until backpack full or need healing
endif

I could write an endless list of possibilities that could fit an entire "living" UO world that of course would take a large amount of work hehe
But when you think of an isolated NPC that Hunt/Gather resources and "does not depends on" external factors, the amount of work goes down tremendously. I am NOT saying that creating this kind of NPC is easy, but the way you look at the initial problem can help you split the big problem into very few (or very high) amount of little problems that can be easily solved
 

pooka01

Sorceror
I tried doing such thing before, and it worked out well.
But while reading i noticed i could do something else :p

In npcs there's a property for the range they wander around from a home point, so you could change that to a very high amount. Then you could implant some kind of function that would check in a certain range around itself, it would check for adventurer pathwayitem thing, that would use some random cases, in these cases there would be some new "activities" to do, it can either send the adventurer to run to the closest graveyard, or seeking for monsters in the forest, and there they could find some new activities some with varying delays, and others not.
As for them entering in dungeons, i don't know if it can be tweaked in the teleporter script, maybe it is in the core, if so, you can make it player true, once it dies, it goes player false, and on initialization() function, you could make them go back to their original location, or forcing the respawn with the spawners. (a flag on the npc ex: Item m_spawner; then force respawn).
 
Top