aveskite Posted February 3, 2015 Share Posted February 3, 2015 I'm trying to make a plugin that disables access to the inventory when the player enters combat. I got some good help in the main forum but still can't get it to work so I thought I would ask here as well. Here's what I've got so far: scn NoInventoryInCombat Short inventoryDisabled Begin GameMode If Player.IsInCombat If (inventoryDisabled == 0) Set inventoryDisabled to 1 DisableControl 17 DisableKey 59 DisableKey 60 DisableKey 61 DisableKey 62 EndIf Else If (inventoryDisabled) Set inventoryDisabled to 0 EnableControl 17 EnableKey 59 EnableKey 60 EnableKey 61 EnableKey 62 EndIf EndIf EndAny thoughts on what could be going wrong? Link to comment Share on other sites More sharing options...
forli Posted February 3, 2015 Share Posted February 3, 2015 (edited) What happens? Have you assigned this script to a new quest? Add this line just below "Short inventoryDisabled" Float fQuestDelayTimeThen add this line just below "Begin GameMode": Set fQuestDelayTime to 0.5This way the script will run every 0.5 seconds.Without this line the script run every 5 seconds. This may explain why it seems it doesn't work. Edited February 3, 2015 by forli Link to comment Share on other sites More sharing options...
aveskite Posted February 5, 2015 Author Share Posted February 5, 2015 (edited) That did it! Thanks, forli. The only problem I'm having now is that if I load a save game while in combat, the inventory controls are still disabled in the new game, even out of combat. I've tried a few things but I can't figure out how to correct it. Edited February 5, 2015 by aveskite Link to comment Share on other sites More sharing options...
forli Posted February 5, 2015 Share Posted February 5, 2015 (edited) Ok, try this: scn NoInventoryInCombat Short inventoryDisabled Float fQuestDelayTime Begin GameMode If GetGameLoaded Set fQuestDelayTime to 0.5 Set inventoryDisabled to 1 - Player.IsInCombat ;Reset the inventoryDisabled variable EndIf If Player.IsInCombat If (inventoryDisabled == 0) Set inventoryDisabled to 1 DisableControl 17 DisableKey 59 DisableKey 60 DisableKey 61 DisableKey 62 EndIf Else If inventoryDisabled Set inventoryDisabled to 0 EnableControl 17 EnableKey 59 EnableKey 60 EnableKey 61 EnableKey 62 EndIf EndIf End Edited February 5, 2015 by forli Link to comment Share on other sites More sharing options...
aveskite Posted February 6, 2015 Author Share Posted February 6, 2015 It works perfectly now. Many, many thanks, forli! Link to comment Share on other sites More sharing options...
Recommended Posts