sh0ker Posted November 5, 2015 Posted November 5, 2015 Hey there.I am new to scripting and I am trying to learn so today I was messing with some code and there's something small I couldn't figure out why it's not working foreach rItem <- PlayerREF rItem.UnequipMe loop This is a simple code to unequip all the items the player wear, it works perfectly but when i try this function instead, it doesn't : foreach rItem <- PlayerREF PlayerREF.UnEquipItem rItem 0 1 loop anyone know why when I use UnequipItem it doesn't work?thanks in advance
Ladez Posted November 7, 2015 Posted November 7, 2015 I'm guessing because rItem contains an inventory reference and not a base object. UnequipMe runs on an inventory reference but not a base object, UnequipItem runs on a reference to an actor and takes a base object as the first parameter. Try retrieving the reference's base object first: foreach rItem <- PlayerREF set rBase to rItem.GetBaseObject PlayerREF.UnEquipItem rItem 0 1 loop
sh0ker Posted November 7, 2015 Author Posted November 7, 2015 (edited) I'm guessing because rItem contains an inventory reference and not a base object. UnequipMe runs on an inventory reference but not a base object, UnequipItem runs on a reference to an actor and takes a base object as the first parameter. Try retrieving the reference's base object first: foreach rItem <- PlayerREF set rBase to rItem.GetBaseObject PlayerREF.UnEquipItem rItem 0 1 loop Thanks I am going to try this outedit :It works! thank you again Edited November 7, 2015 by sh0ker
Recommended Posts