Facial Manipulation via SKSE scripts crashes game.

Post » Sun Nov 18, 2012 11:46 am

I have a spell I'm trying to make that would basically set the player's face to be the same as the actor's that the spell is cast upon. Here is the script:
Scriptname PCKP_FaceShiftScript extends activemagiceffectevent OnEffectStart(Actor Target, Actor Caster);Caster.KillSIlent()ActorBase CasterB = Caster.GetActorBase()ActorBase TargetB = Target.GetActorBase()int HeadPartsN = TargetB.GetNumHeadParts()int i = 0	  while i < HeadPartsNif TargetB.GetNthHeadPart(i) as HeadPartCasterB.SetNthHeadPart(TargetB.GetNthHeadPart(i), i)CasterB.SetFaceMorph(TargetB.GetFaceMorph(i), i)endIfi=i+1endWhileCasterB.SetWeight(TargetB.GetWeight())CasterB.SetHairColor(TargetB.GetHairColor());Caster.disable();Caster.enable()endEvent

Trouble is, I get no compiler errors, but the thing crashes the game so fast that seemingly the debug log doesn't even have time to register whatever is going on. Now, I have never seen anyone else using these functions nor is there any documentation for them on the wiki. Can they be used this way?

ALso, I've switched the actor and target around before (to make the target become a copy of me) thinking that the problem might be simply that the player's face can't be manipulated ad hoc. This also crashes the game.

Next thing I'm going to try is disabling the actor, then making the changes, and finally re-enabling them. We'll see if that helps.
EDIT: Nope, still crashes immediately.
User avatar
Louise Dennis
 
Posts: 3489
Joined: Fri Mar 02, 2007 9:23 pm

Post » Sun Nov 18, 2012 9:18 pm

OH YE ELDER GODS OF SCRIPTING BESTOW THINE WISDOM UNTO ME!!!!!!!!
(aka, bump)
User avatar
Loane
 
Posts: 3411
Joined: Wed Apr 04, 2007 6:35 am

Post » Sun Nov 18, 2012 9:35 am

Well, for one, are the head parts indexed starting from 1? If so, at the beginning you are out of index . Let me rephrase, does the function expect "0" to map to the first element, or "1" to map to the first element?

Also, I would do some checking to make sure the head parts are equal on each actor.
User avatar
N3T4
 
Posts: 3428
Joined: Wed Aug 08, 2007 8:36 pm

Post » Sun Nov 18, 2012 2:24 pm

I tried that index thing. Didn't work. Don't know how I would check to see if the headparts are equal...
User avatar
suzan
 
Posts: 3329
Joined: Mon Jul 17, 2006 5:32 pm

Post » Mon Nov 19, 2012 1:45 am

I'm not positive on this, but from looking at source code for this function the SKSE team has some comments saying that they need to invoke a method that will update the FaceGen for head parts, which, I assume, means that any changes you make will not be updated in the game without this function. This is as of 1.7.7, so it may mean that something is wrong/missing from the function, and you have to wait until it's complete. I, unfortunately, don't know why this might cause a crash, but it could be your culprit.
DE
User avatar
Jaki Birch
 
Posts: 3379
Joined: Fri Jan 26, 2007 3:16 am

Post » Sun Nov 18, 2012 12:46 pm

There are rare moments where I wish cursing were allowed on the gamesas forums.

This is one of those moments.
User avatar
Charleigh Anderson
 
Posts: 3398
Joined: Fri Feb 02, 2007 5:17 am

Post » Sun Nov 18, 2012 8:28 pm

if it's anything like slotmask, your slotpart integer will return a value of something like "0x00000001" and not "1"

i would dump the value in a debug to make sure. because if it is like that you cant run sequential loops on it unless you store it in an array first.
User avatar
jess hughes
 
Posts: 3382
Joined: Tue Oct 24, 2006 8:10 pm

Post » Sun Nov 18, 2012 10:21 am

if it's anything like slotmask, your slotpart integer will return a value of something like "0x00000001" and not "1"

i would dump the value in a debug to make sure. because if it is like that you cant run sequential loops on it unless you store it in an array first.
I don't think so... GetNth and SetNth imply integer values, and also GetSlotMask and SetSlotMask take integer values.

I used this code (on myself no less), in an existing OnEffectStart block in a mod I'm testing:
        int HeadPartsN = Target.GetActorBase().GetNumHeadParts()        int i = 0        while i < HeadPartsN            if (Target.GetActorBase().GetNthHeadPart(i))                Target.GetActorBase().SetNthHeadPart(Target.GetActorBase().GetNthHeadPart(i), i)                Target.GetActorBase().SetFaceMorph(Target.GetActorBase().GetFaceMorph(i), i)            EndIf            debug.trace(Target.GetActorBase().GetNthHeadPart(i))            debug.trace(Target.GetActorBase().GetFaceMorph(i))            i += 1        endWhile

And it doesn't crash. It outputs this:
[08/26/2012 - 04:35:38PM] [HeadPart ][08/26/2012 - 04:35:38PM] 0.060000[08/26/2012 - 04:35:38PM] [HeadPart ][08/26/2012 - 04:35:38PM] 0.100000[08/26/2012 - 04:35:38PM] [HeadPart ][08/26/2012 - 04:35:38PM] 0.080000[08/26/2012 - 04:35:38PM] [HeadPart ][08/26/2012 - 04:35:38PM] -1.000000[08/26/2012 - 04:35:38PM] [HeadPart ][08/26/2012 - 04:35:38PM] 0.040000[08/26/2012 - 04:35:38PM] [HeadPart ][08/26/2012 - 04:35:38PM] 0.020000[08/26/2012 - 04:35:38PM] [HeadPart ][08/26/2012 - 04:35:38PM] 0.500000[08/26/2012 - 04:35:38PM] [HeadPart ][08/26/2012 - 04:35:38PM] 0.500000

I think it has to be crashing for some reason relating to the target and the caster differing. Either in NumHeadParts or the values they can receive. Maybe the order of the head parts is not the same for each race.
User avatar
Monika Krzyzak
 
Posts: 3471
Joined: Fri Oct 13, 2006 11:29 pm


Return to V - Skyrim