Talk:GetEquipmentSlot

From the Oblivion ConstructionSet Wiki
Revision as of 08:11, 20 July 2010 by imported>Babij (Example code)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Hmm... I wasted a several hours on this damn function. I was writing a script to get a companion character to wear certain clothing depending on particular circumstances. Long story short, I wanted my guy to loop through his inventory and put on a pair of shoes. I finally got the damn thing to work using the following code: short InvPos ref pInvObj set InvPos to 0 Label set pInvObj to (GaroWorldRef.GetInventoryObject InvPos) if pInvObj set InvPos to (InvPos + 1) ;if (pInvObj.GetEquipmentSlot == 5) if(GetEquipmentSlot pInvObj == 5) GaroWorldRef.EquipItem pInvObj message "I put on my shoes" endif Goto endif

The key line of course is if(GetEquipmentSlot pInvObj == 5). Note the commented out line above it, which is apparently incorrect code, and will always return 0. Probably has something to do with my confusion between references and objectIds, but I figured I'd post this up in case anyone else has this problem.