31 lines
1.1 KiB
Plaintext
31 lines
1.1 KiB
Plaintext
Scriptname _00E_Func_SetNPCAsCompanion Hidden
|
|
|
|
Function SetNPCAsCompanion(Actor akActor, bool bCompanion = True, int iCompanionHealth = 100, int iCompanionStamina = 100, int iCompanionMagicka = 100) Global
|
|
;Sets an NPC as companion, showing his health bar, making him friendly, unflagging him as ghost. Does the opposite when bCompanion is set to false.
|
|
;Additionally sets the AVs Health, Stamina, Magicka for the NPC companion
|
|
|
|
If bCompanion
|
|
|
|
akActor.SetRelationshipRank(Game.GetForm(0x14) as Actor, 3)
|
|
akActor.SetGhost(False)
|
|
akActor.getActorbase().SetEssential(true) ; just in case, had trouble with FS_NQR05
|
|
akActor.SetPlayerTeammate(True)
|
|
akActor.IgnoreFriendlyHits()
|
|
akActor.SetActorValue("Health", iCompanionHealth)
|
|
akActor.SetActorValue("Stamina", iCompanionStamina)
|
|
akActor.SetActorValue("Magicka", iCompanionMagicka)
|
|
HealthBarManager.Show(akActor)
|
|
|
|
Else
|
|
|
|
akActor.SetGhost(True)
|
|
akActor.getActorbase().SetEssential(true) ; just in case, had trouble with FS_NQR05
|
|
akActor.ResetHealthAndLimbs()
|
|
akActor.SetPlayerTeammate(False)
|
|
akActor.IgnoreFriendlyHits(False)
|
|
HealthBarManager.Hide(akActor)
|
|
|
|
EndIf
|
|
|
|
EndFunction
|