Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Neverwinter Nights: Enhanced Edition has been released! Visit nwn.beamdog.com to make an order. NWN:EE FAQ is available.
Soundtracks for BG:EE, SoD, BG2:EE, IWD:EE, PST:EE are now available in the Beamdog store.
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Is it possible to assign one class' interface to that of another class?

Contemplative_HamsterContemplative_Hamster Member Posts: 842
edited April 2018 in UI Modding
Is it possible to assign one class' interface to another class? Like, assigning the cleric's or cleric/mage's panel to a single-class mage for that sweet Turn Undead button (which does nothing in itself, of course)?

Post edited by Contemplative_Hamster on

Comments

  • BubbBubb Member Posts: 376
    edited April 2018
    Short answer: no. Long answer: no*

    The actionbar is one of the most hardcoded things in the UI. At the moment, there is nothing you can do in UI.MENU to alter the actionbar, or what appears in it. If you were *really* determined to change buttons around in the actionbar, you could technically re-implement it from scratch, though this is monumental task in of itself. Basically, you would be creating a custom actionbar, hiding the real actionbar, and simply mimicking the buttons of the real action bar. It would be more akin to macro buttons that link back to the original actionbar, but it would have the advantage of allowing complete customization. New buttons could be added, buttons could be removed, buttons could be moved around, etc.

    Edit: You would have to overcome some very big obstacles in order to create a completely custom actionbar... it is just the only way I can think of doing what you want. Of course you can add new buttons next to the actionbar very easily, if that also works.

    This is, of course, strictly talking about the UI side of things. I am not sure if you could implement what you want in some other part of the engine.

    Contemplative_Hamster
  • Contemplative_HamsterContemplative_Hamster Member Posts: 842
    @Bubb . I see. Thank you. One more question if I may:

    If I were to obtain the cleric/mage action bar for my mage by other means - a dual-classed cleric 2/specialist wizard X (dual classing into a kit thanks to Kjeron's mod) - is there a way to reassign what the Turn Undead button does?

  • BubbBubb Member Posts: 376
    @Contemplative_Hamster Yes, it should be easy enough to reassign the Turn Undead button's action. You can do this by checking the tooltip of the correct button, making sure it's in the Turn Undead state, and then executing an alternate behavior if everything checks out. Here's a quick example of how to do it:

    1. Search UI.MENU for WORLD_ACTIONBAR
    2. Scroll down until you see this code:
    button { area 231 1 52 52 actionBar 3 enabled "buttonArray:GetButtonEnabled(3)" tooltip lua "actionBarTooltip[3]" action "buttonArray:OnLButtonPressed(3)" actionAlt "buttonArray:OnRButtonPressed(3)" }
    3. Replace that code with this code:
    button { area 231 1 52 52 actionBar 3 enabled "buttonArray:GetButtonEnabled(3)" tooltip lua "actionBarTooltip[3]" action " if actionBarTooltip[3] == 'F4 : Turn Undead' then Infinity_DisplayString('Overriden Behavior!') -- Do whatever you want your custom action to be here. else buttonArray:OnLButtonPressed(3) end " actionAlt "buttonArray:OnRButtonPressed(3)" }
    It's even possible to check against the current player's class behavior overriding. Here's an example where only Cleric / Mages' Turn Undead button is overridden:
    button { area 231 1 52 52 actionBar 3 enabled "buttonArray:GetButtonEnabled(3)" tooltip lua "actionBarTooltip[3]" action " if actionBarTooltip[3] == 'F4 : Turn Undead' then Infinity_UpdateLuaStats() if characters[id].class == 'Cleric / Mage' then Infinity_DisplayString('Overriden Behavior!') -- Do whatever you want your custom action to be here. else buttonArray:OnLButtonPressed(3) end else buttonArray:OnLButtonPressed(3) end " actionAlt "buttonArray:OnRButtonPressed(3)" }

    lefreutContemplative_Hamster
  • lefreutlefreut Member Posts: 1,234
    Be aware that this will not work if you change the languages or change the key binding.

    Bubb
  • BubbBubb Member Posts: 376
    edited April 2018
    @lefreut
    Thanks; that's a good point! Here's a version of the first example which should work with any game language (and having the keybindings text disabled in Baldur.lua), just to show that it is possible:
    button { area 231 1 52 52 actionBar 3 enabled "buttonArray:GetButtonEnabled(3)" tooltip lua "actionBarTooltip[3]" action " tooltipString = actionBarTooltip[3] firstColonIndex = tooltipString:find(':', 1, true) if firstColonIndex == nil then firstColonIndex = -1 end actionbarButtonText = tooltipString:sub(firstColonIndex + 2, #tooltipString) if actionbarButtonText == Infinity_FetchString(4974) then Infinity_DisplayString('Overriden Behavior!') -- Do whatever you want your custom action to be here. else buttonArray:OnLButtonPressed(3) end " actionAlt "buttonArray:OnRButtonPressed(3)" }
    It should work, (in Baldur's Gate II, at least), as the string at strref 4974 is the Turn Undead label. We are also cutting off the key binding text, to make sure we are only comparing the actual button label.

    lefreutContemplative_Hamster
Sign In or Register to comment.