Is this script ok?

Post » Sat Apr 06, 2013 9:06 am

Can someone please check the following script and let me know if its any good? Its a heavily edited bittercup script and is supposed to do this:
  • trigger when you activate the object (light)
  • dont allow the light to be equiped
  • ask the player to consume it or pick it up
  • when consumed, restore all magicka and disable the object
  • otherwise put it into inventory
It does all that ingame and seems to work as intended, but I am sure there is something to improve. Any known limitations e.g. with 'ModCurrentMagicka' such as incompatibilty with mana reg mods?

Begin PB_WelkyndStone_Scriptshort PCSkipEquipshort buttonshort messageOnshort drinkshort goneSet PCSkipEquip to 1  ; disable if used  (a 1 use item)if ( gone == 1 )  Disable  set gone to 0  returnendifif ( MenuMode == 1 )  returnendifif ( OnActivate == 1 )  Set messageOn to 2endifif ( messageOn == 0 )  returnendifif ( messageOn == 2 )  MessageBox "Do you wish to consume the Wekynd Stone? This stone will restore all your Magicka but will be destroyed in the process." "Consume the Welkynd Stone." "Pick it up."  Set messageOn to 1endifif ( messageOn == 1 )  set button to GetButtonPressed  if ( button == 0 )	; consume it   Set drink to 1   Set messageOn to 0  endif  if ( button == 1 )	; pick it up   Activate   Set messageOn to 0   return  endifendif  ; consume the stoneif ( drink == 1 )  Player-&--#62;PlaySound "restoration hit"  Player-&--#62;ModCurrentMagicka, 10000endif  ; cleanupset gone to 1set drink to 0end

Thanks in advance :smile:
User avatar
Darren Chandler
 
Posts: 3361
Joined: Mon Jun 25, 2007 9:03 am

Return to III - Morrowind