MRWalther Posted September 13, 2013 Share Posted September 13, 2013 (edited) Hi, I'm currently trying to write a script that can return properties of equipped items using actor.GetWornForm() and actor.GetEquippedItemType(). It works well on the player character but for NPCs it returns "none" for worn form and "0" for equipped weapon, even if they have weapons and armor parts equipped. Is there a specific way to use these commands on NPCs? Edited September 13, 2013 by MR.Walther Link to comment Share on other sites More sharing options...
djjohnjarvis Posted September 13, 2013 Share Posted September 13, 2013 Where are you calling the scripts from? Are they attached to an alias, a quest, the actual actor because it all makes a difference to the way they should be called within the script whereas it's easier for the player as you just call Game.GetPlayer(). Perhaps you could post the script. Link to comment Share on other sites More sharing options...
MRWalther Posted September 13, 2013 Author Share Posted September 13, 2013 (edited) The script is attached to the actor through an ability. It's given to the player with a quest and to NPCs when they hit the player for the first time. Scriptname MVActorEquippedItems extends activemagiceffect Actor selfActor int headPartRating int armsPartRating int bodyPartRating int legsPartRating int armorPartRating Event OnInit() armor headArmor = selfActor.GetWornForm(0x00000002) as armor armor armsArmor = selfActor.GetWornForm(0x00000008) as armor armor bodyArmor = selfActor.GetWornForm(0x00000004) as armor armor legsArmor = selfActor.GetWornForm(0x00000080) as armor Debug.Notification("Head : "+headArmor) Debug.Notification("Arms : "+armsArmor) Debug.Notification("Body : "+bodyArmor) Debug.Notification("Legs : "+legsArmor) rightHandWeaponType = selfActor.GetEquippedItemType(1) leftHandWeaponType = selfActor.GetEquippedItemType(0) Debug.Notification("Right hand : "+rightHandWeaponType) Debug.Notification("Left hand : "+leftHandWeaponType) EndEvent Edited September 13, 2013 by MR.Walther Link to comment Share on other sites More sharing options...
djjohnjarvis Posted September 13, 2013 Share Posted September 13, 2013 You are using the wrong event type and it seems to me that selfActor is not being assigned any value unless I'm missing something but if you were using the right event then it is unnecessary anyway to have that variable as the event returns the actor to which the effect is applied (akTarget). Here it should look a little more like this: Scriptname MVActorEquippedItems extends activemagiceffect int headPartRating int armsPartRating int bodyPartRating int legsPartRating int armorPartRating Event OnEffectStart(Actor akTarget, Actor akCaster) armor headArmor = akTarget.GetWornForm(0x00000002) as armor armor armsArmor = akTarget.GetWornForm(0x00000008) as armor armor bodyArmor = akTarget.GetWornForm(0x00000004) as armor armor legsArmor = akTarget.GetWornForm(0x00000080) as armor Debug.Notification("Head : "+headArmor) Debug.Notification("Arms : "+armsArmor) Debug.Notification("Body : "+bodyArmor) Debug.Notification("Legs : "+legsArmor) rightHandWeaponType = akTarget.GetEquippedItemType(1) leftHandWeaponType = akTarget.GetEquippedItemType(0) Debug.Notification("Right hand : "+rightHandWeaponType) Debug.Notification("Left hand : "+leftHandWeaponType) EndEvent Link to comment Share on other sites More sharing options...
MRWalther Posted September 13, 2013 Author Share Posted September 13, 2013 Thanks a lot! It works! I should have thought about the event :dry: Link to comment Share on other sites More sharing options...
Recommended Posts