Jump to content

No Inventory in Combat (noob script help)


aveskite

Recommended Posts

I'm completely inexperienced with scripting. I'm trying to make a simple script to disable access to the journal/inventory when in combat. Here's what I've got so far.

scn aaaNoInventoryInCombat

begin GameMode
    
    if player.isincombat == 1
        player.disablecontrol 17
    endif

end

What am I missing? Any help is appreciated.

Link to comment
Share on other sites

DisableControl must not be called on the player. It's a standalone command, so simply use:

DisableControl 17

Also, don't forget the inventory can be opened with the keys F1, F2, F3, F4, so you need to disable them as well.

Don't forget to enable them back when not in combat, and store a variable to avoid calling "Disable*" continuously. Here:

scn aaaNoInventoryInCombat

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

  • Recently Browsing   0 members

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