Checking to see if the player is a Vampire

Post » Mon Nov 19, 2012 5:44 pm

Long story short: I'm trying to make a merchant that will only sell to the player if the player is a Vampire. I know this has to do with the vendor conditions, but I'm unsure how to reliably determine if the player is a Vampire. What sort of check should I be using, and what should it be set to? I've tried using quest stage checks, but they weren't reliable.
User avatar
Gisela Amaya
 
Posts: 3424
Joined: Tue Oct 23, 2007 4:29 pm

Post » Mon Nov 19, 2012 3:59 pm

There's an IsUndead condition. I don't know if this works when you run it on the player, never having had a vampire character -but it looks as if it ought to.
User avatar
Kevin S
 
Posts: 3457
Joined: Sat Aug 11, 2007 12:50 pm

Post » Mon Nov 19, 2012 8:41 am

Check to see if the player is a member of the PCVampire and/or Vampire factions.
User avatar
Chavala
 
Posts: 3355
Joined: Sun Jun 25, 2006 5:28 am

Post » Mon Nov 19, 2012 1:49 pm

Best way I found was the way Bethesda did it themselves: if (PlayerRef.Haskeyword(vampire))

Seems too simple huh? Like you would think that keyword could come from a lot of sources....not just BEING a vamp. But that is how they check in their scripts.
User avatar
xxLindsAffec
 
Posts: 3604
Joined: Sun Jan 14, 2007 10:39 pm

Post » Mon Nov 19, 2012 3:57 pm

That would have been nice to know about a month ago, could have saved me the long winded script I ended up with? I'll have to check it out.

You can't check for the player being a member of a faction, from what I found looking around the player is only placed in the vampirePC faction when at level 4 so NPC's could come and bash on you.

In my long winded approach I had to test against each Vampire race but that left out custom Vampire races, I ended up having to included checks for Vampire specific perks and a couple of spells.
User avatar
Aliish Sheldonn
 
Posts: 3487
Joined: Fri Feb 16, 2007 3:19 am

Post » Mon Nov 19, 2012 2:07 pm

Best way I found was the way Bethesda did it themselves: if (PlayerRef.Haskeyword(vampire))

Seems too simple huh? Like you would think that keyword could come from a lot of sources....not just BEING a vamp. But that is how they check in their scripts.

This worked pretty well. Of course, it appears that if you cure vampirism you're still somehow flagged as being a vampire, but that's a relatively minor problem that I can overlook. :)
User avatar
Jerry Cox
 
Posts: 3409
Joined: Wed Oct 10, 2007 1:21 pm

Post » Mon Nov 19, 2012 7:27 am

Good to know, I have never used any vampire stuff. I'm just not into vamps.
User avatar
Ian White
 
Posts: 3476
Joined: Thu Jul 19, 2007 8:08 pm

Post » Mon Nov 19, 2012 9:59 am

This worked pretty well. Of course, it appears that if you cure vampirism you're still somehow flagged as being a vampire, but that's a relatively minor problem that I can overlook. :smile:

Maybe the long winded script wasn't for nothing then, I wanted to use my script again in a later mod as part of a quest condition and I really couldn't overlook the minor problem.

There was another global variable I came across PlayerIsVampire, can't find where I wrote it down but you can do a console check for it's value, silly thing just returned 0 the whole time.
User avatar
Neliel Kudoh
 
Posts: 3348
Joined: Thu Oct 26, 2006 2:39 am

Post » Mon Nov 19, 2012 7:18 pm

Maybe the long winded script wasn't for nothing then, I wanted to use my script again in a later mod as part of a quest condition and I really couldn't overlook the minor problem.

There was another global variable I came across PlayerIsVampire, can't find where I wrote it down but you can do a console check for it's value, silly thing just returned 0 the whole time.
You must have a mod that modifies (i.e. screws up) the PlayerVampireQuestScript.pex. It definitely sets that global to 1 when the player becomes a vampire, and back to 0 when he's cured. I've confirmed this by loading saves from before a character became a vampire, while they were a vampire, and after being cured (using 'show PlayerIsVampire'). It checks out.

You can also check if your character has the Vampire keyword attached in the console with 'player.haskeyword a82bb'. a82bb is the formID for the Vampire keyword. I did this as well, as above. Also checks out.

Checking either the global or the keyword should do the trick.
User avatar
james reed
 
Posts: 3371
Joined: Tue Sep 18, 2007 12:18 am

Post » Mon Nov 19, 2012 3:23 am

While the question is pretty much answered I feel like throwing my solution in anyway, when I was making my checks for NPC vampirism I used the hasspell condition and looked for the Vampirism spell, it worked fine until Dawnguard added two 'Vampire' NPC's that aren't technically vampires, but that's a minor oversight, otherwise it worked very reliably for me.
User avatar
Jennifer Rose
 
Posts: 3432
Joined: Wed Jan 17, 2007 2:54 pm


Return to V - Skyrim