Disappearing NPC bodyguards

Started by Larrath, May 05, 2006, 05:25:16 PM

I'm trying to think up a nice psuedo-code solution that could maybe help with the problem of NPCs that keep disappearing because of crashes, so I figure maybe someone in the forum can give some feedback on ideas or whatever.

What the code should do is tie the NPC to a specific Room or a specific Character/NPC, and make this check:
If the NPC does not exist in the game, the NPC will be loaded.
There will also be a command, possibly accessible by the entire playerbase, to have the list rechecked if an NPC is still somehow missing.

How it works - first of all, a list with all unique (sorry Oash) NPC bodyguards will need to be compiled.  The list will be checked five minutes after the game starts (after crashes) and it will check if any NPCs in the list are not present in the game.  If they are not, the NPC bodyguards will be loaded into the game.

How will they be loaded?
When a bodyguard NPC is given the Guard command, it will update the dynamic list with the Character or NPC it is guarding and will appear in the same room as the character and guard+follow them.
If the NPC bodyguard is not guarding any target, characters able to Order the NPC will be allowed to define its 'natural room', where it will be loaded.  The natural room will have to have a Clan flag (for crime-code purposes) of the same clan as the leader and the NPC.  This will help PCs that carry their bodyguards from Red Storm to Luir's.
If the NPC dies, it will automatically remove itself from the list.

The NPC will only be bound to a character (that is, will be loaded in the room with them) if the NPC is guarding the character and are in the same room.  If the PC exists the room without the NPC, the NPC will change its affiliation in the list from the character to its Natural Room.  The NPC will bind itself back to the PC/NPC again if they walk together and the NPC follows the PC.

I have considered portals and means of instant transportation and they don't seem to pose an issue with this.  Does anyone see any problems with this code change, or have any better ideas as far as efficiency, ease of coding or resource management goes?

Other than that, feel free to post opinions too, I guess.
Quote from: Vesperas...You have to ask yourself... do you love your PC more than you love its contribution to the game?

This seems like a decent idea to me. I suppose something should be done to better deal with this issue.

It isn't a lack of ability to tackle implementation details that prevents us from addressing issues like this, and I cannot conceive any other explanation for why people feel it is necessary to post such implementation details than the assumption that we do lack that ability.

I personally find only insult in the presentation of psuedocode on these forums, and I very much wish people would stop doing it.

-- X

ps -- Incidentally, I'm sure your post was well-intended, Larrath, and the idea is a good one.  But you shouldn't concern yourself with the details of implementing a feature in our codebase...  it's impossible to do, given no reference to the actual source.

Quote from: "Xygax"It isn't a lack of ability to tackle implementation details that prevents us from addressing issues like this, and I cannot conceive any other explanation for why people feel it is necessary to post such implementation details than the assumption that we do lack that ability.
I don't think anyone in the staff is lacking in abilities, and the coding department has no exceptions.  I've posted this idea because it seemed that something that would help the players by not having NPC bodyguards disappearing at inopportune moments and maybe give the staff some rest and let them focus on any problem the crash might have caused for them instead of starting to fish around for lost NPCs.
I've posted the detail because I don't like posting 'ideas' like "let's not have NPCs disappear at crashes" or "let's stop having crashes in the game" or "let's make movement work better".
I understand that posting code snippets on the board is pretty useless, but I was of the belief that textual psuedocode was slightly more helpful.

Quote from: "Xygax"I personally find only insult in the presentation of psuedocode on these forums, and I very much wish people would stop doing it.
I'm very sorry that you feel this way, because I've spent almost half an hour concentrating fully on this post in order to make it helpful and useful and in order to fully flesh out the idea so I can present it as something feasible instead of saying "make XYZ happen".
If these sort of suggestions and ideas seriously offend you, I'm glad that you said this so I'll know to stop doing it.

I don't see myself as a particularly stupid person, and ideas tend to come randomly.  I sincerely hoped that it could help and am sorry to see that all my proposal caused is irritation.
Quote from: Vesperas...You have to ask yourself... do you love your PC more than you love its contribution to the game?

Please let the NPC guards not disappear when there's coding time for that.  :)
quote="Ghost"]Despite the fact he is uglier than all of us, and he has a gay look attached to all over himself, and his being chubby (I love this word) Cenghiz still gets most of the girls in town. I have no damn idea how he does that.[/quote]

And NPC guards should not have maxxed (notably guard) skills or higher success rates than normal people automatically...unless they've been selected as real veterans.