Modding: Relationships and Alignments

From Divinity Engine Wiki
Jump to: navigation, search

Relations

In D:OS2, characters (and, more rarely, items) that participate in combat have relations, which fall in 3 categories:

  • Allied, meaning one object wants to aid the other, and will join combat if they see them in a fight.
  • Neutral, meaning one object is indifferent to the other.
  • Hostile, meaning one object will attack the other on sight.

Each relation is defined from one object towards another, which means that asymmetric relations (e.g. a character being Allied to the other, but the other only being Neutral towards them) are possible. However, they can lead to some counterintuitive behaviour and therefore it is advised to use them only with great caution.

Factors in determining relations between objects

Warningred.png
Custom alignments/alignment entities are not supported in GM mode

The relation of one object towards the other is influenced by 3 things:

  • Temporary hostile relationships, which are defined between alignments (or alignment entities, see below) last until the end of combat.
  • Attitude, which is a character's personal opinion towards another character, ranges from -100 to +100, and is 0 by default.
  • Alignments and Alignment entities. One Alignment covers a group of people who share the same goals and views and consider each other allies. An example of an alignment might be "the Magisters of the Reaper's Coast", as we would expect them to share the same enemies and help each other out. An Alignment entity is a subgroup of these and may be a group like "the Magisters in Driftwood", as sometimes we may want to reason about how the Magisters in Driftwood behave without changing how all other magisters in the region behave. The general rule with alignments is always that specific trumps general. These can be defined and adjusted in the alignment editor.

Relations between alignments

The relation between two alignments (and equivalently, alignment entities) exists on a scale of 0-100. That value falls into the three above categories:

  • If the relation is between 0 and 24, the two alignments are Hostile. Usually 0 is used.
  • If the relation is between 25 and 74, the two alignments are Neutral. Usually 50 is used.
  • If the relation is between 75 and 100, the two alignments are Allied. Usually 100 is used.

It is possible for two alignment or alignment entities to have no defined relation. See below for what happens in that case.

Determining relations between objects

To determine the relation of one object (the 'source') towards another (the 'target'), the rule is: the most specific wins. This means that the first of the following rules that applies determines this relation:

  1. If the source has a temporary hostile relationship to the target, then the origin is hostile.
  2. If the source's attitude towards the target is below -75, they are hostile. If the source's attitude towards the target is above 50, they are allied.
  3. If it is defined, the source's alignment entity's relation towards the target's alignment entity is used.
  4. If both objects are of the same alignment entity, they are allied (so you can override this rule by defining a relation of an alignment entity to itself).
  5. If it is defined, the source's alignment entity's relation towards the target's alignment is used.
  6. If it is defined, the source's alignment's relation towards the target's alignment entity is used.
  7. If it is defined, the source's alignment's relation towards the target's alignment is used. (See the image below for this line and the preceding 3).
  8. If both objects are of the same alignment, they are allied (so you can override this rule by defining a relation of an alignment to itself).
  9. If both characters have alignment entities that are parented to the same alignment, and a relation of that alignment to itself exist, they have that relation.
  10. If both characters have alignment entities that are parented to the same alignment, and no relation of that alignment to itself exist, they are allied.
  11. If the objects both have a defined alignment (whether or not they have alignment entities), they are neutral. An object need not necessarily have an alignment entity as long as they have an alignment.
  12. As long as an object does not have a valid alignment, it cannot be hostile or allied.

Priority of relations between different alignments & alignment entities

Below is an image that shows the priority of attitudes for the most common situation of interest: two characters of a different alignment and different alignment entities. Relations Alignment.PNG

World War III and how to avoid it

A common way of making one character hostile to another is by changing their alignment's or alignment entity's relation to the other. Be aware, however, that when doing this you're making the entire alignment entity (or alignment) hostile. As a practical example, if all of your players are of the Hero alignment and all of your Magisters of the Magister alignment entity of the Neutral alignment, and a dialogue choice causes a Magister to become hostile to a player by changing their alignment entity's relation, this will make all Magisters/NPCs with the same alignment entity hostile to all Players. If, at the same time, a different player character is wandering through a different area of the map where magisters are present as well, they will find themselves in combat for no intuitive reason.

The same will happen if a player attacks that magister and the generic behaviour system creates a temporary hostile relation between the player and the magister, as the temporary hostile relation will be defined between the Magister alignment entity and the Player alignment.

The best way to avoid this issue is to treat all of the magisters on the map (or in the game) as one alignment, so you can take advantage of the fact that they're allied by default, but give the members of the group in distinct areas separate alignment entities. An alternative is to use the existing Neutral alignment for all of the Magisters, which takes advantage of the fact that e.g. the Evil alignment is Hostile to the Neutral alignment. However, it means that defining a large number of such entities has the added overhead of adding alliances between each two of them. Furthermore, it is more vulnerable to bugs when someone's relation to an entirely different, unrelated member of the Neutral alignment changed.

As long as there is a defined relation from an alignment entity towards an alignment, that entity's parent alignment's relation towards the other alignment is ignored. For example, completing a quest for a character may make them Allied to only the player who completed the quest (their Alignment entity, e.g. Hero Player1). Making that character hostile to all of the players at once (by making them hostile to Hero, the parent Alignment) will not change their behaviour towards that one player (they will still be allied to him).