Haravikk Posted September 20, 2017 Share Posted September 20, 2017 So I'm making a mod which adds custom "races" which are actually just variants like vampires are in the vanilla game, with one for each vanilla race. I've based my custom races on the RaceCompatibility for Skyrim and Dawnguard mod, with some minor appearance changes that should not affect the head (I'm using the vanilla head models, textures etc., and altering the head appearance minimally using a custom "helmet" instead). To switch NPC's to these custom "races" I then simply use akActor.SetRace(customRace), plus adding them to a faction and form list for easier handling later, and giving and equipping the helmet. Now, the problem I'm encountering is that lip-syncing stops working after switching them; they don't move their mouth at all, even though they should be perfectly compatible. In fact I can prove this because if I switch their race while they're in the same cell as me, their mouth moves correctly, but only for as long as we are in the same cell, if either of us leaves then the mouth movement stops working. If I change them back to their original race the mouth movements immediately start working again. I'm at a bit of a loss as to what the problem might be; at first I thought that it might be because my custom races aren't on the appropriate form lists, which the mouth parts make reference to, however the elven races aren't either and yet they work just fine, despite using a mouth part that only references human races. It's also strange that the mouth movement works fine in the same cell (proving that it can work) but then stops if any cell transition is involved. I've also tried disabling the "helmet" part to see if that was the cause, but it made no difference. I've found a few similar threads from a while back with similar sounding issues, but no conclusive solutions (except one to manually export and reimport NPC's, but this is a no-go for me as arbitrary NPCs can be affected). I'm hoping someone might know why this issue occurs, and whether I can fix it somehow? I've already tried adding my races to the form lists used by the mouth parts, and I've also tried calling the SKSE akActor.RegenerateFace() function but neither makes a difference. The only workaround I can think of would be to have the NPC's reapply the custom race each time they enter a cell with the player (or vice versa), but this seems an incredibly heavy workaround (and I'm not of the best way to do it). Are there any alternatives? If not, can anyone suggest the most efficient way to detect this same cell condition so I can switch the races with as little impact as possible? Link to comment Share on other sites More sharing options...
DavidJCobb Posted September 22, 2017 Share Posted September 22, 2017 I've never worked with these values myself, but I'm aware that Race forms have morph values for phoneme lip movements. Compare the values on your Races to those of a vanilla Race that speaks: are you sure your values are intact? Besides that, you're modifying an Actor's race at run-time. Perhaps this is some rare oddity with how the script engine makes that change? Try creating a base Actor that uses your custom race from the very start, without any scripts tampering with it. Place that Actor in a cell and try talking to it in-game. Is it bugged, or not? Link to comment Share on other sites More sharing options...
Haravikk Posted September 23, 2017 Author Share Posted September 23, 2017 Thanks for the suggestion! So yes the lip-syncing does indeed work fine on a custom NPC set to one of the custom races, so the problem must be something to do with calling .SetRace() via script. Any ideas what I can do about it then? The only workaround I can think of is "resetting" their race somehow when the player enters the same cell (or the NPC does), i.e- setting them back to their original race, then to the custom race again, as this sorts the lip-syncing issue. If that's the only way, what would be the best way to do this? There doesn't look to be a reliable event for "NPC and player are in the same cell", and the workaround on the Creation Kit wiki looks to use a spell on the player which doesn't seem ideal (as the NPCs that need "resetting" should be relatively uncommon). It looks like Skyrim doesn't have the distance less than/greater than events (unless I've missed them somewhere?) as that seemed like it would have been a good way, as the events could be registered and handled by a single quest script. The only obvious alternative I could find was Line of Sight tracking but that seems like it could be a very inefficient way to do it. What are the other options? Attach a script to the NPC, use a spell? Could an AI package work somehow? This is where my general unfamiliarity with all of these is going to slow me down a bit. :D So I guess this thread is now about how to most efficiently detect when an NPC and the player are in the same cell, and trigger an event/function so I can "reset" them. Link to comment Share on other sites More sharing options...
DavidJCobb Posted September 23, 2017 Share Posted September 23, 2017 I'd use a spell conditioned to GetInSameCell (with an OnEffectStart Papyrus handler on the magic effect), but I'd put the spell on a Quest Alias pointed at the actor instead of modifying the ActorBase directly. This has two benefits: if I need to get rid of the script on existing savegames for some reason, I'm 60% sure I could just delete the quest and alias and it'll be fine; and if I don't "own" the actor (i.e. they're vanilla or from a mod), I can avoid breaking compatibility with everyone else. You're right that the distance events are Fallout 4-only. LOS tracking may be less efficient, but I can't say how much; in particular, LOS checks on the player use the camera instead of the actor, so Bethesda may have had a few different opportunities to optimize them. Link to comment Share on other sites More sharing options...
Haravikk Posted September 27, 2017 Author Share Posted September 27, 2017 (edited) Okay, so I've got the spell working as expected by setting it up as an ability, with an effect limited to the same cell as the player that runs a reset race function from the OnEffectStart() event. This seems to work as expected if I add it manually to an NPC using AddSpell. However, I'm not clear on how to add this to NPCs using a quest alias; is this something that I need to do dynamically somehow? I tried adding an alias using Find Matching Reference In Loaded Area, with a GetInFaction condition for the faction that I've added all changed NPC's to, and with my spell set under Alias Spells, however they don't appear to be receiving the spell. Perhaps I'm misunderstanding how/when the quest aliases are actually applied? I've only ever used them before to target specific objects/actors, not anything dynamic like a faction (and not to apply a spell) :) Edited September 27, 2017 by Haravikk Link to comment Share on other sites More sharing options...
GSGlobe Posted September 28, 2017 Share Posted September 28, 2017 (edited) Im a novice but would applying a script dynamically using a cloak spell work? Or use the cloak to IF actor X fill int on quest and IF int 1 or whatever cast the spell? Lol this is above me Use line of sight as a condition? Im trying to understand the above but just balling ideas: Giving spells to actor would be ok using cloak script. Edited September 28, 2017 by GSGlobe Link to comment Share on other sites More sharing options...
DavidJCobb Posted September 28, 2017 Share Posted September 28, 2017 (edited) Quest aliases are filled (or fail) when the quest starts, and an alias may point to at most one reference. I presume your actors have the Unique flag set? I'd use that method to target them -- have the aliases each target a unique actor. Note that aliases only fill when the quest starts. If you add new aliases, you will also have to devise a way to restart the quest in-game. All that said: if this needs to apply only in the same cell, then GSGlobe's idea might be better than this one, actually. Have a cloak spell apply a magic effect, and use spell-side conditions to filter to your faction and effect-side conditions to check the cell... maybe. Conditions get weird when working with cloak/concentration effects; refer to the CK wiki and be ready to trial-and-error things a bit. Edited September 28, 2017 by DavidJCobb Link to comment Share on other sites More sharing options...
GSGlobe Posted September 28, 2017 Share Posted September 28, 2017 (edited) Scriptname YourCloak extends activemagiceffect YourQuestScript Property Actor AutoActor Property PlayerRef AutoFaction Property YourFaction AutoFaction Property SpecificFaction Auto Bool boActor = FALSE EVENT OnEffectStart(Actor akTarget, Actor akCaster) IF akTarget != None && akTarget != PlayerRef && !akTarget.IsDead() && !akTarget.IsHostileToActor(PlayerRef) && PlayerRef.HasLOS(akTarget) && akTarget.IsInFaction(YourFaction) boActor = TRUE ; Basic checks. ENDIF IF (Whatever Extra Condition) & boActor ; Target a Specific Actor IF akTarget.IsInFaction(SpecificFaction) ;;Cast your spellWhateverSpell.Cast(PlayerRef) ;; RETURN ENDIF ENDIF Idea behind this is, you group up all your actors into "YourFaction" then take your single actor into a specificFaction and if condition is true it will cast a spell. or just drop them all into YourFaction and go from there, I'm a novice .. trying to get functions run from quest myself so if your not gonna put functions in a quest or whatever you can just remove the quest property thing.. maybe it will be useful for you. Edit: This is a single cast spell, if you want a constant one, you should look into Fire cloak and its the Associated? thing that does the damage, that's where you wanna put the script if you want it constantly when whatever condition is met so not to have it run constantly.The above script could perhaps be fired when talking to a specific npc to target him directly or something.. I have no clue, just balling ideas perhaps someone else can help you better as I'm still learning.. I'm seeking help here aswell, just a post or so below .. Hope you manage to find a solution! Edited September 28, 2017 by GSGlobe Link to comment Share on other sites More sharing options...
Angerer Posted March 30, 2018 Share Posted March 30, 2018 My Elorwen follower has this problem. Others work fine, but she stays tight lipped. Any help with a fix would be appreciated. Link to comment Share on other sites More sharing options...
Recommended Posts