SetRace - Does it even work?

Post » Wed Jun 20, 2012 4:06 am

So I'm trying to set up an NPC, a dead one, that will take on the race of the player. Apparently this doesn't work:

function SetDeadNPCRace(Actor DeadGuy)    Race PlayerRace = Game.GetPlayer().GetRace()    debug.trace( "Player:" )    if playerRace == ArgonianRace        debug.trace( "Argonian" )    elseif playerRace == BretonRace        debug.trace( "Breton" )    elseif playerRace == DarkElfRace          debug.trace( "Dunmer" )    elseif playerRace == HighElfRace          debug.trace( "Altmer" )    elseif playerRace == ImperialRace          debug.trace( "Imperial" )    elseif playerRace == KhajiitRace          debug.trace( "Khajiit" )    elseif playerRace == NordRace          debug.trace( "Nord" )    elseif playerRace == OrcRace          debug.trace( "Orc" )    elseif playerRace == RedguardRace          debug.trace( "Redguard" )    elseif playerRace == WoodElfRace          debug.trace( "Bosmer" )    endif        DeadGuy.SetRace(PlayerRace)    Race DeadRace = DeadGuy.GetRace()    debug.trace( "Dead Guy:" )        if DeadRace == ArgonianRace        debug.trace( "Argonian" )    elseif DeadRace == BretonRace        debug.trace( "Breton" )    elseif DeadRace == DarkElfRace          debug.trace( "Dunmer" )    elseif DeadRace == HighElfRace          debug.trace( "Altmer" )    elseif DeadRace == ImperialRace          debug.trace( "Imperial" )    elseif DeadRace == KhajiitRace          debug.trace( "Khajiit" )    elseif DeadRace == NordRace          debug.trace( "Nord" )    elseif DeadRace == OrcRace          debug.trace( "Orc" )    elseif DeadRace == RedguardRace          debug.trace( "Redguard" )    elseif DeadRace == WoodElfRace          debug.trace( "Bosmer" )    endif    EndFunction

The function is calling in correctly. Player reports as an Argonian (correct), but the dead guy reports as a Nord, which is what his base NPC record starts as. The change to Argonian does not take, not even if I walk up and use the console to try and force the issue.

Am I missing something insanely obvious here? Or does the SetRace() function really not work?
User avatar
Rude Gurl
 
Posts: 3425
Joined: Wed Aug 08, 2007 9:17 am

Post » Wed Jun 20, 2012 10:52 am

It does work: I'm trying to get a dwemer combat suit and I actually have gotten the dwarven centurion skin.
It's still not working as intended (maybe due to size or it not being intended like this) since the 3th person cam is at ground level between and behind his feet..which plays very annoying.

I'm not good enough with scripting to identify the error in your script though.

Maybe you need an event or something to activate setting his race?
User avatar
Destinyscharm
 
Posts: 3404
Joined: Sun Jul 23, 2006 6:06 pm

Post » Wed Jun 20, 2012 7:39 am

If it helps, this is the script that calls that:
Scriptname ARTH_LAL_DeadGuyScript extends ReferenceAliasARTH_LAL_StartQuest Property NewStartQuest Autobool checkedEvent OnLoad()    if( !checked )   	 NewStartQuest.SetDeadNPCRace(Self.GetRef() as Actor)        checked = True    EndIfEndEvent

The OnLoad() event is obviously working since the debug calls are happening.
User avatar
Sian Ennis
 
Posts: 3362
Joined: Wed Nov 08, 2006 11:46 am

Post » Wed Jun 20, 2012 9:04 am

I tried with disable, setrace, enable, but that crashes my game when the actor is enabled.
User avatar
stevie trent
 
Posts: 3460
Joined: Thu Oct 11, 2007 3:33 pm

Post » Wed Jun 20, 2012 1:45 am

SetRace definitely works; or at least, it does something. (I use it to update the stats on my custom companions--an idea I shamelessly stole from DreamKing.) But I'm setting the properties manually, not calling them on an actor, so I don't know why it's not working. Does the actor have to be alive for the function to work? You could try changing his race and then killing him.
User avatar
Sheila Esmailka
 
Posts: 3404
Joined: Wed Aug 22, 2007 2:31 am

Post » Wed Jun 20, 2012 12:14 am

Just a thought, but maybe it IS changing his race, but not the accompanying skin?
User avatar
e.Double
 
Posts: 3318
Joined: Tue Jul 24, 2007 11:17 pm

Post » Tue Jun 19, 2012 8:32 pm

Arthmoor, all those races like "ArgonianRace" are defined as properties in the script with the function, right?

You could try waiting a second or two between SetRace() and GetRace(), in case the changeover doesn't happen instantly.
User avatar
maria Dwyer
 
Posts: 3422
Joined: Sat Jan 27, 2007 11:24 am

Post » Tue Jun 19, 2012 10:57 pm

EDIT: seems I'm late. As you see: I think Dreamking has the problem :D


Sorry for asking but you DID set the property for each of those races right? Since I'm missing it in the script?

if not: I copied this from my script to save you time :biggrin:

Race Property ArgonianRace auto

Race Property BretonRace auto

Race Property DarkElfRace auto

Race Property HighElfRace auto

Race Property ImperialRace auto

Race Property KhajiitRace auto

Race Property NordRace auto

Race Property OrcRace auto

Race Property RedguardRace auto

Race Property WoodElfRace auto
User avatar
Sherry Speakman
 
Posts: 3487
Joined: Fri Oct 20, 2006 1:00 pm

Post » Tue Jun 19, 2012 6:59 pm

Yes, the properties are there or it wouldn't have compiled :P

Clearly it isn't changing his race because the GetRace() call says he's still a Nord.

I'll see what happens if I start him alive and then kill him after changing it. That would be lame, but workable for my situation.
User avatar
Ebony Lawson
 
Posts: 3504
Joined: Fri Feb 16, 2007 11:00 am

Post » Wed Jun 20, 2012 4:30 am

I don't understand much about scripting but this is from my scirpt that does work:


PlayerOriginalRace = Game.GetPlayer().GetRace()
Game.GetPlayer().SetRace(centurionrace)
Game.GetPlayer().SetRace(PlayerOriginalRace)

In which playerOriginalRace and centurion race are all properties (playeroriginalrace is just set to default)

Maybe you could try the combination of setting: race property playeroriginalrace auto and then using the first of the lines that I copied from above (yes I know your does or should do the same).
The actual change race line seems correct.

well I don't know and you seem to know much more about scripting anyway so I can't help you except maybe try that line above. At least I've bumped it again for you :D
User avatar
Ana Torrecilla Cabeza
 
Posts: 3427
Joined: Wed Jun 28, 2006 6:15 pm

Post » Wed Jun 20, 2012 11:00 am

Ok, so the NPC has to be alive for this to work. Of course it still suffers from the grey-face problem and the face textures don't change to match the new race but it does work. Using SetRace() on dead NPCs will fail.
User avatar
Alexis Estrada
 
Posts: 3507
Joined: Tue Aug 29, 2006 6:22 pm

Post » Tue Jun 19, 2012 11:59 pm

Hehe, I was going to edit that in the script on the wiki. Someone did that already.
User avatar
Trevi
 
Posts: 3404
Joined: Fri Apr 06, 2007 8:26 pm

Post » Wed Jun 20, 2012 5:41 am

Ok, so the NPC has to be alive for this to work. Of course it still suffers from the grey-face problem and the face textures don't change to match the new race but it does work. Using SetRace() on dead NPCs will fail.

Yeah, there was a guy doing a lich mod who wanted to make a dead copy of the player and he probably had to do that as well. Don't know how he managed to copy the players' facemorphs onto the NPC before killing it though.
User avatar
Lil Miss
 
Posts: 3373
Joined: Thu Nov 23, 2006 12:57 pm

Post » Wed Jun 20, 2012 3:30 am

Possibly via http://www.creationkit.com/PlaceAtMe_-_ObjectReference. If I remember correctly, and it's still the same as previous games, that could create an actor with the same race and facial data as the player.

Cipscis
User avatar
Samantha hulme
 
Posts: 3373
Joined: Wed Jun 21, 2006 4:22 pm

Post » Wed Jun 20, 2012 7:27 am

I too am having issues with setrace--on living NPC's even. It seems as though unless they race you are setting the target to and the race you are originally are connected via "morphrace", things don't work out properly. I cannot seem to find a reliable way around this, and I think it may require waiting on SKSE to update before we can really do anything about it. I've tried a ton of different options, but nothing seems to work as I want it to. Reverse engineering the werewolf/vampire code has also proved to be fruitless for me.

What all do you wish to do? Is race the only aspect you are concerned with? Or are you hoping to change name, six, or face data as well?

Yeah, there was a guy doing a lich mod who wanted to make a dead copy of the player and he probably had to do that as well. Don't know how he managed to copy the players' facemorphs onto the NPC before killing it though.
I didn't. I ended up scrapping the idea all together and opted for a crappy workaround that I've yet to even implement.

Possibly via http://www.creationkit.com/PlaceAtMe_-_ObjectReference. If I remember correctly, and it's still the same as previous games, that could create an actor with the same race and facial data as the player.

Cipscis
If Arthmoors goal is to create an exact look alike of the player (something I myself have tried to do), I think he's out of luck. Changing the race is one thing, but a copy of the player, or any unique actor for that matter, is another.

Yes, placeatme will solve this--you can create an exact duplicate of any actor or object in game and place it wherever you want. However, there is a a big issue with modifying, killing, or resurrecting unique actors. The simple act of creating a "copy" of a unique actor probably breaks a lot of stuff, and quite honestly I can't be bothered to test it. Many quests rely on unique actors to fill their reference aliases, and run code when they die/change cells and possibly much more. It's likely that they would either readjust their targets to the copy, or consider them both to be one in the same afterwards. I think it's a really bad idea to do this, especially to the player.

I've tried it myself. You cannot kill the "player duplicate" without killing the original player. And restoring the player from death has easily been one of the most buggy and unreliable actions I've ever tried to do.
User avatar
kasia
 
Posts: 3427
Joined: Sun Jun 18, 2006 10:46 pm

Post » Wed Jun 20, 2012 3:26 am

If Arthmoors goal is to create an exact look alike of the player (something I myself have tried to do), I think he's out of luck. Changing the race is one thing, but a copy of the player, or any unique actor for that matter, is another.
Nope. Just to have a dead NPC that's the same race and gender as the player, so that it's semi-plausible for the player to assume the dead person's identity and make it less jarring to have everyone talking to you like they know you from Helgen when your character had never been there.
User avatar
Susan Elizabeth
 
Posts: 3420
Joined: Sat Oct 21, 2006 4:35 pm

Post » Wed Jun 20, 2012 11:12 am

So much for CreateActorCopy.
User avatar
Peetay
 
Posts: 3303
Joined: Sun Jul 22, 2007 10:33 am

Post » Tue Jun 19, 2012 11:40 pm


Nope. Just to have a dead NPC that's the same race and gender as the player, so that it's semi-plausible for the player to assume the dead person's identity and make it less jarring to have everyone talking to you like they know you from Helgen when your character had never been there.
Even that though, isn't possible. To my knowledge, there is no command for switching an actors gender.
User avatar
JUDY FIGHTS
 
Posts: 3420
Joined: Fri Jun 23, 2006 4:25 am

Post » Wed Jun 20, 2012 8:01 am

What, nohttp://en.wikipedia.org/wiki/Ranma_%C2%BDcurses?

(Fake Chinese accent): Oooh! you fall in Spring of Drowned Skeever! There is a very sad story of a skeever who drowned in that spring 1550 years ago! Is very cursed spring!
User avatar
Pat RiMsey
 
Posts: 3306
Joined: Fri Oct 19, 2007 1:22 am

Post » Wed Jun 20, 2012 9:23 am

Seriously there should be a way to load the facemorph data from an actor...I know you can edit them in the Actor panel to make an NPC have a unique face, but I haven't found a function to save facemorph data yet. (Interestingly, most of the beth-made unique NPCs I've seen don't have a skin defined...
User avatar
Nichola Haynes
 
Posts: 3457
Joined: Tue Aug 01, 2006 4:54 pm

Post » Tue Jun 19, 2012 8:26 pm

Or you could make a holding cell, fill it with one NPC of each race and gender and then port in the one you need. Might be easier than changing data on an actor on the fly.
User avatar
Maeva
 
Posts: 3349
Joined: Mon Mar 26, 2007 11:27 pm

Post » Wed Jun 20, 2012 6:04 am

So much for CreateActorCopy.
Would have been nice, but that function doesn't exist. Besides, I don't want an exact clone anyway.

Even that though, isn't possible. To my knowledge, there is no command for switching an actors gender.
Yep, I realized this after I went looking for the function to do it. At least we do have Getsix() so I can just enable a female NPC instead to accomplish this.
User avatar
No Name
 
Posts: 3456
Joined: Mon Dec 03, 2007 2:30 am

Post » Tue Jun 19, 2012 7:26 pm

You need a wait between set and get it won't be instant because of multithreading.
User avatar
Petr Jordy Zugar
 
Posts: 3497
Joined: Tue Jul 03, 2007 10:10 pm


Return to V - Skyrim