» Tue Jun 19, 2012 1:50 pm
I'd like to report oddities in SetRace() papyrus function in Actor scripts.
First off, if SetRace() is called on an actor wielding a bound weapon, then their bound weapon will be bugged after the switch, usually leading to them brandishing an invisible version. Removing the bound weapon beforehand, waiting, switching races, and readding it afterwards routes around the issue.
Second, perhaps it isn't a bug, per se, but the SetRace() function applies to the base actor, rather than the instantiated actor. This makes it unusable and unpredictable in many cases of heavy use.
This was made quite apparent in my earlier versions of Automatic Variants.
This mod would create several race "Variants" to pick from, each with different artwork. A creature would then spawn and call SetRace() on a random race on the list to achieve different textures for the same NPC in-game.
This worked fine when NPCs were spawned one by one this way.
But, because the function was changing the base race the scripts "broke" if several NPCs were spawned at once (such as changing a cell).
For example:
All would initially spawn and have Race 1.
The first would change its race to, say, Race 7.
The second would have its base actor race now set to 7, but its current in-game instantiation race was Race 1. This would make it impossible for this NPC to pick Race 7 as Bethesdas script would bug out and think that it was already 7 (even though the instantiation was actually 1).
Third, I had reports that races were being improperly switched, such as chickens receiving giant races, and vice versa. This may have been happening when cells were changed and chickens and giants had their setRace() scripts running, and Bethesda's protocols accidentally swapped the races around. I didn't confirm that personally, however.