Jump to content

[Fo4] How to check if an essential NPC is 'down'


thousande

Recommended Posts

Hi
I am experimenting with a little quest where I have a Quest script that runs a timer every 5 seconds to check if my essential NPC actor
is 'down'
With 'down' I mean the actor is sitting on the ground (as essentials can not die)
I guess my problem is that I do not have a better term at the moment :wink:
If the actor is not essential I guess I could use the Actor#isDead() method which always returns false in
my case which makes sense.
So I tried ObjectReference#GetValuePercentage() which yields 'is not a function' in the compiler output.
I have also tried Actor#GetValue(HealthAV) which is a step in the right direction but returns 231 something
when the actor is sitting on the ground. Not sure what the value means as I expect it to be 0
My questions are:
Is there a method for the state I am looking for?
Why can't I call Actor#GetValuePercentage() or friends on my Actor?
What is it I do not understand :smile:
Here is a simplified version of my script
Scriptname TV_MyQuestScript extends Quest

Actor Property NPCActor Auto Const
ActorValue property HealthAV Auto

int timerId = 10 
int delay = 5

Function CheckStatus()
    int npcHealth = NPCActor.GetValue(HealthAV) as int
    Debug.Notification("health" +  npcHealth)
    if npcHealth == 0
        SetCurrentStageID(20)
    else
        StartTimer(delay, timerId)
    endif
EndFunction

Event OnTimer(Int aiTimerID)
    CheckStatus()
EndEvent

Thank you in advance and forgive my horrible English (it is not my first language)

 

Thomas

Edited by thousande
Link to comment
Share on other sites

  • Recently Browsing   0 members

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