Jump to content
ℹ️ Intermittent Download History issues ×

Need help with scripts for an armor Mod I created recently.


Recommended Posts

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

  • Replies 86
  • Created
  • Last Reply

Top Posters In This Topic

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

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 by shavkacagarikia
Link to comment
Share on other sites

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

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 by shavkacagarikia
Link to comment
Share on other sites

giphy.gif

 

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

giphy.gif

 

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

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

@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

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...