Difference between revisions of "MakePlayerFriend - Actor"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Thingy Person
imported>Lisselli
(→‎Examples: added a slightly modified version of this function. Cuts down GetPlayer() calling down to 1, making it a bit faster than original version.)
 
Line 29: Line 29:
; Make Bob a friend of the player
; Make Bob a friend of the player
Bob.MakePlayerFriend()
Bob.MakePlayerFriend()
</source>
<source lang="papyrus">
Function MakePlayerFriend()
        Actor Player = Game.GetPlayer() ; let's call GetPlayer() only one time.
ActorBase myBase = GetActorBase()
if myBase.IsUnique()
if GetRelationshipRank(Player)== 0
SetRelationshipRank(Player, 1)
else
endif
else
endif
endFunction
</source>
</source>



Latest revision as of 01:20, 11 August 2017

Member of: Actor Script

Convenience function that makes the actor a friend of the player, if allowed.

Syntax[edit | edit source]

Function MakePlayerFriend()
	ActorBase myBase = GetActorBase()
	if myBase.IsUnique()
		if GetRelationshipRank(Game.GetPlayer())== 0
			SetRelationshipRank(Game.GetPlayer(), 1)
		else
		endif
	else
	endif
endFunction

Parameters[edit | edit source]

None.

Return Value[edit | edit source]

None.

Examples[edit | edit source]

; Make Bob a friend of the player
Bob.MakePlayerFriend()
Function MakePlayerFriend()
        Actor Player = Game.GetPlayer() ; let's call GetPlayer() only one time.
	ActorBase myBase = GetActorBase()
	if myBase.IsUnique()
		if GetRelationshipRank(Player)== 0
			SetRelationshipRank(Player, 1)
		else
		endif
	else
	endif
endFunction

Notes[edit | edit source]

  • If the actor is unique and relationship rank with player = 0, raises it to 1. Otherwise does nothing.

See Also[edit | edit source]