Jump to content

Changing headparts via script


Drazhar753

Recommended Posts

I wrote a debugging code and I have been testing on Player Alias

Event OnSit(ObjectReference akFurniture)
	
	Actor Me = self.GetActorReference()
	ActorBase Playerb = Me.GetBaseObject() as ActorBase
	Int PlayerEyesB = PlayerB.GetNthHeadPart(4).GetType() 
	Headpart PlayerEyesC = PlayerB.GetNthHeadPart(4)
	DEBUG.MessageBox("the code b return a int of \n\n"+ PlayerEyesB + "\n\ncode C return a Headpart of " + PlayerEyesC )
	;Playerb.SetNthHeadPart(EyePartList.getat(0) as headpart, 2) 


	;Playerb.SetNthHeadPart(PlayerEyesC, 2)

EndEvent

& it is very inconsistent & doesn't match wiki so still trying but at look at the debugging code so you can adapt it try as well

Link to comment
Share on other sites

Scriptname AM_OcculentSightFX extends activemagiceffect  

FormList Property EyePartList  Auto  

GlobalVariable Property OcculentSightKeyGlobal Auto
Spell Property DetectItemSpell auto

MagicEffect Property DetectingMagic auto

Sound Property ReleaseSound Auto
Sound Property FizzleSound Auto

HeadPart PlayerEyes = none

int keyactivate

Int eyes

Event OnEffectStart(Actor akTarget, Actor akCaster)

    If akTarget == Game.GetPlayer()
        keyactivate = OcculentSightKeyGlobal.getvalueint()
        RegisterForKey(keyactivate)
        ActorBase Base = akTarget.GetBaseObject() as ActorBase
        int parts = Base.GetNumHeadParts()
        While parts > 0
            parts -= 1
            int Temp = Base.GetNthHeadPart(parts).GetType()
            If Temp == 4
                PlayerEyes = Base.GetNthHeadPart(Parts)
                eyes = parts
            endIf
        EndWhile
        Base.SetNthHeadPart(EyePartList.getat(0) as headpart, eyes)
        akTarget.QueueNiNodeUpdate()
    EndIf
endevent

Event OnEffectFinish(Actor akTarget, Actor akCaster)

    If akTarget == Game.GetPlayer()
        ActorBase Base = akTarget.GetBaseObject() as ActorBase
        Base.SetNthHeadPart(PlayerEyes, eyes)
        akTarget.QueueNiNodeUpdate()
        eyes = 0
    EndIf
endevent


Event OnKeyDown(Int aiKeyCode) ; This works fine

    if(Game.IsFightingControlsEnabled() == true && !Utility.IsInMenuMode())
        if(game.getplayer().IsAIEnabled())
            If aiKeyCode == keyactivate && game.getplayer().hasmagiceffect(DetectingMagic) == false
                DetectItemSpell.cast(game.getplayer())
                ReleaseSound.play(game.getplayer())
              elseif aiKeyCode == keyactivate && game.getplayer().hasmagiceffect(DetectingMagic) == true
                FizzleSound.play(game.getplayer())
              endif
        endif
    endif
endevent
 

Opps I merge our two scripts correctly this time I rush it cause it was taking so long & got wrong.

Edited by PeterMartyr
Link to comment
Share on other sites

It killing me that I can't tweak it & getting working 100% guarantee I Hope you can see it

Okay so yours works to some degree, but it's replacing the characters' head instead of the eyes as 4, for me anyway. The good news is that it is consistant across all races/sexes. I just need to tweak it till I find the correct number, 4 seems to be the head.

Link to comment
Share on other sites

that killing me i wish I could hlp I know i can tune it but need you mod, but i am very sure you will tweak it right

It's all good don't worry :). I found that it was 2 instead of 4, so that works now. I think I have it working, will do a bit more testing right now.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...