PDA

View Full Version : Starving NPCs


Bluddy
11-08-2011, 03:22 PM
I'm pretty sure the NPC begging/starving at the same time syndrome has to do with the fact that the time until starvation is 15 minutes. I'm guessing that each NPC is initialized as completely satiated, and then a countdown begins. Those NPCs who can't afford to buy food (the ones in debt) will starve 15 minutes after the town has initialized.

One solution is to randomize the hunger levels of NPCs when they're initialized.

Also, Shadow, I don't know if you've realized this, but the inflation mechanism probably causes more NPCs to go into debt and starve in later levels, since food prices go up much faster than money drop rates and NPC money levels.

Bluddy
11-08-2011, 08:41 PM
After a little more investigation, I think it's a little more complex. I think many NPCs can't afford food, even after the discount they get. The first 15 minutes don't give them enough time to get a chance to work, and the result is that many of them are hungry at the very start of the town.

This might also be what's causing the high frequency of starvation quests in general. Food prices are high relative to what the average NPC has.

Shadow
11-18-2011, 11:39 AM
There is some random stuff in the calculations but I could add a bit more to get them out of sync more.

The price for food for NPCs isn't tied to what food the player buys so I don't think that is an issue. The NPC food price is based on the average money drop for their level just like most other NPC money related things.

udhaya_ko
11-22-2011, 02:17 PM
Good thing. There is another bug that we could consider than this. That is monsters that can hide in the ground. When you go kill something as a zombi that can hide, isn't hard to find them?

Bluddy
12-15-2011, 11:27 AM
I noticed that QuestStarving has NpcDeathChance 0.5. How often is the test for NPC death carried out?

Shadow
12-15-2011, 01:28 PM
I noticed that QuestStarving has NpcDeathChance 0.5. How often is the test for NPC death carried out?

That comes from the MinEventTime and MaxEventTime values which are 360.0 and 540.0, so on average every 7 1/2 minutes.

Bluddy
12-15-2011, 01:39 PM
That comes from the MinEventTime and MaxEventTime values which are 360.0 and 540.0, so on average every 7 1/2 minutes.

OK so what I'm thinking is that the chance should be much lower. Having people die of starvation isn't that much fun -- it should be a very rare occurrence, and giving them a longer time to live will allow time for other NPCs to solve their quest, which should probably be the 'default state'. Death of the NPC is then a risk you're taking, but a slight one.

Instead, it would be good if starvation had some other effect. It could lower happiness (even more so than debt) or perhaps cause weakness, slowdown, reduce the chance of working etc.

EDIT: BTW doing the math on the death chance of 0.5 and taking the average of 7.5 minutes between tests gives you 0.5*7.5 + 0.5*0.5*15 + 0.5^3*22.5 ... It's an infinite series that converges at around 14.5, so on average, every NPC dies 15 minutes after beginning to starve (with some variation between 13 and 16 minutes which are the min and max). I mean really it's pretty simple it's just the time divided by the probability... Maybe 0.2 is a better value then?

Shadow
12-16-2011, 10:51 AM
I could probably be convinced to lower the starving chance.