Could someone please give me ahand with this script?
[I didn't write it - it's something I found in a mod that was not implemented].
Begin _2DR_pipescript Float timer Short controlvarShort OnPCEquipIf ( MenuMode == 1 ) ReturnEndif If ( OnPCEquip == 1 ) Set OnPCEquip To 0 If ( Player ->GetItemCount, "aa_mc_weed" == 0 ) set controlvar to -1 MessageBox "You Equipped the pipe, however you need Pipeweed to smoke." ElseIf ( Player ->GetItemCount, "aa_mc_weed" >= 1 ) MessageBox "You take several moments to relax, and enjoy your pipe." PlaySound, "Pipe" Player->removeitem "aa_mc_weed" 1 Set controlvar To 1 Endif ElseIf ( controlvar == 1 );;If ( controlvar == 1 ) Player -> AddSpell, "aa_mc_pipereactions" set controlvar to -1;; Endif ElseIf ( controlvar == -1 );;If ( controlvar == -1 ) Set timer to ( timer + GetSecondsPassed ) if timer > 10 Player -> RemoveSpell, "aa_mc_pipereactions" set controlvar to 0 endif EndifEndifEnd
This script works fine the FIRST time it is run.
[Player equips pipe, if the pipeweed check is positive the spell (a curse) is applied, and removed after 10 sec.]
However, equipping the pipe a second time results in the spell NOT being removed as intended.
[I added the controlvar line to the "You need pipeweed to smoke" portion so I could at least get rid of the spell by equipping the pipe with no pipeweed in inventory...]
But, for some reason, the second time the script is run (assuming more than one "pipeweed" ingredient in inventory), it fails to move on to the "removespell" section -- and I cannot figure out why.
Any ideas or suggestions would be greatly appreciated.
DARoot