Also, my script suddenly, and for no apparent reason, stopped running.<--
So I decided to make a special magical bow that automatically refills whatever arrow it shoots. I'm using OBSE's GetEquippedObject function to get the current arrow equipped. In an effort to make sure that only fired arrows are counted, I want to use MenuMode to detect when various menus are open, and IsWeaponOut (in conjunction with an equip check) to detect if the player has that bow drawn or not. So far I've only succeed in being able to tell if that bow is equipped. I was able to get MenuMode working, but shortly after that, the script stopped running for no reason.
I was testing my MenuMode fix with message boxes, and at first I was able to get a single "In Main Menus" message to appear at the correct times. Then, with the game still running and nothing changed, the messages stopped appearing. On firing an arrow, it was not replaced, nothing happened. On a reboot of Oblivion, the script still won't run. Is there any way to test if a script is running and/or any reason it would self-terminate and not start back up?
Edit: Further testing showed that the GameMode block was running, but none of the Menu blocks were... And still no arrows, either...
On a final note, IsWeaponOut won't work at all, never has, and I have no idea why... If it were at all possible, I'd like to replace both MenuMode and IsWeaponOut checks with a Is/Was-This-Weapon-Just-Fired function, but I don't think any such function exists...
Here is the code (it is attached to the bow):
scn umBowInfiniteAmmoref NULLref CurAmmoshort Equippedshort AmmoCountshort AddAmmoshort DoOnce ; To test that MenuMode is working...begin OnEquip ;if the bow was just equipped, initalize CurAmmo and AmmoCount set Equipped to 1 set CurAmmo to Player.GetEquippedObject 17 set AmmoCount to Player.GetItemCount CurAmmoendbegin MenuMode 1 ;Main Menus - update CurAmmo and AmmoCount to reflect any changes made set CurAmmo to Player.GetEquippedObject 17 set AmmoCount to Player.GetItemCount CurAmmo if DoOnce == 0 ;Display a single confirmation message. MessageBox "In Main Menus" set DoOnce to 1 endifendbegin MenuMode 1008 ;Container/Barter Menu - update CurAmmo and AmmoCount to reflect any changes made set CurAmmo to Player.GetEquippedObject 17 set AmmoCount to Player.GetItemCount CurAmmoendbegin MenuMode 1009 ;Dialouge Menu - update CurAmmo and AmmoCount to reflect any changes made, like a in quest. set CurAmmo to Player.GetEquippedObject 17 set AmmoCount to Player.GetItemCount CurAmmoendbegin MenuMode 1042 ;Enchanting Menu - update CurAmmo and AmmoCount to reflect any changes made set CurAmmo to Player.GetEquippedObject 17 set AmmoCount to Player.GetItemCount CurAmmoendbegin GameMode set DoOnce to 0 ;Reset DoOnce if Equipped == 0 ;bow not equipped return ;exit, we're not fireing arrows right now endif if Player.GetEquippedObject 17 == NULL && AmmoCount == 1 ;check arrow fired was the last one and resupply and equip. Player.AddItem CurAmmo 1 Player.EquipItem CurAmmo elseif CurAmmo != Player.GetEquippedObject 17 ;otherwise, if arrow type changes/becomes null, reset CurAmmo and AmmoCount set CurAmmo to Player.GetEquippedObject 17 set AmmoCount to Player.GetItemCount CurAmmo endif if AmmoCount > Player.GetItemCount CurAmmo ;if arrow fired, resupply set AddAmmo to AmmoCount - Player.GetItemCount CurAmmo ;Technically we should only ever be one arrow short, but who knows? If not, this will save time. Player.AddItem CurAmmo AddAmmo Player.EquipItem CurAmmo elseif AmmoCount < Player.GetItemCount CurAmmo ;if more arros were added, increase AmmoCount set AmmoCount to Player.GetItemCount CurAmmo endifendbegin OnUnEquip ;if bow is unequipped, reset CurAmmo set Equipped to 0 set CurAmmo to NULLend
What's going on here? Why won't this work?