this is the mod page: http://steamcommunity.com/sharedfiles/filedetails/?id=13998
The problem is that in the third person, knives is fired in any direction, I'm trying to fix that. works better in first person, at least to me. I was trying to solve the problem of the third person, but I can not make it work, if anyone know how to do it, I appreciate if you tell me how. but looks cool when you do the Dual Wield Power Attack and knives go in all directions.
hope it works for you, and feel free to improve the mod and continue with this idea.
this is the script:
Scriptname FireKnivesScript extends ActorWEAPON Property IronKnife AutoAMMO Property IronKnifeAmmo Autoimport gameimport utilityWEAPON KnifeEquipedRWEAPON KnifeEquipedLEvent OnObjectEquipped(Form akBaseObject, ObjectReference akReference) Utility.Wait(0.1) if(self.GetEquippedWeapon(false) == IronKnife) RegisterForAnimationEvent(self, "WeaponSwing") KnifeEquipedR = self.GetEquippedWeapon(false) endif if(self.GetEquippedWeapon(true) == IronKnife) RegisterForAnimationEvent(self, "WeaponLeftSwing") KnifeEquipedL = self.GetEquippedWeapon(true) endifendEventEvent OnObjectUnequipped(Form akBaseObject, ObjectReference akReference) if (akBaseObject as Weapon == IronKnife) Utility.Wait(0.1) if(self.GetEquippedWeapon(false) != KnifeEquipedR) UnregisterForAnimationEvent(self, "WeaponSwing") KnifeEquipedR = None endif if(self.GetEquippedWeapon(true) != KnifeEquipedL) UnregisterForAnimationEvent(self, "WeaponLeftSwing") KnifeEquipedL = None endif endIfendEventEvent OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)if (akBaseItem == IronKnife) && (self.GetItemCount(IronKnife) == 0) KnifeEquipedR = None KnifeEquipedL = NoneendifendEventEvent OnAnimationEvent(ObjectReference akSource, string asEventName)if (asEventName == "WeaponSwing") && (KnifeEquipedR == IronKnife) Utility.Wait(0.1) KnifeEquipedR.fire(self as objectReference, IronKnifeAmmo) Utility.Wait(0.1) KnifeEquipedR.fire(self as objectReference, IronKnifeAmmo) Utility.Wait(0.1) KnifeEquipedR.fire(self as objectReference, IronKnifeAmmo)endIfif (asEventName == "WeaponLeftSwing") && (KnifeEquipedL == IronKnife) KnifeEquipedL.fire(self as objectReference, IronKnifeAmmo) Utility.Wait(0.1) KnifeEquipedL.fire(self as objectReference, IronKnifeAmmo) Utility.Wait(0.1) KnifeEquipedL.fire(self as objectReference, IronKnifeAmmo)endIfendEvent
I am new to scripts, so do not know if I did, is the best way to call functions and everything else. appreciate it if you tell me how to improve it as well find a way to link the amount of ammunition used, with the number of knives that the player has. try to make a condition on OnAnimationEvent, but I could not make it work. the problem of shooting in the third person seems to be the position of the weapon when fired, which does not occur in first person, do not know why..appreciate the help you can give me
this is the new spript with form lists
Scriptname FireKnivesScript extends ActorWEAPON Property IronKnifeAmmoFake AutoWEAPON Property ElvenKnifeAmmoFake AutoFormList Property ThrowingKnifeList AutoFormList Property ThrowingKnifeAmmoList AutoFormList Property ThrowingKnifeAmmoFakeList Autoint KnifeTypeWEAPON ThrowingKnifeAMMO ThrowingKnifeAmmoimport gameimport utilityWEAPON KnifeEquipedRWEAPON KnifeEquipedLAMMO KnifeAmmoEquipedRAMMO KnifeAmmoEquipedLint KnifeRoundRint KnifeRoundLbool OnAttackbool InfiniteKnife = falseint KnifeInfiniteTypeint KnifeEquipedTypeRint KnifeEquipedTypeLint Function GetFormIndex(FormList List, Form Member) globalif (!List.HasForm(Member)) Return -1endifint Index = 0While (List.GetAt(Index) != Member) Index += 1EndWhileReturn IndexEndFunctionint Function GetKnifeRound(int Index) globalif (index == 0) Return 3else Return 1endifEndFunctionEvent OnObjectEquipped(Form akBaseObject, ObjectReference akReference)KnifeType = GetFormIndex(ThrowingKnifeList, akBaseObject)ThrowingKnife = ThrowingKnifeList.GetAt(KnifeType) as weaponif(self.GetEquippedWeapon(false) == ThrowingKnife) RegisterForAnimationEvent(self, "WeaponSwing") KnifeEquipedR = self.GetEquippedWeapon(false) KnifeAmmoEquipedR = ThrowingKnifeAmmoList.GetAt(KnifeType) as ammo KnifeRoundR = GetKnifeRound(KnifeType) KnifeEquipedTypeR = KnifeTypeendifif(self.GetEquippedWeapon(true) == ThrowingKnife) RegisterForAnimationEvent(self, "WeaponLeftSwing") KnifeEquipedL = self.GetEquippedWeapon(true) KnifeAmmoEquipedL = ThrowingKnifeAmmoList.GetAt(KnifeType) as ammo KnifeRoundL = GetKnifeRound(KnifeType) KnifeEquipedTypeL = KnifeTypeendifif(ThrowingKnifeAmmoFakeList.HasForm(akBaseObject)) KnifeInfiniteType = GetFormIndex(ThrowingKnifeAmmoFakeList, akBaseObject)endifendEventEvent OnObjectUnequipped(Form akBaseObject, ObjectReference akReference)if (akBaseObject == KnifeEquipedR) || (akBaseObject == KnifeEquipedL) Utility.Wait(0.1) if(self.GetEquippedWeapon(false) != KnifeEquipedR) && (KnifeEquipedR != None) UnregisterForAnimationEvent(self, "WeaponSwing") KnifeEquipedR = None endif if(self.GetEquippedWeapon(true) != KnifeEquipedL) && (KnifeEquipedL != None) UnregisterForAnimationEvent(self, "WeaponLeftSwing") KnifeEquipedL = None endifendIfif(ThrowingKnifeAmmoFakeList.HasForm(akBaseObject)) KnifeInfiniteType = -1endif;KnifeInfiniteType = GetFormIndex(ThrowingKnifeAmmoFakeList, akBaseObject)endEventEvent OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)KnifeType = GetFormIndex(ThrowingKnifeAmmoList, akBaseItem)ThrowingKnife = ThrowingKnifeList.GetAt(KnifeType) as weaponThrowingKnifeAmmo = ThrowingKnifeAmmoList.GetAt(KnifeType) as ammoif (akBaseItem == ThrowingKnifeAmmo) self.RemoveItem(ThrowingKnifeAmmo, aiItemCount, true) self.AddItem(ThrowingKnife, aiItemCount, true)endIfendEventEvent OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)if (OnAttack == true) akItemReference.Delete() OnAttack = FalseendifKnifeType = GetFormIndex(ThrowingKnifeList, akBaseItem)ThrowingKnife = ThrowingKnifeList.GetAt(KnifeType) as weaponif (self.GetItemCount(ThrowingKnife) == 0) UnregisterForAnimationEvent(self, "WeaponSwing") UnregisterForAnimationEvent(self, "WeaponLeftSwing") KnifeEquipedR = None KnifeEquipedL = NoneendifendEventEvent OnDying(Actor akKiller)UnregisterForAnimationEvent(self, "WeaponSwing")UnregisterForAnimationEvent(self, "WeaponLeftSwing")KnifeEquipedR = NoneKnifeEquipedL = NoneendEventFunction ShootingKnives(weapon ShootingWeapon, ammo ShootingAmmo, int round, int InfiniteAmmo)int Sround = roundwhile (Sround > 0) ShootingWeapon.fire(self as objectReference, ShootingAmmo) Sround = Sround - 1 Utility.Wait(0.05)endWhileOnAttack = trueif(KnifeInfiniteType != InfiniteAmmo) self.DropObject(ShootingWeapon, round)endifendFunctionEvent OnAnimationEvent(ObjectReference akSource, string asEventName)if (asEventName == "WeaponSwing") if (KnifeEquipedR != None) ;&& (self.GetItemCount(KnifeEquipedR) > 2) ShootingKnives(KnifeEquipedR, KnifeAmmoEquipedR, KnifeRoundR, KnifeEquipedTypeR) endIfendIfif (asEventName == "WeaponLeftSwing") if (KnifeEquipedL != None) ;&& (self.GetItemCount(KnifeEquipedL) > 2) ShootingKnives(KnifeEquipedL, KnifeAmmoEquipedL, KnifeRoundL, KnifeEquipedTypeL) endIfendIfendEvent
My idea was to create a node in the skeleton.nif which could attach a fake weapon that could fire the projectile, but does not work because no matter where you put the gun always shoots from the hand equiped, also trying to create a fake weapon then use PlaceAtMe and then with MoveToNode move to a node pointing forward, but I can not convert an Object Reference in a weapon, so do not know what else can be done, apparently there are nodes that point in the animation but do not know anything about animation, so I wonder if an expert that could give his opinion in this...

I cant get your script to fire my kunai.