Jump to content

NPC Companion Unconscious


TonyBalony1960

Recommended Posts

I was wondering if anyone could help me. I am making a companion with a mini-quest. I would like the companion to be unconscious, (zero health for essential NPC), until the bad guy has been killed.

 

I added a script to the Quest window in the "construction set" in the first tab, that looks like this:

 

begin GameMode

 

ref CassandraRefVar

set CassandraRefVar to CassandraLouve ; Unique ID

 

ref VampireRefVar

set VampireRefVar to VampireLordX; Unique ID

 

if (VampireRefVar.GetActorValue Health != 0)

CassandraRefVar.SetActorValue Health 0

endif

 

if (VampireRefVar.GetActorValue Health == 0)

CassandraRefVar.SetActorValue Health 99999999

endif

 

end GameMode

 

Now, I'm a first time modder, so I assume I am doing probably 83 things wrong, but I can't figure out what. The companion is not unconscious, she just stands there. I wasn't sure if this should go in the AI, but I am a bit scared of the AI, since every time I mess with it, one of my functions stops working, (like FOLLOW or STAY).

 

Any help would be greatly appreciated. Thanks.

Edited by TonyBalony1960
Link to comment
Share on other sites

SetAV won't knock them unconscious; you'll need to use ModAV. Also, if you don't want them to keep getting up every ten seconds; changing fEssentialDeathTime with 'con_setgamesetting' should achieve this, however you'd only want to do this when the relevant action is going on; as it would effect all essential NPCs in the game. On another note; using == may be a too strict in a case such as this; <= would make sure to catch it. Although the best method for that particular check would be 'VampRef.GetDead'. Your script, tidied up, might look like:

 

ref CassandraRefVar
ref VampireRefVar

Begin GameMode

if CassandraRefVar   ; this condition so that it only sets the ref, when they have not already been set.
else
 set CassandraRefVar to CassandraLouve ; Unique ID
 set VampireRefVar to VampireLordX; Unique ID
endif

if (VampireRefVar.GetActorValue Health >= 0)
CassandraRefVar.ModActorValue Health -9999999
endif

if (VampireRefVar.GetDead && VampireRefVar ) ; this second check, followed by the next line, prevents this from happening constantly.
 set VampireRefVar to 0
 CassandraRefVar.ModActorValue Health 99999999
endif

End

Edited by PrettyMurky
Link to comment
Share on other sites

SetAV won't knock them unconscious; you'll need to use ModAV. Also, if you don't want them to keep getting up every ten seconds; changing fEssentialDeathTime with 'con_setgamesetting' should achieve this, however you'd only want to do this when the relevant action is going on; as it would effect all essential NPCs in the game. On another note; using == may be a too strict in a case such as this; <= would make sure to catch it. Although the best method for that particular check would be 'VampRef.GetDead'. Your script, tidied up, might look like:

 

ref CassandraRefVar
ref VampireRefVar

Begin GameMode

if CassandraRefVar   ; this condition so that it only sets the ref, when they have not already been set.
else
 set CassandraRefVar to CassandraLouve ; Unique ID
 set VampireRefVar to VampireLordX; Unique ID
endif

if (VampireRefVar.GetActorValue Health >= 0)
CassandraRefVar.ModActorValue Health -9999999
endif

if (VampireRefVar.GetDead && VampireRefVar ) ; this second check, followed by the next line, prevents this from happening constantly.
 set VampireRefVar to 0
 CassandraRefVar.ModActorValue Health 99999999
endif

End

 

Sweeeeeeeet! Very nice. I'll check this out.

 

I am unsure about a few things. Setting the Reference Variable...you use the frameID, (the unique ID at the very top of the NPC window when you copying them), is what you use to set the Reference Variable with? Also, I put this script in the Quest window, Quest Data tab, Script?

 

Thanks, Pretty Murky, this looks good, I appreciate it. Gone to check it out now.

Edited by TonyBalony1960
Link to comment
Share on other sites

ref CassandraRefVar
ref VampireRefVar

Begin GameMode

if CassandraRefVar   ; this condition so that it only sets the ref, when they have not already been set.
else
 set CassandraRefVar to CassandraLouve ; Unique ID
 set VampireRefVar to VampireLordX; Unique ID
endif

if (VampireRefVar.GetActorValue Health >= 0)
CassandraRefVar.ModActorValue Health -9999999
endif

if (VampireRefVar.GetDead && VampireRefVar ) ; this second check, followed by the next line, prevents this from happening constantly.
 set VampireRefVar to 0
 CassandraRefVar.ModActorValue Health 99999999
endif

End

 

 

Awww, crap. I put it in the Quest script and it did the same as before, nada. Am I putting it in the wrong place, (should this go under AI), am I using the right thing to set my Reference Variables to, (the frameIDs)? Do I really suck this bad? lol

Edited by TonyBalony1960
Link to comment
Share on other sites

You are talking about FRAME ID? I don't know about that. Don't you mean formID, the 2nd column in the NPC object window?.

 

You seem to talk about the ID in the NPC window. But this is wrong. You need the reference's Editor Id. That's the ID which you get when you open the NPC instance by double-clicking in the render window. And make sure, you make this NPC a "Persitent Reference".

 

Also make sure that you quest is "Start game enabled".

 

And a second suggestion. I once made a similar thing, but had different problems when making the NPC unconcious. Not waking up again, or something. It's too long ago. So what I did instead was to paralize her with "setav paralysis 1". Worked for me.

Link to comment
Share on other sites

You are talking about FRAME ID? I don't know about that. Don't you mean formID, the 2nd column in the NPC object window?.

 

You seem to talk about the ID in the NPC window. But this is wrong. You need the reference's Editor Id. That's the ID which you get when you open the NPC instance by double-clicking in the render window. And make sure, you make this NPC a "Persitent Reference".

 

Also make sure that you quest is "Start game enabled".

 

And a second suggestion. I once made a similar thing, but had different problems when making the NPC unconcious. Not waking up again, or something. It's too long ago. So what I did instead was to paralize her with "setav paralysis 1". Worked for me.

 

Ahhh, YOU DA MAN!!! That did it! I was using the "formID", (yes, not frameID, muh bad), and I didn't even have an editorID for the bad guy, let alone have it set with a "Persistent Reference".

 

Now, I just need to figure out how to set the fEssentialDeathTime to be forever in the case of our damsel, inside a script, then change it back. I tried:

 

...
short EssDeathTime

Begin GameMode

...
if (EssDeathTime == 0)
set EssDeathTime to (GetGameSetting fEssentialDeathTime); this bit worked
SetGS fEssentialDeathTime to 999999999990
endif

...

 

The problem is that SetGameSetting, (SetGS or con_SetGameSetting), is not allowed in a script since it's strictly a console command....errrrrr! There must either be some other command I could use or variable to set the character's death time to. This part is frustrating, because I can't really set the variable to this permanently in the GamePlay/Settings menu...that would be bad.

 

Anyone have any hints on this one?

Link to comment
Share on other sites

You can use con_SetGameSetting in a script, but then you have to start using OBSE. (That's what I recommend anyway to all modders, since there are so many anemities using OBSE, I couldn't live without it). OBSE translates most console functions by adding a "con_" in front of the console command name.

 

Hope that helps. But before you do all of this: try the paralysis thing I mentioned in my 1st post. Just one command to the NPC fall down, and one more to bring her up again. No hazzle with unconsciousness.

Link to comment
Share on other sites

You can use con_SetGameSetting in a script, but then you have to start using OBSE. (That's what I recommend anyway to all modders, since there are so many anemities using OBSE, I couldn't live without it). OBSE translates most console functions by adding a "con_" in front of the console command name.

 

Hope that helps. But before you do all of this: try the paralysis thing I mentioned in my 1st post. Just one command to the NPC fall down, and one more to bring her up again. No hazzle with unconsciousness.

 

 

Ooops. I was so excited about the first part of the post, didn't thoroughly read the end. I'll give that a try, ty.

 

My dad is always saying that I walk through life unconscious, (like this NPC will hopefully be)...he's probably right. :blink:

 

 

Thanks man. I appreciate it. Going to go try. I'll post an update with the final script if I get it going.

Link to comment
Share on other sites

CRAP!

 

I set up new variables, almost had it perfect except some minor concerns. But now, when I go in to the quest window to edit the script, the Construction Set says that it "Could not select script "VampireLordXScript", (0100180F), in LoadDialog for TESScriptableForm form component." and I can't find the script in the drop down list. I tried making a new one with a new name and it won't show up. I tried setting the quest script to NONE and then saved, then restarted TES Construction Set and then made a new script with different name and it still won't show up.

 

Is there an error in my mod now and it just won't work? I hope I don't have to start over from scratch...that would suck! lol

 

 

EDIT: Alright, I figured out that somehow the "Script Type" got changed from "Quest" to "Magic Effect". Still not working quite right, but I'm working on it.

Edited by TonyBalony1960
Link to comment
Share on other sites

  • Recently Browsing   0 members

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