Difference between revisions of "GetRelationshipRank - Actor"

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search
imported>Plplecuyer
 
imported>Docclox
m (→‎Examples: Added an example for followers)
Line 32: Line 32:
if daedra.GetRelationshipRank(Game.GetPlayer()) >= 1
if daedra.GetRelationshipRank(Game.GetPlayer()) >= 1
   Debug.Trace("Daedra likes the player")
   Debug.Trace("Daedra likes the player")
endIf
</source>
<source lang="papyrus">
; calling GetRelationshipRank on a follower may fail (return 0) unless they are cast as CompanionActorScript.
; casting as CompanionActorScript will work because it extends Actor. In contrast, casting as FollowerScript won't work because it extends Quest.
CompanionActorScript myCompanion = myFollower as CompanionActorScript
if myCompanion && myCompanion.GetRelationshipRank(Game.GetPlayer()) == 4
  Debug.Trace("The companion is the player's lover")
endIf
endIf
</source>
</source>

Revision as of 01:16, 14 September 2016

Member of: Actor Script

Gets the relationship rank between this actor and another.

Syntax

int Function GetRelationshipRank(Actor akOther) native

Parameters

  • akOther: The other actor to determine our relationship with.

Return Value

The relationship rank between the two actors.

The following values are returned:

  • 4: Lover
  • 3: Ally
  • 2: Confidant
  • 1: Friend
  • 0: Acquaintance
  • -1: Rival
  • -2: Foe
  • -3: Enemy
  • -4: Archnemesis

Examples

; Does the daedra like the player?
if daedra.GetRelationshipRank(Game.GetPlayer()) >= 1
  Debug.Trace("Daedra likes the player")
endIf
; calling GetRelationshipRank on a follower may fail (return 0) unless they are cast as CompanionActorScript.
; casting as CompanionActorScript will work because it extends Actor. In contrast, casting as FollowerScript won't work because it extends Quest.
CompanionActorScript myCompanion = myFollower as CompanionActorScript
if myCompanion && myCompanion.GetRelationshipRank(Game.GetPlayer()) == 4
  Debug.Trace("The companion is the player's lover")
endIf

Notes

Relationship data is NOT stored for Templated Actors, and any scripts that would set relationship data on a Templated actor will get wiped once your game session is over (which obviously has bad implications for Save/Load).

See Also