MakePlayerFriend - Actor

Revision as of 02:20, 11 August 2017 by 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.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Member of: Actor Script

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

SyntaxEdit

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

ParametersEdit

None.

Return ValueEdit

None.

ExamplesEdit

; 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

NotesEdit

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

See AlsoEdit