OnEquip not firing

Post » Sun Jun 24, 2012 2:30 am

Okay, I'm scratching my head now. I'm trying to attach a script to Imperial Studded Armor (EditorID ArmorImperialStuddedCuirass), which, upon equipped will cause the player to equip an Imperial Light Armor instead

To do this, I edit the armor, right-click at Papyrus Scripts panel, and choose "Add Script", and typed these:

Scriptname RaestlozTestArmorChangeScript extends ObjectReference{Change armor equipped when you equip the armor}Armor Property NewArmor Auto{New armor that will be equipped instead}Event OnEquipped(Actor akActor)   if akActor == Game.GetPlayer()	  akActor.EquipItem(NewArmor)   endifendEvent

Then, I set the property value of NewArmor to "ArmorImperialLightCuirass"


And it doesn't work. What I did in game was simply equipping the armor via Inventory screen (is there any other way to do that?) and nothing happens.

And yes, I do have the armor in my inventory. CreationKit.com states that EquipItem will give the actor one instance of the armor in case said actor does not have the armor, so it isn't an issue
User avatar
james kite
 
Posts: 3460
Joined: Sun Jul 22, 2007 8:52 am

Post » Sun Jun 24, 2012 6:51 am

I'm thinking you may have to unequip other armor first. But that is a guess...
User avatar
rae.x
 
Posts: 3326
Joined: Wed Jun 14, 2006 2:13 pm

Post » Sun Jun 24, 2012 2:10 pm

The script doesn't always start running right away. Try dropping the armor and picking it back up a couple times before putting it on.
User avatar
Alan Cutler
 
Posts: 3163
Joined: Sun Jul 01, 2007 9:59 am

Post » Sun Jun 24, 2012 9:33 am

Yeah, it works now :blink: IDK what happened though. I dropped the thing and now it works. Strange
User avatar
Hazel Sian ogden
 
Posts: 3425
Joined: Tue Jul 04, 2006 7:10 am

Post » Sun Jun 24, 2012 12:58 am

I think that if the script has an OnInit event, then it starts working right away without the need to load the model first. But I can't be positive.
User avatar
Marcia Renton
 
Posts: 3563
Joined: Fri Jan 26, 2007 5:15 am

Post » Sun Jun 24, 2012 12:11 pm

I think that if the script has an OnInit event, then it starts working right away without the need to load the model first. But I can't be positive.
Hmm.... I didn't know something like OnInit existed. Will definitely check it out.

On a side note, how do you enable debugging? I followed the steps in CreationKit.com (create SkyrimCustom.ini, put the values in), but I can't get debugging to work. it doesn't print out logs.
User avatar
Tamara Primo
 
Posts: 3483
Joined: Fri Jul 28, 2006 7:15 am

Post » Sun Jun 24, 2012 12:37 pm

I just changed the values in Skyrim.ini instead of creating a SkyrimCustom.ini.
User avatar
Nienna garcia
 
Posts: 3407
Joined: Wed Apr 25, 2007 3:23 am

Post » Sun Jun 24, 2012 12:44 am

I just changed the values in Skyrim.ini instead of creating a SkyrimCustom.ini.
Yeah, I fiddled with Skyrim.ini and it works. I almost pulled my hair because of that.
User avatar
Miss K
 
Posts: 3458
Joined: Sat Jan 20, 2007 2:33 pm


Return to V - Skyrim