Talk:Party Management via Dialog

From Divinity Engine Wiki
Revision as of 22:18, 28 October 2017 by Tinkerer (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

There are a number of omissions in this code for recruiting a character:

  1. You should call CharacterAssignToUser to ensure the character gets assigned to the correct user/player (otherwise all recruited characters will probably be assigned to the host user/player)
  2. You should disable all reactions to crimes (ProcCharacterDisableAllCrimes) for recruited characters, so they don't start complaining if you assault/kill someone in front of them, or steal/pickpocket
  3. You should set up allied in-party alignments for each potential player character and assign those to the characters (SetFaction) once they join the party. This ensures that if you e.g. charm an NPC (which makes the NPC allied to the character that charmed it), the charmed NPC will be allied to all player characters in the same party (otherwise it will probably be neutral, which makes it less careful about not harming you). Similarly, it ensures that if someone start a combat with one party member, all party members will join that combat (characters join combats if they see an allied character that is in combat)
  4. You should call ProcRegisterPlayerTriggers() for the character that joins, so that triggers that have been registered for all player characters also get registered for this new character
  5. Ideally, you should also call CharacterAttachToGroup() after recruiting it, so it gets chained to the character that recruited it (and hence follows it by default)

When dismissing a character, you should undo points 4, 3 and 2 again after making the character an NPC.

Finally, if you create an add-on for the main campaign rather than an independent mod, you should always use the PROC_GLO_PartyMembers_Add() helper, as defined in the GLO_PartyMembers goal of the DivinityOrigins mod. Otherwise a whole bunch of things won't be set up properly. That one requires that an in-party dialog gets defined by QRY_GLO_PartyMembers_GetInPartyDialog() (you can overload that routine) and that there's a DB_GLO_PartyMembers_DefaultFaction() which defines the in-party alignment of the character.

Tinkerer (talk) 23:18, 28 October 2017 (CEST)