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!

Trying to implement a hunger system...

Uukrul

Wanderer
I'm fairly new to RunUO (brand new to be precise). I'm looking to use it as a platform for artificial life research. To orient myself with the code-base I've decided on a seemingly simple project: implement a hunger system where mobiles would sustain the standard effects of starvation (e.g. dying). This would necesstitate an AI engine that would enable mobiles to search for food when hungry. (and also give purpose to their existence, rather that just a random walk).

That being said, I'd like to know where I would hook into the game loop to make a hunger check. I would be implementing this for all BaseCreatures.

Thanks ahead of time.
 

Soteric

Knight
Actually such system exists in RunUO. Take a look at Scripts/Misc/FoodDecay.cs

There is a timer which decrease Hunger and Thirst property of online players every 5 minutes. You can start there.
 

Uukrul

Wanderer
Another quick question. I'm looking to loop through all BaseCreatures. My world is populated with Mobiles but NetState.Instances is empty. Any ideas?
 

Soteric

Knight
NetState.Instances shows only online players. You should iterate over World.Mobiles.Values and check if the value is BaseCreature.
 
Top