Larian Studios

Character management via dialog

Posted By: Vieux

Character management via dialog - 09/09/19 05:41 PM

Hi,

I'm currently working on a quest mod in which party management is very important.

I used this tutorial and it worked fine until Definitive Edition.

I didn't want to ask for help on this because I had bypassed (or so I thought) the problem via dialog flags.

The issue is this : When calling the CharacterMakePlayer procedure it effectively adds the NPC to the party but it is NOT added to DB_IsPlayer database.
This means that, when you check with sys_count how many players there is, it always returns 1.

The real problem is that when the user Player (the first player that wasn't recruited this way) is killed the game engine evaluates this as Game Over.

So I ask : How do I ensure that the DB_IsPlayer is updated correctly ?
Posted By: Windemere

Re: Character management via dialog - 09/09/19 08:48 PM

At the same time that you make the call to CharacterMakePlayer in your story, can't you make a call to DB_IsPlayer() with the same GUID?
Posted By: Vieux

Re: Character management via dialog - 10/09/19 06:47 PM

Hi,
Thank you for taking the time to help me.

Yes I think I do right before CharacterMakePlayer I call DB_IsPlayer on the very same GUID. Or I don't know how to do it right

my code :

Quote

PROC
PROC_AddPlayerToParty((CHARACTERGUID)_Char, (CHARACTERGUID)_NPC)
THEN
DB_IsPlayer(_NPC);
CharacterMakePlayer(_NPC);
CharacterAddToParty(_Char, _NPC);


So it's similar to the original one but with this insignificant change of the last line.
Posted By: Windemere

Re: Character management via dialog - 10/09/19 08:18 PM

Okay, I'm trying to clear the cobwebs a bit here. Your setting of DB_IsPlayer() looks fine. When I added NPCs to the party in my project, the only thing I did differently was to set the owning character at the same time when calling CharacterMakePlayer (see wiki link for notes). Example:

Code
CharacterMakePlayer(_NPC, _Char);
DB_IsPlayer(_NPC);


Where '_Char' is the player who owns control of the NPC. Note that the call to CharacterAddToParty is deprecated and not supported in DOS2.

I am hoping what happened is that your NPC was never associated with a particular user (human player), and therefore the game did not recognize any survivors when your main character died. I would modify your CharacterMakePlayer() to look like my example and see if that helps.
Posted By: Vieux

Re: Character management via dialog - 10/09/19 09:44 PM

That was it ! It worked fine.

I'll try to remember how you debugged it next time I encounter a similar problem.

That's precious help you gave me here. Thank you.
Posted By: Windemere

Re: Character management via dialog - 10/09/19 11:41 PM

Great! Thanks for the update and happy modding.
© 2019 Larian Studios forums