Jump to content

Fidderling with Animated Weapons - Script


Recommended Posts

I'm currently trying to replicate my own version of Dwarven Mechanical Equipment so far I have 2 wrist blades, a 2h wep and a shoulder cannon working using his system of having 2 separate items for sheath and draw and switching between them.

 

The problems that occur with this are the items duplicating or being left behind when unsheathing even when adding script to remove those items.

 

Also as the weapon(s) are switching between 2 objects you cannot keep 1 of them on the Favorites menu as it will be deleted.

I would rather not go for the approach of having 2 weapons in your inventory all the time.

 

After looking at the Dual Sheath plus Shields on Back mod I figured I could take another approach where I have 1 persistent weapon for the animation, stats and favorite slot and two armor objects in an unused slot for the visuals of the sheathed and drawn weapon. This idea works fine when sheathed but when drawn, the weapon stays on the players back. I've tried changing the NiStringExtraData of the Drawn model to NPC R Hand [RHnd] but that has very bad effects on the game causing buggy visuals, including a black screen with very bright lights o.O

 

Anyone having anything to add or any ideas for better solutions to this?

 

Thanks for listening =) Hope to hear from anyone1 soon

Link to comment
Share on other sites

Version 1 of the script (Not using armor)

 

Scriptname PredatorWepAnimScript extends ObjectReference

 

WEAPON Property PredatorCombiStick Auto

WEAPON Property PredatorCombiStickSheathe Auto

 

WEAPON Property PredatorWristBladeRight Auto

WEAPON Property PredatorWristBladeRightSheathe Auto

 

AMMO Property PredatorPlasmaCaster Auto

AMMO Property PredatorPlasmaCasterSheathe Auto

 

ARMOR Property PredatorChest Auto

 

{When weapon is sheathed it removes both sheathed and drawn versions then equips the Sheathed version of the weapon}

Event OnAnimationEvent(ObjectReference akSource, string asEventName)

if(akSource == self)

if (asEventName == "WeaponSheathe")

if Game.GetPlayer().IsEquipped(PredatorChest)

Game.GetPlayer().EquipItem(PredatorPlasmaCasterSheathe, false, true)

endif

if Game.GetPlayer().IsEquipped(PredatorCombiStick)

Game.GetPlayer().RemoveItem(PredatorCombiStick, 2, true)

Game.GetPlayer().RemoveItem(PredatorCombiStickSheathe, 2, true)

Game.GetPlayer().EquipItem(PredatorCombiStickSheathe, false, true)

endif

if Game.GetPlayer().IsEquipped(PredatorWristBladeRight)

Game.GetPlayer().RemoveItem(PredatorWristBladeRight, 2, true)

Game.GetPlayer().RemoveItem(PredatorWristBladeRightSheathe, 2, true)

Game.GetPlayer().EquipItem(PredatorWristBladeRightSheathe, false, true)

endif

{Opposite for WeaponDraw, Sheathed and Drawn Weapon Removed and Drawn Version Equiped}

elseif (asEventName == "WeaponDraw")

if Game.GetPlayer().IsEquipped(PredatorChest)

Game.GetPlayer().EquipItem(PredatorPlasmaCaster, false, true)

endif

if Game.GetPlayer().IsEquipped(PredatorCombiStickSheathe)

Game.GetPlayer().RemoveItem(PredatorCombiStick, 2, true)

Game.GetPlayer().RemoveItem(PredatorCombiStickSheathe, 2, true)

Game.GetPlayer().EquipItem(PredatorCombiStick, false, true)

elseif Game.GetPlayer().IsEquipped(PredatorWristBladeRightSheathe)

Game.GetPlayer().RemoveItem(PredatorWristBladeRight, 2, true)

Game.GetPlayer().RemoveItem(PredatorWristBladeRightSheathe, 2, true)

Game.GetPlayer().EquipItem(PredatorWristBladeRight, false, true)

endif

endif

endif

EndEvent

 

{If the Drawn version of the weapon if equippted then when it's unequipped, it is removed then adds the sheathed version to the inventory.}

Event OnObjectUnequipped(Form akBaseObject, ObjectReference akReference)

if (akBaseObject as Weapon == PredatorCombiStick)

Game.GetPlayer().RemoveItem(PredatorCombiStick, 1, true)

Game.GetPlayer().AddItem(PredatorCombiStickSheathe, 1, true)

elseif (akBaseObject as Weapon == PredatorWristBladeRight)

Game.GetPlayer().RemoveItem(PredatorWristBladeRight, 1, true)

Game.GetPlayer().AddItem(PredatorWristBladeRightSheathe, 1, true)

elseif (akBaseObject as Armor == PredatorChest)

Game.GetPlayer().RemoveItem(PredatorPlasmaCaster, 1, true)

Game.GetPlayer().RemoveItem(PredatorPlasmaCasterSheathe, 1, true)

endif

EndEvent

 

Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)

if (akBaseObject as armor == PredatorChest)

Game.GetPlayer().EquipItem(PredatorPlasmaCasterSheathe, false, true)

endif

EndEvent

Edited by maniczombie
Link to comment
Share on other sites

  • Recently Browsing   0 members

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