Thanks for the feedback guys. I agree that integrating the timers into the buttons would be pretty cool...
Here's a first attempt, which needs some refinement:
) The color fill is rendered on top of everything, as the actionbar elements are rendered all at once. Probably would have to delve into hardcoded land in order to make it background-only.
) All buttons that use the casting timer have the overlay applied, though I can easily just overlay it on the casting button.
) The overlay positions are manually set; they aren't actually tied to the actionbutton rendering, so UI mods that change the button locations would have to be accounted for...
) For this first round getting a rotary timer to work was a little complicated, so I just made the contingency timer work like everything else.
Thanks for the feedback guys. I agree that integrating the timers into the buttons would be pretty cool...
Does the overlay block the button from being clicked?
I am reminded of a timing issue with Time Stop. Aside from lasting for twice the specified duration (which has long been known aspect of the opcode), it's exact duration is randomly extended by up to 1 second.
I could never get both Time Stop and another effect to reliably expire at the exact same time (one of them a timer counting down to timestop's end), and since the Time Stop effect is not saved, it wasn't possible to investigate further.
I've found a bug. When EEex is installed, effects that invoke a splprot condtion that checks whether a stat is less than or greater than or equal to something (like STAT RESISTFIRE < 100 or STAT CHR >= specified value) always evaluate to false no matter what the stat is equal to (which means that opcodes 318, 324, and 326 won't work when checking a stat). When EEex is not installed, these effects work fine.
v0.5.3-alpha has been released to fix two important bugs:
Splprot stat lookup shouldn't be completely broken
Opcode #324 should only override strref if Special is non-zero
@OlvynChuru: Good catch. It's amazing my injected code wasn't causing a crash; in every right it should have been, as it was imbalancing the stack - only reason why it wasn't was because it was injected right before a stack-frame restore.
@Ulb: This bug might have been causing your crashes. Two registers weren't being restored correctly, so spells with splprot opcodes, such as cloudkill, theoretically could crash, (even though I never observed it).
The color fill is rendered on top of everything, as the actionbar elements are rendered all at once. Probably would have to delve into hardcoded land in order to make it background-only.
Bit of a pity, but hardly a deal breaker in my opinion.
The overlay positions are manually set; they aren't actually tied to the actionbutton rendering, so UI mods that change the button locations would have to be accounted for...
Is there a way for UI mods to account for EEex if detected instead of having to rely on EEex's detecting UI mods? I assume EEex should be installed as early as possible anyway, and I believe it shouldn't be on you to support all UI mods in existence; rather, it should be on each individual UI mod author to choose whether to support EEex features.
For this first round getting a rotary timer to work was a little complicated, so I just made the contingency timer work like everything else.
So, to confirm I'm getting this right: If I have, say, a Blade Barrier going on—the Blade Barrier would deal damage every time the yellow bar disappears? Then the yellow bar is full again and tells me the time it will take for Blade Barrier to deal damage again?
Separate request for @Bubb : Would it be feasible to externalize the effects of attributes (STR, DEX, CON, INT, WIS, CHA)? I'm especially interested in implementing the P&P effects of high INT (Illusion Immunity), high and low WIS (bonus to saves against mind-affecting spells; immunity to specific spells; chance of spell failure), and possibly high CON (not sure whether the bonus to Save vs Poison is implemented in the game?)
Separate request for @Bubb : Would it be feasible to externalize the effects of attributes (STR, DEX, CON, INT, WIS, CHA)? I'm especially interested in implementing the P&P effects of high INT (Illusion Immunity), high and low WIS (bonus to saves against mind-affecting spells; immunity to specific spells; chance of spell failure), and possibly high CON (not sure whether the bonus to Save vs Poison is implemented in the game?)
This can already be done. Opcode 326 (Apply Effects List) can check if one of the target's attributes is less than or at least a certain value. You can use this to give creatures effects that differ based on one of their attributes.
Separate request for @Bubb : Would it be feasible to externalize the effects of attributes (STR, DEX, CON, INT, WIS, CHA)? I'm especially interested in implementing the P&P effects of high INT (Illusion Immunity), high and low WIS (bonus to saves against mind-affecting spells; immunity to specific spells; chance of spell failure), and possibly high CON (not sure whether the bonus to Save vs Poison is implemented in the game?)
This can already be done. Opcode 326 (Apply Effects List) can check if one of the target's attributes is less than or at least a certain value. You can use this to give creatures effects that differ based on one of their attributes.
Ok, I spent way too much time today doing this, (look at the casting button):
I'm no longer rendering a color fill, but instead using a custom BAM that fits the underlying button. It took all of my GIMP-fu, and I had to write some helper programs to get it to do the animation - but I think it was worth it. How do you guys like it?
Edit: And yeah, you got the contingency timer right @AndreaColombo.
@Bubb close enough - it was just the only thing I saw with plenty of unused space around it, and it's not specific to the selected creature (because IIRC the same contingency timer is shared by all actors).
Personal opinion is that that yellow thing looks really out of place in comparison to the red and blue examples. Would it be possible to simply have it sit around the icon like for the other two?
Also, do keep in mind that some UIs move the loot icon elsewhere, so it may be more compatible if the yellow icon was behind one of the 12 normal icons on the toolbar. Perhaps the special action icon would work?
Finally, Yellow is quite a different color from Red and Blue. Perhaps Green or Purple would be more in line?
Just my 2 cents.
Oh, and since the Detect Traps icon is currently red, does that mean that's the active skill? IE. if the character would enter Stealth, would it switch to using the Stealth icon?
Also, how hard would it be to reverse the effect from slowly emptying from slowly filling? It's basically a 'loading bar' that you're waiting for. Bars tend to fill up rather than empty.
I like @Raduziel’s idea in general, but for characters with high APR it could be glitchy or too flashy (especially at higher levels.)
I also agree with @Thels about color; yellow doesn’t bother me but purple might be better-looking.
Not sure about using the special ability button for contingency effects, though. A straight bar as in @Bubb’s previous GIF works fine for me (and would be independent from the loot button’s position.) Since contingency effects work differently from other things, it’s OK if their counter also looks differently
@Bubb Can a similar thing be done to the weapons' slot so we know when the next swing will be?
EEex currently can't detect when a swing will happen. If I manage to code that, (and it would be a doozy, the system is so complex), it would be simple to output the result as some graphical element.
There's a reason why I'm a programmer and not an artist it seems... heh -
Personal opinion is that that yellow thing looks really out of place in comparison to the red and blue examples. Would it be possible to simply have it sit around the icon like for the other two?
What do you mean by "sit around"? Do you mean make it like the color animation used in the other buttons, or simply moving the border fill I'm doing now to surround one of the actionbar buttons?
Also, do keep in mind that some UIs move the loot icon elsewhere, so it may be more compatible if the yellow icon was behind one of the 12 normal icons on the toolbar. Perhaps the special action icon would work?
The special ability button might work; the only qualm I have with it is that the contingency timer really isn't related to "special abilities".
Oh, and since the Detect Traps icon is currently red, does that mean that's the active skill? IE. if the character would enter Stealth, would it switch to using the Stealth icon?
At the moment the timer always displays over interval-modal ability buttons. It probably would be a good change to only have it running if the skill is active...
Interval-modals include find traps, turn undead, and bardsong / shaman dance. All the other modal abilities don't follow the timer, so it would be pointless to overlay the timer on them. Edit: Actually, Stealth might use the timer for subsequent hide attempts; I'll have to look into it.
Also, how hard would it be to reverse the effect from slowly emptying from slowly filling? It's basically a 'loading bar' that you're waiting for. Bars tend to fill up rather than empty.
About as hard as reversing a FOR loop, (not that hard).
@Bubb I'll give the new version a spin then before doing anything with the .dmp files. Those files are surprisingly big and my upload speed is super crappy atm...
One more feature request for @Bubb : Would it possible to implement an option to disable the "action icons" that appear on the upper-right corner of characters' portraits?
I've got all the EEex / Lua code done to allow for the timer visualizations to be enabled / disabled like any other EEex module. For any UI modders out there, this functionality includes:
1) The ability to load subsequent .MENU files after UI.MENU has been loaded. This allows a modder to selectively load in menus / override vanilla menus via lua code.
2) Inject TEMPLATE elements into menus other than where they are defined.
For example, I use this functionality to load in a container menu which holds the timer templates, and then inject these templates into WORLD_ACTIONBAR. This allows me to add new elements to the vanilla interface without touching UI.MENU itself.
While I've finished the code part of things, I'm still not sure on what colors to make the timer progressions. I won't have time to work on EEex for the next few days, so sadly I won't be able to complete the 1% that's left in that timeframe.
If any artists would like to help a programmer out, I've attached some PNGs that just need to be colored.
(they fill bottom-to-top to show the state of the timer)
In the meanwhile, let me tag @Kilivitz about those features you've just implemented as I've got a feeling they could be beneficial to his UI work
...and while we're at it, I'll drop a couple feature requests (as though I hadn't requested enough of you already!)
As you are probably aware of, @Kilivitz is working on a port of the original BG stony UI to the Enhanced Editions. One thing about the original UI is that every button in the action bar at the bottom of the screen had a slightly different appearance (e.g. the stone would be chipped in different parts or show a slightly different crease/crack pattern). Replicating this in the Enhanced Edition is currently impossible as all buttons call the same BAM cycle. Would it be possible for EEex to allow for each button to call a different BAM cycle?
Also, would it be possible to externalize which music track is played in the games' main menu? (Appreciate EEex currently only supports BGII:EE but I assume the plan is to support BG:EE and SoD as well, eventually? We'd need this feature particularly for BG:EE.)
@AndreaColombo: Music should be possible. Also, EEex currently supports BG:EE (with and without SoD), BG2:EE, and IWD:EE - the only limitation right now is that it is Windows only.
OK, deadlines are not my thing. I have the timer visualization code uploaded, I just have to finish up the BAMs. I didn't account for the fact that I need slightly different BAMs for when a button is idle, pressed, and active + repeat for every game; that's a lot of BAMs!
One last question before I finish this up: should the timer visualizations be enabled when a button is idle? For example, should you only be able to see the "Find Traps" timer if find traps is currently being used by the thief, or should it always be displayed?
* Could you make a new script object that gets the actor with the specified actor ID? I've been experimenting with Lua functions called from opcodes and I noticed that it's possible for Lua functions to run CluaConsole commands such as C:Eval(). If you made an actor ID object, I could have a spell call a Lua function that gets the actor ID of the target and runs a script action on the target.
* Could you make an opcode that sets the target to do sneak attacks and crippling strikes or to do backstabs based on the parameter, regardless of what is set in the game options? I could then make a kit that specializes in crippling strikes, for example.
* Could you make a new opcode, or an additional feature of the Modify Backstab Multiplier opcode, that modifies the target's Sneak Attack modifier or Crippling Strike modifier?
* Could you make a new opcode, or an additional feature of the Remove Selection Circle opcode, that makes the target's selection circle invisible but does not prevent the target from being clicked on? Improved Invisibility in Icewind Dale 2 does this same thing when an enemy uses it. I want to give an effect like this to Invisible Stalkers.
* Could you make an additional feature of the Float Text opcode that keeps the string displayed for the duration of the effect if Special is non-zero? I'm making a new "Detect Creatures" spell that displays a string above each creature on the map. The nice thing about the Float Text opcode is that the text can be seen above the target even if the target is offscreen in a blacked-out, unexplored part of the map. The problem is that the text only lasts a few moments, regardless of the duration.
* Could you make a new script object that gets the actor with the specified actor ID? I've been experimenting with Lua functions called from opcodes and I noticed that it's possible for Lua functions to run CluaConsole commands such as C:Eval(). If you made an actor ID object, I could have a spell call a Lua function that gets the actor ID of the target and runs a script action on the target.
Right before using C:Eval() set the following Lua global:
EEex_LuaObject = <actorID here>
In essence, EEex_LuaObject is a Lua global that can be accessed from the scripting environment using the (identically named) EEex_LuaObject scripting object. Whatever actorID that occupies that global will be used as the object.
For example, this Lua code will force the currently selected leader to attempt to hide:
Comments
Yeah, loving it!
Here's a first attempt, which needs some refinement:
I am reminded of a timing issue with Time Stop. Aside from lasting for twice the specified duration (which has long been known aspect of the opcode), it's exact duration is randomly extended by up to 1 second.
I could never get both Time Stop and another effect to reliably expire at the exact same time (one of them a timer counting down to timestop's end), and since the Time Stop effect is not saved, it wasn't possible to investigate further.
@OlvynChuru: Good catch. It's amazing my injected code wasn't causing a crash; in every right it should have been, as it was imbalancing the stack - only reason why it wasn't was because it was injected right before a stack-frame restore.
@Ulb: This bug might have been causing your crashes. Two registers weren't being restored correctly, so spells with splprot opcodes, such as cloudkill, theoretically could crash, (even though I never observed it).
Bit of a pity, but hardly a deal breaker in my opinion.
My personal preference would be to apply the overlay to the casting button ("quarter moon and stars" button) only.
Is there a way for UI mods to account for EEex if detected instead of having to rely on EEex's detecting UI mods? I assume EEex should be installed as early as possible anyway, and I believe it shouldn't be on you to support all UI mods in existence; rather, it should be on each individual UI mod author to choose whether to support EEex features.
Tagging @Kilivitz on this one, by the way
So, to confirm I'm getting this right: If I have, say, a Blade Barrier going on—the Blade Barrier would deal damage every time the yellow bar disappears? Then the yellow bar is full again and tells me the time it will take for Blade Barrier to deal damage again?
Separate request for @Bubb : Would it be feasible to externalize the effects of attributes (STR, DEX, CON, INT, WIS, CHA)? I'm especially interested in implementing the P&P effects of high INT (Illusion Immunity), high and low WIS (bonus to saves against mind-affecting spells; immunity to specific spells; chance of spell failure), and possibly high CON (not sure whether the bonus to Save vs Poison is implemented in the game?)
This can already be done. Opcode 326 (Apply Effects List) can check if one of the target's attributes is less than or at least a certain value. You can use this to give creatures effects that differ based on one of their attributes.
@AndreaColombo
I'm interested in doing this. Give me maybe a week
I'm no longer rendering a color fill, but instead using a custom BAM that fits the underlying button. It took all of my GIMP-fu, and I had to write some helper programs to get it to do the animation - but I think it was worth it. How do you guys like it?
Edit: And yeah, you got the contingency timer right @AndreaColombo.
@kjeron: Is this about what you were thinking for the contingency timer?
Also, do keep in mind that some UIs move the loot icon elsewhere, so it may be more compatible if the yellow icon was behind one of the 12 normal icons on the toolbar. Perhaps the special action icon would work?
Finally, Yellow is quite a different color from Red and Blue. Perhaps Green or Purple would be more in line?
Just my 2 cents.
Oh, and since the Detect Traps icon is currently red, does that mean that's the active skill? IE. if the character would enter Stealth, would it switch to using the Stealth icon?
Also, how hard would it be to reverse the effect from slowly emptying from slowly filling? It's basically a 'loading bar' that you're waiting for. Bars tend to fill up rather than empty.
I also agree with @Thels about color; yellow doesn’t bother me but purple might be better-looking.
Not sure about using the special ability button for contingency effects, though. A straight bar as in @Bubb’s previous GIF works fine for me (and would be independent from the loot button’s position.) Since contingency effects work differently from other things, it’s OK if their counter also looks differently
EEex currently can't detect when a swing will happen. If I manage to code that, (and it would be a doozy, the system is so complex), it would be simple to output the result as some graphical element.
There's a reason why I'm a programmer and not an artist it seems... heh -
What do you mean by "sit around"? Do you mean make it like the color animation used in the other buttons, or simply moving the border fill I'm doing now to surround one of the actionbar buttons?
The special ability button might work; the only qualm I have with it is that the contingency timer really isn't related to "special abilities".
I was trying to match a color to the meaning of the timer, but I agree that purple would look better to the eyes.
At the moment the timer always displays over interval-modal ability buttons. It probably would be a good change to only have it running if the skill is active...
Interval-modals include find traps, turn undead, and bardsong / shaman dance. All the other modal abilities don't follow the timer, so it would be pointless to overlay the timer on them. Edit: Actually, Stealth might use the timer for subsequent hide attempts; I'll have to look into it.
About as hard as reversing a FOR loop, (not that hard).
EDIT: Filed on Redmine too for good measure.
to true. Once enabled, the action overlay part of the portraits should be suppressed.
1) The ability to load subsequent .MENU files after UI.MENU has been loaded. This allows a modder to selectively load in menus / override vanilla menus via lua code.
2) Inject TEMPLATE elements into menus other than where they are defined.
For example, I use this functionality to load in a container menu which holds the timer templates, and then inject these templates into WORLD_ACTIONBAR. This allows me to add new elements to the vanilla interface without touching UI.MENU itself.
While I've finished the code part of things, I'm still not sure on what colors to make the timer progressions. I won't have time to work on EEex for the next few days, so sadly I won't be able to complete the 1% that's left in that timeframe.
If any artists would like to help a programmer out, I've attached some PNGs that just need to be colored.
(they fill bottom-to-top to show the state of the timer)
In the meanwhile, let me tag @Kilivitz about those features you've just implemented as I've got a feeling they could be beneficial to his UI work
...and while we're at it, I'll drop a couple feature requests (as though I hadn't requested enough of you already!)
As you are probably aware of, @Kilivitz is working on a port of the original BG stony UI to the Enhanced Editions. One thing about the original UI is that every button in the action bar at the bottom of the screen had a slightly different appearance (e.g. the stone would be chipped in different parts or show a slightly different crease/crack pattern). Replicating this in the Enhanced Edition is currently impossible as all buttons call the same BAM cycle. Would it be possible for EEex to allow for each button to call a different BAM cycle?
Also, would it be possible to externalize which music track is played in the games' main menu? (Appreciate EEex currently only supports BGII:EE but I assume the plan is to support BG:EE and SoD as well, eventually? We'd need this feature particularly for BG:EE.)
OK, deadlines are not my thing. I have the timer visualization code uploaded, I just have to finish up the BAMs. I didn't account for the fact that I need slightly different BAMs for when a button is idle, pressed, and active + repeat for every game; that's a lot of BAMs!
One last question before I finish this up: should the timer visualizations be enabled when a button is idle? For example, should you only be able to see the "Find Traps" timer if find traps is currently being used by the thief, or should it always be displayed?
Agreed
* Could you make a new script object that gets the actor with the specified actor ID? I've been experimenting with Lua functions called from opcodes and I noticed that it's possible for Lua functions to run CluaConsole commands such as C:Eval(). If you made an actor ID object, I could have a spell call a Lua function that gets the actor ID of the target and runs a script action on the target.
* Could you make an opcode that sets the target to do sneak attacks and crippling strikes or to do backstabs based on the parameter, regardless of what is set in the game options? I could then make a kit that specializes in crippling strikes, for example.
* Could you make a new opcode, or an additional feature of the Modify Backstab Multiplier opcode, that modifies the target's Sneak Attack modifier or Crippling Strike modifier?
* Could you make a new opcode, or an additional feature of the Remove Selection Circle opcode, that makes the target's selection circle invisible but does not prevent the target from being clicked on? Improved Invisibility in Icewind Dale 2 does this same thing when an enemy uses it. I want to give an effect like this to Invisible Stalkers.
* Could you make an additional feature of the Float Text opcode that keeps the string displayed for the duration of the effect if Special is non-zero? I'm making a new "Detect Creatures" spell that displays a string above each creature on the map. The nice thing about the Float Text opcode is that the text can be seen above the target even if the target is offscreen in a blacked-out, unexplored part of the map. The problem is that the text only lasts a few moments, regardless of the duration.
Right before using C:Eval() set the following Lua global:
In essence, EEex_LuaObject is a Lua global that can be accessed from the scripting environment using the (identically named) EEex_LuaObject scripting object. Whatever actorID that occupies that global will be used as the object.
For example, this Lua code will force the currently selected leader to attempt to hide:
I'll start looking into the rest
https://support.baldursgate.com/issues/36158
https://support.baldursgate.com/issues/26799
https://support.baldursgate.com/issues/22737