Kerberus14 Posted January 8, 2015 Share Posted January 8, 2015 (edited) The script is attached directly to the player in CK, that's the only way it'll work. ^^ The script is only supposed to run one cycle. Once or more if you ONLY UnEquip in combat, and once or more if you ONLY Equip in combat. Edited January 8, 2015 by Kerberus14 Link to comment Share on other sites More sharing options...
Masterofnet Posted January 9, 2015 Author Share Posted January 9, 2015 I put your script on the player. If you attempt to equip a piece of armor while in combat you can unequip the rest of the armor. I looked over your script and can not see how that is possible. If you just attempt to unequip the armor it does not allow you too. I replaced the global var in my script with your int. Here is the script. For some reason when I attempt to equip an item is fires the event on uneqip and the item is equipped. Here is the script. Armor Property DA Auto Actor Property PlayerRef Auto Int Property WasUnEquip auto Int Property WasEquip auto Event OnUnequipped(Actor akActor) if akActor == PlayerRef && PlayerRef.IsInCombat() && PlayerRef.GetItemCount(DA) ==1 && WasEquip==0 WasUnEquip=1 Debug.Notification("Dragonborn Armor can not be unequiped while in combat") PlayerRef.EquipItem(DA, abSilent = true) Elseif PlayerRef.IsInCombat()==0 && WasUnEquip==1 WasUnEquip=0 Debug.Notification("Dragonborn Armor can be unequiped while not in combat") endIf endEvent Event OnEquipped(Actor akActor) if akActor == PlayerRef && PlayerRef.IsInCombat() WasEquip==1 Debug.Notification("Dragonborn Armor can not be equiped while in combat") PlayerRef.UnequipItem(DA, abSilent = true) Elseif PlayerRef.IsInCombat()==0 && WasEquip==1 WasEquip=0 Debug.Notification("Dragonborn Armor can be equiped while not in combat") endIf endEvent Link to comment Share on other sites More sharing options...
Kerberus14 Posted January 9, 2015 Share Posted January 9, 2015 I'll make a new script tomorrow if by then nobody solves your problem, I'm sleepy as hell now. Link to comment Share on other sites More sharing options...
Masterofnet Posted January 9, 2015 Author Share Posted January 9, 2015 The problem has been solved.Elseif akActor == PlayerRef && PlayerRef.IsInCombat()==False && HelmetVar.GetValue() > 0 HelmetVar.SetValue(0) Debug.Notification("Dragonborn Armor can be unequiped while not in combat") I really would like to replace the global var with Int do you have any idea they are not working? Thanks for your help. BTW I had a look at your mod. Great ideas. Varying the players speed with stamina etc. That is the type of modding I am interested in. Gameplay. Thanks Again. Link to comment Share on other sites More sharing options...
Masterofnet Posted January 9, 2015 Author Share Posted January 9, 2015 (edited) Actor Property PlayerRef auto Int Property WasUnEquip auto Int Property WasEquip auto Event OnObjectUnequipped(Form akBaseObject, ObjectReference akReference) akReference = PlayerRef if PlayerRef.IsInCombat()==1 && akBaseObject as Armor && WasEquip==0 && PlayerRef.GetItemCount(akBaseObject) == 1 WasUnEquip=1 Utility.Wait(1.0) PlayerRef.EquipItem(akBaseObject, abSilent = true) Debug.Notification("You can't change armors in combat.") Utility.Wait(1.0) WasUnEquip=0 endif EndEvent Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference) akReference = PlayerRef if PlayerRef.IsInCombat()==1 && akBaseObject as Armor && WasUnEquip==0 WasEquip=1 Utility.Wait(1.0) PlayerRef.UnequipItem(akBaseObject, abSilent = true) Debug.Notification("You can't change armors in combat.") Utility.Wait(1.0) WasEquip=0 endif EndEventI did some work on your script. As far as I can tell it works perfectly now. I was able to fix my script with some help from yours.Armor Property DA Auto Actor Property PlayerRef Auto Int Property WasUnEquip auto Int Property WasEquip auto Event OnUnequipped(Actor akActor) if akActor == PlayerRef && PlayerRef.IsInCombat() && PlayerRef.GetItemCount(DA) ==1 && WasEquip==0 WasUnEquip=1 Utility.Wait(1.0) Debug.Notification("Dragonborn Armor can not be unequiped while in combat") PlayerRef.EquipItem(DA, abSilent = true) Utility.Wait(1.0) WasEquip=0 endIf endEvent Event OnEquipped(Actor akActor) if akActor == PlayerRef && PlayerRef.IsInCombat() WasEquip=1 Utility.Wait(1.0) Debug.Notification("Dragonborn Armor can not be equiped while in combat") PlayerRef.UnequipItem(DA, abSilent = true) Utility.Wait(1.0) WasEquip=0 endIf endEvent Thanks again this script is much simpler than I though it could be. Edited January 9, 2015 by Masterofnet Link to comment Share on other sites More sharing options...
Kerberus14 Posted January 9, 2015 Share Posted January 9, 2015 Glad I could help, I was really tired last night since I worked on my mod all day. Link to comment Share on other sites More sharing options...
Masterofnet Posted January 9, 2015 Author Share Posted January 9, 2015 The script placed on the player does not work. It is much to easy to equip other armors. I do not understand why. This script placed on the armor does work and it is stable.Armor Property DA Auto Actor Property PlayerRef Auto Int Property WasUnEquip auto Int Property WasEquip auto Event OnUnequipped(Actor akActor) if akActor == PlayerRef && PlayerRef.IsInCombat() && PlayerRef.GetItemCount(DA) ==1 && WasEquip==0 WasUnEquip=1 Debug.Notification("Dragonborn Stealth Armor can not be unequiped while in combat") PlayerRef.EquipItem(DA,true,true) Utility.Wait(4.0) PlayerRef.EquipItem(DA,false,true) Utility.Wait(0.1) WasEquip=0 endIf endEvent Event OnEquipped(Actor akActor) if akActor == PlayerRef && PlayerRef.IsInCombat() && WasUnEquip==0 WasEquip=1 Debug.Notification("Dragonborn Stealth Armor can not be equiped while in combat") PlayerRef.UnequipItem(DA,true,true) Utility.Wait(4.0) PlayerRef.UnEquipItem(DA,false,true) Utility.Wait(0.1) WasEquip=0 endIf endEvent Link to comment Share on other sites More sharing options...
Recommended Posts