For some reason the compiler doesn't appear to like assigning the contents of a property to a variable...
Here be the code:
Spoiler
Scriptname ArcArchStateManagerScript extends Actor{Responsible for coordinating switching between the various effectsand ensuring that everything is cleaned up on transitions.}Ammo Property ArcArchArrowNormal AutoAmmo Property ArcArchFireballArrow AutoAmmo Property ArcArchFireboltArrow AutoWEAPON Property ArcArchBow AutoSPELL Property ArcArchFireballPlayerSpell AutoSPELL Property ArcArchFireboltPlayerSpell AutoActor PlayerAmmo LastArrowType = ArcArchArrowNormal <------------- line 13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Begin State none;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;auto State nothing Event OnBeginState() SwapArrowTypes(LastArrowType, ArcArchArrowNormal) EndEvent Event OnEndState() LastArrowType = ArcArchArrowNormal EndEventEndState;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; End State none;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Begin State fireball;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;State fireball Event OnBeginState() Player.AddSpell(ArcArchFireballPlayerSpell) SwapArrowTypes(LastArrowType, ArcArchFireballArrow, Player.isequipped(LastArrowType)) EndEvent Event OnEndState() Player.RemoveSpell(ArcArchFireballPlayerSpell) LastArrowType = ArcArchFireballArrow EndEvent Event OnObjectUnequipped(Form akBaseObject, ObjectReference akReference) if (akBaseObject as WEAPON) == ArcArchBow if Player.isequipped(ArcArchFireballArrow) ; Arrows were equipped so swap with regular arrows SwapArrowTypes(ArcArchFireballArrow, ArcArchArrowNormal, true) endif elseif (akBaseObject as Ammo) == ArcArchFireballArrow SwapArrowTypes(ArcArchFireballArrow, ArcArchArrowNormal, false) endif EndEvent Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference) if (akBaseObject as WEAPON) == ArcArchBow if Player.isequipped(ArcArchArrowNormal) ; Arrows were equipped so swap with regular arrows SwapArrowTypes(ArcArchFireballArrow, ArcArchArrowNormal, true) endif elseif (akBaseObject as Ammo) == ArcArchArrowNormal if Player.isequipped(ArcArchBow) SwapArrowTypes(ArcArchArrowNormal, ArcArchFireballArrow, true) endif endif endeventEndState;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; End State fireball;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Begin State firebolt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;State firebolt Event OnBeginState() Player.AddSpell(ArcArchFireboltPlayerSpell) SwapArrowTypes(LastArrowType, ArcArchFireboltArrow, Player.isequipped(LastArrowType)) EndEvent Event OnEndState() Player.RemoveSpell(ArcArchFireboltPlayerSpell) LastArrowType = ArcArchFireboltArrow EndEvent Event OnObjectUnequipped(Form akBaseObject, ObjectReference akReference) if (akBaseObject as WEAPON) == ArcArchBow if Player.isequipped(ArcArchFireboltArrow) ; Arrows were equipped so swap with regular arrows SwapArrowTypes(ArcArchFireboltArrow, ArcArchArrowNormal, true) endif elseif (akBaseObject as Ammo) == ArcArchFireboltArrow SwapArrowTypes(ArcArchFireboltArrow, ArcArchArrowNormal, false) endif EndEvent Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference) if (akBaseObject as WEAPON) == ArcArchBow if Player.isequipped(ArcArchArrowNormal) ; Arrows were equipped so swap with regular arrows SwapArrowTypes(ArcArchFireboltArrow, ArcArchArrowNormal, true) endif elseif (akBaseObject as Ammo) == ArcArchArrowNormal if Player.isequipped(ArcArchBow) SwapArrowTypes(ArcArchArrowNormal, ArcArchFireboltArrow, true) endif endif endeventEndState;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; End State firebolt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Free functions and any empty declarations for State specific use below;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Function SwapArrowTypes(Ammo from, Ammo to, bool equip){ Generic arrow swapping function. Swaps from one arrow type to another. } if from != to int count = Player.getitemcount(from) if count > 0 Player.unequipitem(from, false, true) Player.removeitem(from, count, true) Player.additem(to, count, true) if equip Player.equipitem(to, false, true) endif endif endifEndFunction
Here be the errors:
Compiling "ArcArchStateManagerScript"...\Skyrim\Papyrus Compiler\ArcArchStateManagerScript.psc(13,21): no viable alternative at input 'ArcArchArrowNormal' \Skyrim\Papyrus Compiler\ArcArchStateManagerScript.psc(13,5): Unknown user flag ArcArchArrowNormalNo output generated for ArcArchStateManagerScript, compilation failed.
So, thoughts? I've tried doing the assignment on a separate line as well with the same error.
Second, question!
Is it possible to modify the state of a script running on an actor, the one above as a matter of fact, from another script e.g. Player.scriptname.GotoState("foo")? Or would I be forced to "poll" for the changes I need to look for through use of the RegisterForUpdate() functionality? I'd really prefer not to use the second route if at all possible.
I wish there was a Spell version of OnObjectEquipped/OnObjectUnequipped.