Making Weapon = ObjectReference, Recharge Hotkey

Post » Sat Dec 21, 2013 6:01 pm

I'm trying to make a recharge hotkey to allow for fast recharging your weapons if a Soulgem in your inventory. Problem is SKSE's http://www.creationkit.com/GetItemCharge_-_ObjectReference, http://www.creationkit.com/SetItemCharge_-_ObjectReference and http://www.creationkit.com/GetItemMaxCharge_-_ObjectReference asks for a ObjectReference, but http://www.creationkit.com/GetEquippedWeapon_-_Actor answers with a base object.

I'm trying hard to figure why I want to recharge enchanted Object References instead of Base Objects. Anyone has a solution to the problem, Script looks similar to this:

Weapon WeaponToRechargeLeft = PlayerREF.GetEquippedWeapon(true) as WeaponObjectReference ChargeMaxLeft = WeaponToRechargeLeft..GetItemMaxCharge() as ObjectReference

I'm getting the classical can't compare a null (Weapon) to a ObjectReference Error.

Again, why would I want to recharge a single Object Reference placed in the world instead of a Base Object in my Inventory?

User avatar
Alyesha Neufeld
 
Posts: 3421
Joined: Fri Jan 19, 2007 10:45 am

Return to V - Skyrim