Ghaunadaur Posted December 9, 2012 Share Posted December 9, 2012 There's still something wrong with the script. WornHasKeyword() takes a keyword type parameter, not an armor. bool Function WornHasKeyword(Keyword akKeyword) native Link to comment Share on other sites More sharing options...
Mayfly53 Posted December 9, 2012 Author Share Posted December 9, 2012 They are keywords: http://i.imgur.com/SgBfQ.jpg It's still the same error. I think it's something to do with having an If statement inside a state. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 9, 2012 Share Posted December 9, 2012 turn them from states into functions and see how that works Link to comment Share on other sites More sharing options...
Mayfly53 Posted December 9, 2012 Author Share Posted December 9, 2012 IsharaMeradin, thank you for all your efforts so far. I'm not sure how to create functions. I did some research and tried, but unfortunately it gave me a ridiculous amount of errors. I've never created nor called custom functions before. Scriptname MercCuirassCheckScript extends ObjectReference Armor Property MercCuirassProperty auto Armor Property ArmorCuirass auto Function PlayerCheck() If akActor == Game.GetPlayer() Unequip(akActor) Else GoToState("Empty") EndIf EndFunction Function Unequip() If akActor.WornHasKeyword(ArmorCuirass) && !akActor().WornHasKeyword(MercCuirassProperty) akActor.UnequipItem(self) EndIf EndFunction Event OnEquipped(Actor akActor) PlayerCheck(akActor) EndEvent Link to comment Share on other sites More sharing options...
Ghaunadaur Posted December 9, 2012 Share Posted December 9, 2012 They are keywords: http://i.imgur.com/SgBfQ.jpg It's still the same error. I think it's something to do with having an If statement inside a state.Then I must be blind. :blink:Armor Property MercCuirassProperty auto Armor Property ArmorCuirass auto If you want to work with states, try this: Scriptname MercCuirassCheckScript extends ObjectReference ;put this script on the chest armor piece Armor Property MercCuirass auto ;link this to the leg armor piece Keyword Property ArmorCuirass auto ;can be auto-filled State Equipped Event OnEquipped(Actor akActor) If akActor == Game.GetPlayer() && !akActor.IsEquipped(MercCuirass) && akActor.WornHasKeyword(ArmorCuirass) akActor.UnequipItem(self) GoToState("Unequipped") endif EndEvent Event OnUnequipped(Actor akActor) If akActor == Game.GetPlayer() && !akActor.IsEquipped(self) GoToState("Unequipped") endif EndEvent EndState auto State Unequipped Event OnEquipped(Actor akActor) If akActor == Game.GetPlayer() && akActor.IsEquipped(self) GoToState("Equipped") endif EndEvent EndState Link to comment Share on other sites More sharing options...
Mayfly53 Posted December 9, 2012 Author Share Posted December 9, 2012 Thank you so much for the effort, it compiles perfectly (and even better, I understand what you did), but there is no effect in game. I wonder if there is any way to script an armour piece lying on an unused slot so that it gets unequipped the same as if it were on the body slot. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 9, 2012 Share Posted December 9, 2012 This compiles without error... whether or not it works, I have no clue. I also changed the scriptname for testing purposesScriptname AA_TEST extends ObjectReference Keyword Property MercCuirassProperty auto Keyword Property ArmorCuirass auto Function PlayerCheck(Actor akActor) If akActor == Game.GetPlayer() Unequip(akActor) Else ;do nothing EndIf EndFunction Function Unequip(Actor akActor) If akActor.WornHasKeyword(ArmorCuirass) && !akActor.WornHasKeyword(MercCuirassProperty) akActor.UnequipItem(self) EndIf EndFunction Event OnEquipped(Actor akActor) PlayerCheck(akActor) EndEvent Link to comment Share on other sites More sharing options...
steve40 Posted December 9, 2012 Share Posted December 9, 2012 your statements for the IF are not on the same line as the IF. also akActor = Game.GetPlayer() tells the game to make akActor have the same value as Game.GetPlayer() whereas akActor == Game.GetPlayer() tells the game to check if akActor does have the same value as Game.GetPlayer() that said your script needs adjust in the following manner Scriptname MercCuirassCheckScript extends ObjectReference Armor Property MercCuirassProperty auto Armor Property ArmorCuirass auto Event OnEquipped(Actor akActor) GoToState("PlayerCheck") EndEvent State PlayerCheck If akActor == Game.GetPlayer() GoToState("Unequip") Else GoToState("Empty") EndIf EndState State Unequip If akActor.WornHasKeyword(ArmorCuirass) && !akActor().WornHasKeyword(MercCuirassProperty) akActor.UnequipItem(self) EndIf EndState Um, no. a) you haven't put any function blocks in the STATES so the script won't work. You need to add an event such as OnBeginState or Equip or Unequip to each state block.b) empty state is not called "empty", it is called "". Link to comment Share on other sites More sharing options...
steve40 Posted December 9, 2012 Share Posted December 9, 2012 This compiles without error... whether or not it works, I have no clue. I also changed the scriptname for testing purposesScriptname AA_TEST extends ObjectReference Keyword Property MercCuirassProperty auto Keyword Property ArmorCuirass auto Function PlayerCheck(Actor akActor) If akActor == Game.GetPlayer() Unequip(akActor) Else ;do nothing EndIf EndFunction Function Unequip(Actor akActor) If akActor.WornHasKeyword(ArmorCuirass) && !akActor.WornHasKeyword(MercCuirassProperty) akActor.UnequipItem(self) EndIf EndFunction Event OnEquipped(Actor akActor) PlayerCheck(akActor) EndEvent Um... :facepalm: This does EXACTLY the same thing: Scriptname AA_TEST extends ObjectReference Keyword Property MercCuirassProperty auto Keyword Property ArmorCuirass auto Event OnEquipped(Actor akActor) If akActor == Game.GetPlayer() && (akActor.WornHasKeyword(ArmorCuirass) && !akActor.WornHasKeyword(MercCuirassProperty)) akActor.UnequipItem(self) EndIf EndEvent Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 10, 2012 Share Posted December 10, 2012 @steve40 Perhaps it does... but rather than rewrite someone's setup completely, I worked with it. If you'd read and followed the thread you would know that. Link to comment Share on other sites More sharing options...
Recommended Posts