Ninja Bear Studio Plugins Help

Reputation and Tiers

In some games, it is very common for players to improve their standing with certain Factions, from many activities available in the game, such as quests.

The Faction System provides this logic via Reputation. A faction member has a certain amount of reputation with a Faction, which places them at a certain membership Tier. Then, during gameplay, multiple events can add or subtract reputation, changing the tier and therefore, how other members can react to a member.

Reputation Data Table

Tiers are defined by a Data Table, which can be set to the project globally, in the Faction Settings page. The row structure must be FactionReputationTableRow.

When creating this Data Table, you will need to provide the following information.

Property

Description

Display Name

A localized value for the tier name.

Color

A color that can be used in the User Interface, when representing this tier.

Min Reputation

Minimum reputation required to enter this tier. The lowest tier should always start at zero.

Max Reputation

Maximum reputation supported by this tier. The last available tier represents the reputation limit.

Attitude

AI attitude towards other faction members, while in this tier.

You can use the following JSON as a starting point for your Data Table.

[ { "Name": "Hated", "DisplayName": "NSLOCTEXT(\"FactionData\", \"tier.hated\", \"Hated\")", "Color": { "B": 25, "G": 0, "R": 190, "A": 255 }, "MinReputation": 0, "MaxReputation": 999, "Attitude": "Hostile" }, { "Name": "Unfriendly", "DisplayName": "NSLOCTEXT(\"FactionData\", \"tier.unfriendly\", \"Unfriendly\")", "Color": { "B": 70, "G": 124, "R": 190, "A": 255 }, "MinReputation": 1000, "MaxReputation": 1999, "Attitude": "Neutral" }, { "Name": "Neutral", "DisplayName": "NSLOCTEXT(\"FactionData\", \"tier.neutral\", \"Neutral\")", "Color": { "B": 52, "G": 177, "R": 190, "A": 255 }, "MinReputation": 2000, "MaxReputation": 2999, "Attitude": "Neutral" }, { "Name": "Friendly", "DisplayName": "NSLOCTEXT(\"FactionData\", \"tier.friendly\", \"Friendly\")", "Color": { "B": 121, "G": 190, "R": 113, "A": 255 }, "MinReputation": 3000, "MaxReputation": 3999, "Attitude": "Friendly" }, { "Name": "Honored", "DisplayName": "NSLOCTEXT(\"FactionData\", \"tier.honored\", \"Honored\")", "Color": { "B": 121, "G": 190, "R": 113, "A": 255 }, "MinReputation": 4000, "MaxReputation": 4999, "Attitude": "Friendly" } ]

Faction Source Interface

This is an interface that can be added to certain objects that can modify a member's Reputation. Some examples:

  • The Player enters a zone delimited by a volume and its Reputation is modified. In this case, the volume can be a source.

  • The Player defeats an enemy and gains Reputation with a Faction, but looses Reputation with another one. The enemy can be a source.

  • The Player finishes a quest and gains Reputation, the quest giver or quest object can be a source.

These gains can also be dynamic, customized to the Faction Member requesting them and Event, which makes this approach very flexible.

Managing Reputation

Reputation is added via the Faction Manager, directly or via objects implementing the Faction Source interface.

Add Reputation

Reputation can be added directly, using the AddReputation function.

Add Reputation
void APluginLabsCharacter::AddReputation(const UNinjaFactionDataAsset* FactionData, int32 Reputation) const { FactionManager->AddReputation(FactionData, Reputation, this, Tag_Factions_Event_Generic); }

When adding Reputation, the following parameters are expected by the function:

Parameter

Description

Faction Data

Data Asset representing the target Faction.

Reputation

Amount of reputation to add to the membership.

Source

Object responsible for this change. It could be an implementation of FactionSourceInterface.

Event Tag

Gameplay Tag explaining the type of event that originated this change.

If the source implements the Faction Source Interface, it will be given an opportunity to make sure that the change being requested is truly viable.

This can be used to make sure that RPCs sent to the server, requesting changes in the Reputation, are valid.

Add Reputation From Source

Reputation can be added from any sources, using the AddReputationFromSource function.

Add Reputation from Source
void APluginLabsCharacter::AddReputationFromSource(const UObject* Source, FGameplayTag EventTag) const { FactionManager->AddReputationFromSource(Source, EventTag); }

Tiers

When Reputation changes, it may also modify the current Tier. This process is done automatically, based on the Data Table containing the tier information.

Delegates

Changes in the Reputation and Tier can be tracked by binding to the appropriate Multicast Delegates in the Faction Manager.

  • OnReputationChanged: Broadcast whenever Reputation changes (client and server).

  • OnTierChanged: Broadcast whenever the Tier changes (client and server).

Last modified: 15 September 2024