Jump to content

Inventory Disabled in Combat


aveskite

Recommended Posts

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
End

Any thoughts on what could be going wrong?

Link to comment
Share on other sites

What happens? Have you assigned this script to a new quest?

 

Add this line just below "Short inventoryDisabled"

Float fQuestDelayTime

Then add this line just below "Begin GameMode":

Set fQuestDelayTime to 0.5

This 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 by forli
Link to comment
Share on other sites

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 by aveskite
Link to comment
Share on other sites

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 by forli
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...