Jump to content

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


Recommended Posts

  • Replies 86
  • Created
  • Last Reply

Top Posters In This Topic

hmm. dousnt compile:

 

Papyrus Compiler Version 2.8.0.4 for Fallout 4
Copyright © ZeniMax Media. All rights reserved.
Starting 1 compile threads for 1 files...
Compiling "CGXAM_GhostGoggles.psc"...
H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(30,0): mismatched input 'EndEvent' expecting ENDIF
H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(45,0): mismatched input 'endEvent' expecting ENDIF
H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(47,28): no viable alternative at input 'akBaseObject'
H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(47,69): required (...)+ loop did not match anything at input ')'
No output generated for CGXAM_GhostGoggles.psc, compilation failed.
Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on CGXAM_GhostGoggles.psc
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.

 

The textures are located on my mods page (main file here including all the armors and goggles meshes/textures). I can provide a separate download link just for the goggles textures if the main file is too big. Also, I have made the animations in CLAMP mode (think not continuous) and are the same way doors are animated in game.

Link to comment
Share on other sites

 

hmm. dousnt compile:

 

Papyrus Compiler Version 2.8.0.4 for Fallout 4
Copyright © ZeniMax Media. All rights reserved.
Starting 1 compile threads for 1 files...
Compiling "CGXAM_GhostGoggles.psc"...
H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(30,0): mismatched input 'EndEvent' expecting ENDIF
H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(45,0): mismatched input 'endEvent' expecting ENDIF
H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(47,28): no viable alternative at input 'akBaseObject'
H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(47,69): required (...)+ loop did not match anything at input ')'
No output generated for CGXAM_GhostGoggles.psc, compilation failed.
Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on CGXAM_GhostGoggles.psc

 

you are missing endif inside isweapondrawn== true. Also missing two more endifs inside onanimation event.

Link to comment
Share on other sites

Well tried this script

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)
		EndIf
	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
	ElseIf (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
	EndIf
endEvent

Event OnItemUnequipped(Form akBaseObject, ObjectReference akReference)
	UnregisterForAnimationEvent(game.getplayer, "weaponDraw")
	UnregisterForAnimationEvent(game.getplayer, "weaponSheathe")
EndEvent 

and got these errors now. Something else it dousnt like.

 

Papyrus Compiler Version 2.8.0.4 for Fallout 4
Copyright © ZeniMax Media. All rights reserved.
Starting 1 compile threads for 1 files...
Compiling "CGXAM_GhostGoggles.psc"...
H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(16,32): a property cannot be used directly on a type, it must be used on a variable
H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(16,32): getplayer is not a property on script game or one of its parents
H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(17,32): a property cannot be used directly on a type, it must be used on a variable
H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(17,32): getplayer is not a property on script game or one of its parents
H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(15,0): new event onitemequipped cannot be defined because the script is not flagged as native
H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(50,34): a property cannot be used directly on a type, it must be used on a variable
H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(50,34): getplayer is not a property on script game or one of its parents
H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(51,34): a property cannot be used directly on a type, it must be used on a variable
H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(51,34): getplayer is not a property on script game or one of its parents
H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(49,0): new event onitemunequipped cannot be defined because the script is not flagged as native
No output generated for CGXAM_GhostGoggles.psc, compilation failed.
Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on CGXAM_GhostGoggles.psc
Link to comment
Share on other sites

Missing () on getplayer when registeringforanimevent. Also I have commented something similar on your different post, You cannot use onitemequipped and onitemunequipped on script that extends objectreference, they are Actor script events. Use onEquipped() and onUnEquipped() instead. Edited by shavkacagarikia
Link to comment
Share on other sites

Well, just tested the script posted below, the googles go to the right position depending if the weapon is drawn or not when equipped but it does not change when i draw and sheathe my weapon. I think there is something wrong with the animation event bit. Cant spot the problem myself so far...

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 OnEquipped(Actor akActor)
	if akActor == Game.GetPlayer()
		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)
			EndIf
		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
	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
	ElseIf (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
	EndIf
endEvent

Event OnUnequipped(Actor akActor)
	if akActor == Game.GetPlayer()
		UnregisterForAnimationEvent(game.getplayer(), "weaponDraw")
		UnregisterForAnimationEvent(game.getplayer(), "weaponSheathe")
	EndIf
EndEvent
Link to comment
Share on other sites

Well corrected the typo here and still dousnt work :sad: RegisterForAnimationEvent(game.getplayer(), "weaponDraw")

 

Also tried using: BeginWeaponDraw and BeginWeaponSheathe

 

And also tried WeaponDraw instead of WeaponDrawn cause of a website listing animations.

Edited by stonefisher
Link to comment
Share on other sites

Hmm can't spot what's a problem. Correct event names are "weaponDraw" and "weaponSheathe" I'm sure as I have used them in the past.

 

I have script which plays needed nif animation based on weapon state. Just can't test it as .nif which author had provided has problem and is invisible. We can continue messing with this omod swap method, but as author prefers animation play, let's wait until he fixes that nif.

Link to comment
Share on other sites

He has put the missing components in this forum thread i believe.

 

https://forums.nexusmods.com/index.php?/topic/5774852-need-help-getting-an-animated-outfit-to-show-in-the-ck/

 

 

 

Yeah I tired with the correct "weaponDraw" and "weaponSheathe" event names as well as the "BeginWeaponDraw" and "BeginWeaponSheathe" event names.

 

I have found an animation logging script on the bethesda forums which I asked about here: https://forums.nexusmods.com/index.php?/topic/5776932-animation-log-script/

but cannot work out how to use. I was hoping to find out what events were happening from it.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...