Jump to content

Weapon Animation


Medusa30

Recommended Posts

I have a problem getting my script for weapon animations to work. The animations dont run, when the animation event is fired. Can you help me out please?

 

Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
	if (AsenAsgardianBladeWeaponList.HasForm(akBaseObject)) && (IsAsgardianBladeEquipped == false)
		IsAsgardianBladeEquipped = true
		TEMPAsenWeapon = Game.GetPlayer().GetEquippedWeapon()
		TEMPAsenWeaponSpell = AsenAsgardianBladeSpellList.GetAt(GetFormIndex(AsenAsgardianBladeWeaponList, akBaseObject)) as Spell
		TEMPAsenWeaponBlockingSpell = AsenAsgardianBladeBlockingSpellList.GetAt(GetFormIndex(AsenAsgardianBladeWeaponList, akBaseObject)) as Spell
		RegisterForAnimationEvent(game.GetPlayer(), "WeaponSwing")
	endif
EndEvent


Event OnAnimationEvent(ObjectReference akSource, string asEventName)
	if ! (akSource == Game.GetPlayer())
		return
	endif

	if (asEventName == "WeaponSwing") && (IsAsgardianBladeEquipped == true); && (IsPowerAttacking == true)
		((TEMPAsenWeapon as Form) as ObjectReference).PlayGamebryoAnimation("UnfoldAll")
		TEMPAsenWeaponSpell.Cast(PlayerRef)
;		IsPowerAttacking = false
		Utility.Wait(0.4)
		((TEMPAsenWeapon as Form) as ObjectReference).PlayGamebryoAnimation("FoldAll")
	endif
EndEvent

 

The animations are stored in a .nif file, it basicly is built up like the nordic wooden door. Take a look at the attached .nif for more details about the model.

Link to comment
Share on other sites

I don't know much about scripting and I've only done some very basic C coding, but I may see a problem with the script logic. On line 2 of your script you have "if (AsenAsgardianBladeWeaponList.HasForm(akBaseObject)) && (IsAsgardianBladeEquipped == false)". IsAsgardianBladeEquipped would be checked if it's false on the event OnObjectEquipped. But when are you setting it to false anywhere in your code previous to this? Are you doing so when you define it?

 

Again, I don't know a thing about scripting, so I wouldn't surprised if what I just said is complete arse.

Link to comment
Share on other sites

I don't know much about scripting and I've only done some very basic C coding, but I may see a problem with the script logic. On line 2 of your script you have "if (AsenAsgardianBladeWeaponList.HasForm(akBaseObject)) && (IsAsgardianBladeEquipped == false)". IsAsgardianBladeEquipped would be checked if it's false on the event OnObjectEquipped. But when are you setting it to false anywhere in your code previous to this? Are you doing so when you define it?

 

Again, I don't know a thing about scripting, so I wouldn't surprised if what I just said is complete arse.

 

Dont worry about that:

Bool IsAsgardianBladeEquipped = False 

I am also setting it back to "false" on the unequip event, but thats not an issue since my spells that run through this mechanic are casted.

Edited by Medusa30
Link to comment
Share on other sites

I took a look at the dwarven mechanical weapons mod, but the logic of those weapons just looks shitty on my one even if I copy the scripts and model strcture 1:1. Don't you guys know any way to get NiControlSequences working für weapons?

Edited by Medusa30
Link to comment
Share on other sites

  • Recently Browsing   0 members

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