MackenzieBeyer Posted December 31, 2020 Share Posted December 31, 2020 So I'm wanting to do a script where, if the player's health falls below 20, a custom companion will "spawn" creatures to help you. Does anyone know how to do this? Link to comment Share on other sites More sharing options...
LarannKiar Posted January 3, 2021 Share Posted January 3, 2021 (edited) I would do this:1. Create a Quest in Creation Kit.2. Add a New Script to the Quest3. I think this should work: Scriptname ScriptName extends Quest Const ObjectReference Property PlayerRef Auto Const Actor Property NPCsToSpawn Auto Const ActorValue Property Health Auto Const Event OnQuestInit() RegisterForHitEvent(PlayerRef) EndEvent Event OnHit(ObjectReference akTarget, ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked, string apMaterial) If akTarget == PlayerRef && Game.GetPlayer().GetValue(Health) <= 20 SpawnNPCs() EndIf If akTarget == PlayerRef RegisterForHitEvent(PlayerRef) Endif EndEvent Function SpawnNPCs() PlayerRef.PlaceAtMe(NPCsToSpawn) EndFunction Edited January 3, 2021 by LarannKiar Link to comment Share on other sites More sharing options...
Recommended Posts