Jump to content

Help With Player Health Script


MackenzieBeyer

Recommended Posts

I would do this:

1. Create a Quest in Creation Kit.

2. Add a New Script to the Quest

3. 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 by LarannKiar
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...