shavkacagarikia Posted June 30, 2017 Share Posted June 30, 2017 No it won't. It has logical and syntax problems. You cannot use "while" like that. I understand what you expect it to do but it won't run just from nowhere. I said somwewhere earlier that you need animation event which determines when character draws/sheathes weapon. IsWeapondrawn is for checking. And it should be called on player not on the armor. I'll suggest my version of the script tomorrow Link to comment Share on other sites More sharing options...
stonefisher Posted June 30, 2017 Share Posted June 30, 2017 How about this? And i found the well hidden list of new animation events for fallout 4. Its really short. Scriptname CGXAM_GhostGoggles extends ObjectReference Armor Property CGXAM_CourserGhostX92Goggles Auto Keyword property CGXAMGhostX92GogglesDown auto Keyword property CGXAMGhostX92GogglesUp auto Keyword property CGXAMGhostX92GogglesPulsingDown auto Keyword property CGXAMGhostX92GogglesPulsingUp auto ObjectReference Goggles Function SomeFunction() RegisterForAnimationEvent(game.getplayer, "weaponDraw") EndFunction Function SomeFunction() RegisterForAnimationEvent(game.getplayer, "weaponSheathe") EndFunction Event OnItemEquipped(Form akBaseObject, ObjectReference akReference) Goggles = akBaseObject If (Goggles.haskeyword(CGXAMGhostX92GogglesDown)) Self.AttachMod(CGXAMGhostX92GogglesUp) ElseIF (Goggles.haskeyword(CGXAMGhostX92GogglesPulsingDown)) Self.AttachMod(CGXAMGhostX92GogglesPulsingUp) EndIf EndEvent Event OnAnimationEvent(ObjectReference akSource, string asEventName) if (akSource == Game.GetPlayer()) && (asEventName == "weaponDraw") If (Goggles.haskeyword(CGXAMGhostX92GogglesUp)) Self.AttachMod(CGXAMGhostX92GogglesDown) ElseIF (Goggles.haskeyword(CGXAMGhostX92GogglesPulsingUp)) Self.AttachMod(CGXAMGhostX92GogglesPulsingDown) EndIf endEvent Event OnAnimationEvent(ObjectReference akSource, string asEventName) if (akSource == Game.GetPlayer()) && (asEventName == "weaponSheathe") If (Goggles.haskeyword(CGXAMGhostX92GogglesDown)) Self.AttachMod(CGXAMGhostX92GogglesUp) ElseIF (Goggles.haskeyword(CGXAMGhostX92GogglesPulsingDown)) Self.AttachMod(CGXAMGhostX92GogglesPulsingUp) EndIf endEvent Link to comment Share on other sites More sharing options...
shavkacagarikia Posted June 30, 2017 Share Posted June 30, 2017 (edited) Better. You don't need two onanimationevent event blocks. You can differentiate received events with one block and checking asEventName. Also there is better way to check keywords. Use game.getplayer().wornhaskeyword() it checks keywords of currently worn item so you won't need to check baseobject keywords.Also you should do different stuff inside onitemequipped. It should do checking with isWeaponDraw and also you should register for anim events from there. If isweapondrawn is true when item equipped you should then check which keyword player has and and do appropriate actions - Register for sheathe and attach goggles on eyes mod or if player already has goggles on eyes just register for sheathe. And so on. Edited June 30, 2017 by shavkacagarikia Link to comment Share on other sites More sharing options...
stonefisher Posted June 30, 2017 Share Posted June 30, 2017 (edited) nm Edited June 30, 2017 by stonefisher Link to comment Share on other sites More sharing options...
stonefisher Posted June 30, 2017 Share Posted June 30, 2017 Ok how about this then?Shifty eyes, I forgot to do the object mods before. Scriptname CGXAM_GhostGoggles extends ObjectReference Armor Property CGXAM_CourserGhostX92Goggles Auto Keyword property CGXAMGhostX92GogglesDown auto Keyword property CGXAMGhostX92GogglesUp auto Keyword property CGXAMGhostX92GogglesPulsingDown auto Keyword property CGXAMGhostX92GogglesPulsingUp auto ObjectMod Property CGXAM_mod_CourserGhostX92GogglesDown Auto ObjectMod Property CGXAM_mod_CourserGhostX92GogglesUp Auto ObjectMod Property CGXAM_mod_CourserGhostX92GogglesPulsingDown Auto ObjectMod Property CGXAM_mod_CourserGhostX92GogglesPulsingUp Auto Event OnItemEquipped(Form akBaseObject, ObjectReference akReference) if (Game.getplayer().IsWeaponDrawn() == true) If (Game.getplayer().wornhaskeyword(CGXAMGhostX92GogglesUp)) Self.AttachMod(CGXAM_mod_CourserGhostX92GogglesDown) RegisterForAnimationEvent(game.getplayer, "weaponDraw") RegisterForAnimationEvent(game.getplayer, "weaponSheathe") Else (Game.getplayer().wornhaskeyword(CGXAMGhostX92GogglesPulsingUp)) Self.AttachMod(CGXAM_mod_CourserGhostX92GogglesPulsingDown) ElseIF (Game.getplayer().IsWeaponDrawn() == false) RegisterForAnimationEvent(game.getplayer, "weaponDraw") RegisterForAnimationEvent(game.getplayer, "weaponSheathe") EndIf EndIf EndEvent Event OnAnimationEvent(ObjectReference akSource, string asEventName) if (akSource == Game.GetPlayer()) && (asEventName == "weaponDraw") If (game.getplayer().wornhaskeyword(CGXAMGhostX92GogglesUp)) Self.AttachMod(CGXAM_mod_CourserGhostX92GogglesDown) ElseIF (game.getplayer().wornhaskeyword(CGXAMGhostX92GogglesPulsingUp)) Self.AttachMod(CGXAM_mod_CourserGhostX92GogglesPulsingDown) EndIf if (akSource == Game.GetPlayer()) && (asEventName == "weaponSheathe") If (game.getplayer().wornhaskeyword(CGXAMGhostX92GogglesDown)) Self.AttachMod(CGXAM_mod_CourserGhostX92GogglesUp) ElseIF (game.getplayer().wornhaskeyword(CGXAMGhostX92GogglesPulsingDown)) Self.AttachMod(CGXAM_mod_CourserGhostX92GogglesPulsingUp) EndIf endEvent Event OnItemUnequipped(Form akBaseObject, ObjectReference akReference) UnregisterForAnimationEvent(game.getplayer, "weaponDraw") UnregisterForAnimationEvent(game.getplayer, "weaponSheathe") EndEvent Link to comment Share on other sites More sharing options...
shavkacagarikia Posted July 1, 2017 Share Posted July 1, 2017 (edited) Almost. There are syntax errors inside onitemequipped, take another look and you will see. And you need one more checking if player has goggles on eyes if isweapondrawn is false to attach goggles on forehead mod. Edited July 1, 2017 by shavkacagarikia Link to comment Share on other sites More sharing options...
r00stafarian Posted July 1, 2017 Author Share Posted July 1, 2017 I just learned how to do animations in Fallout using Nifscope. I wonder if this can be used instead of two different nif files?There are two animation sequences: "OnForehead" (animates visor going on forehead) and "OverEyes" (animates visor going over eyes). The gif above shows the animations back to back.You can download the nif here to play with. (removed the head mesh) Link to comment Share on other sites More sharing options...
shavkacagarikia Posted July 1, 2017 Share Posted July 1, 2017 I just learned how to do animations in Fallout using Nifscope. I wonder if this can be used instead of two different nif files?There are two animation sequences: "OnForehead" (animates visor going on forehead) and "OverEyes" (animates visor going over eyes). The gif above shows the animations back to back.You can download the nif here to play with. (removed the head mesh)Yes it's possible. But you haven't provided textures so model is just invisible in ck so I cannot mess with it. Also problem probably will be that after animation is played mesh returns to start position. can you add two more states for it? One on forehead and other for over eyes. they will be called after animation call to make sure glasses stay at corrent place. Link to comment Share on other sites More sharing options...
stonefisher Posted July 1, 2017 Share Posted July 1, 2017 Ah I have forgotten to add a:RegisterForAnimationEvent(game.getplayer, "weaponDraw")RegisterForAnimationEvent(game.getplayer, "weaponSheathe")in the else section of on itemequipped section. And add mod equip to put all mods in up position. Link to comment Share on other sites More sharing options...
stonefisher Posted July 1, 2017 Share Posted July 1, 2017 @r00stafarian I dont know anything about using 1 nif to show the goggles in two positions as you have chosen to rotate a part of the nif and not the whole niff in your animation. If its just to reduce the number of nifs you produce generally materialswaps is the way to go. OMOD's handle materialswaps really well though I do not know if you can swap materials with just scripts and not using OMOD's. @shavkacagarikia Hows this then: Scriptname CGXAM_GhostGoggles extends ObjectReference Armor Property CGXAM_CourserGhostX92Goggles Auto Keyword property CGXAMGhostX92GogglesDown auto Keyword property CGXAMGhostX92GogglesUp auto Keyword property CGXAMGhostX92GogglesPulsingDown auto Keyword property CGXAMGhostX92GogglesPulsingUp auto ObjectMod Property CGXAM_mod_CourserGhostX92GogglesDown Auto ObjectMod Property CGXAM_mod_CourserGhostX92GogglesUp Auto ObjectMod Property CGXAM_mod_CourserGhostX92GogglesPulsingDown Auto ObjectMod Property CGXAM_mod_CourserGhostX92GogglesPulsingUp Auto Event OnItemEquipped(Form akBaseObject, ObjectReference akReference) RegisterForAnimationEvent(game.getplayer, "weaponDraw") RegisterForAnimationEvent(game.getplayer, "weaponSheathe") if (Game.getplayer().IsWeaponDrawn() == true) If (Game.getplayer().wornhaskeyword(CGXAMGhostX92GogglesUp)) Self.AttachMod(CGXAM_mod_CourserGhostX92GogglesDown) ElseIF (Game.getplayer().wornhaskeyword(CGXAMGhostX92GogglesPulsingUp)) Self.AttachMod(CGXAM_mod_CourserGhostX92GogglesPulsingDown) ElseIF (Game.getplayer().IsWeaponDrawn() == false) If (Game.getplayer().wornhaskeyword(CGXAMGhostX92GogglesDown)) Self.AttachMod(CGXAM_mod_CourserGhostX92GogglesUp) ElseIF (Game.getplayer().wornhaskeyword(CGXAMGhostX92GogglesPulsingDown)) Self.AttachMod(CGXAM_mod_CourserGhostX92GogglesPulsingDown) EndIf EndIf EndEvent Event OnAnimationEvent(ObjectReference akSource, string asEventName) if (akSource == Game.GetPlayer()) && (asEventName == "weaponDraw") If (game.getplayer().wornhaskeyword(CGXAMGhostX92GogglesUp)) Self.AttachMod(CGXAM_mod_CourserGhostX92GogglesDown) ElseIF (game.getplayer().wornhaskeyword(CGXAMGhostX92GogglesPulsingUp)) Self.AttachMod(CGXAM_mod_CourserGhostX92GogglesPulsingDown) EndIf if (akSource == Game.GetPlayer()) && (asEventName == "weaponSheathe") If (game.getplayer().wornhaskeyword(CGXAMGhostX92GogglesDown)) Self.AttachMod(CGXAM_mod_CourserGhostX92GogglesUp) ElseIF (game.getplayer().wornhaskeyword(CGXAMGhostX92GogglesPulsingDown)) Self.AttachMod(CGXAM_mod_CourserGhostX92GogglesPulsingUp) EndIf endEvent Event OnItemUnequipped(Form akBaseObject, ObjectReference akReference) UnregisterForAnimationEvent(game.getplayer, "weaponDraw") UnregisterForAnimationEvent(game.getplayer, "weaponSheathe") EndEvent Link to comment Share on other sites More sharing options...
Recommended Posts