Hey guys, hopefully you enjoy this mod as much as I do. Some info:
Magicka and Fatigue: Not sure about Magicka but I might add a Fatigue bar in the future since it's an important gameplay feature, especially for hand to hand and melee players.
More healthbar styles: if you're up to it, you can draw a new widget and if it's good, I'll add it to the mod. The widget is made of 4 parts: background rectangle, animated health rectangle, healthbar rectangle and overlay (it can be another shape, just be sure that it overlays everything else).
Please note that combat is not dehardcoded yet so there's no way to know who hit who as of now.
Meanwhile, I plan to continue exploring the possibilities of OpenMW UI Lua.
Would be also great to know which widgets do you prefer.
If you experience lag/freezing when picking up herbs with this mod and Graphics Herbalism enabled: 1. Download this file: https://filebin.net/cev7pa56mnrzachn 2. Replace sme_widget.lua from this mod with it All props go to Grempington for finding the solution. PS. There is no need to do anything further, hit chance widget and everything else should work properly without any additional edits.
Legend absolutely works, atlas I thought I was just going to be settling to wait every other plant freezing my game. Genuinely, modding morrowind has been a death sentence but I've finally got things working to a nice point that my playthrough is perfect, except for these tiny problems like this one. I don't even know how some random like me could even figure this out because I wouldn't even come near the conclusion the healthbar mod is freezing the game whenever picking up damn ingredients.
Thank you practitioners of the dark arts that is morrowind modding
Hi, I wanted to make replacement textures for the health bar, which worked out well, but I found the widgets almost all have color props on them that really messed with my palette. Would you be willing to upload a version with the color props removed, or give me perms to upload such a file in a separate mod?
Hey there! first of all want to say awesome mod, really enjoying it.
Just wanted to say I experience a large hiccup (1-5 second freeze) when picking up herbs with graphics herbalism on as well. I was able to narrow it down to this mod (turning off this mod stops the freezes, turning on this mod starts the freezes)
Commenting out functionality from the script, I was able to also narrow it down specifically to the async raycast call itself. The callback had nothing to do with it, the state management had nothing to do with it. It was SPECIFICALLY the asynchronous raycasting.
I tried limiting it to not create additional raycast calls until the callback was handled so there's only one async raycast per queue, but that didn't have any effect.
Finally, I replaced the async raycast with a synchronous one (this required adding an onFrame engine handler and calling the getTooltipTarget in onFrame instead - as castRenderingRay should not be called outside of onFrame):
local result = nearby.castRenderingRay(from, to) ...
This solved all the performance issues I was having and the script still behaves exactly the same (In fact, it had to have behaved the same - as an async call, the callback was only called after the onUpdate that called the asyncCastRenderingRay finished executing - so having it happen onFrame is no different in terms of behaviour. Hell, it was even possible to have multiple asyncCastRenderingRay calls queued up without a single callback called yet because of that, which could've also created performance issues - particularly on lower end machines)
Hi, that's an amazing job finding (and even fixing) this issue. Playing with GH, I didn't have it, nor did I have any performance issues with my setup but if it makes the mod more performant, that's a great job. I haven't had much time lately due to searching for a new job so it would be amazing if you'd send me the script so I could update the mod right away. Again, great job, and I'm happy that you're enjoying the mod :)
Sure thing, how do you want me to send it to you? I could paste the code here if it's short enough, actually I'll paste the fix-related stuff instead of the entire file here for two reasons:
Length and comment section sanity sake
I also changed the format to be "[Name], Lv. ## [Title-Cased Class]" for personal taste and that's a distracting change
I am not using the latest version, using version 1.2 cause I experienced a crash in 1.2.1 and I can't really report it cause I have no idea if it's anything specific to the latest version or if it's because I have it running on top of POTI modlist (or if it's actually a repeatable bug)
Anyhow for the fix:
Replaced getTooltipTarget() with:--Casting a raycast and getting our actors, sync to be used onFrame local function getTooltipTargetSync(dt) local from = camera.getPosition() local to = from + camera.viewportToWorldVector(util.vector2(0.5, 0.5)) * settings.behavior:get('SMERaycastLength')
local result = nearby.castRenderingRay(from, to) tooltipTarget = result.hitObject if result.hitPos ~= nil then raycastCurrentLength = (result.hitPos - from):length() end end
Removed call to getTooltipTarget in onUpdate()
Added onFrame that simply calls getTooltipTargetSync():local function onFrame(dt) getTooltipTargetSync() end
Oops those are three reasons, not two. Not gonna edit the post again cause it keeps breaking the code formatting lol
Also regarding what I said with multiple asyncCastRenderingRay calls queueing up - I thought about it and it's probably not actually possible. The callback is most likely always called right before or after the next call to onFrame so the callback should always called in between two onUpdate calls. But that's irrelevant since the freezing happened to me anyways.
Since you're not experiencing it but me and other POTI users have experienced it, it could be some strange interaction between this mod and another lua mod causing it. But since this fix works I don't think there's a reason to worry about compatibility
Actually having issues implementing the fixes above. All changes I made were to sme_widget.lua but it is ambiguous if changes are necessary for other files.
pandastic4 Could you help me out a bit? Can't wrap my head around this. Where in sme_widget.lua do I have to place these lines? Do I have to do the same to sme_hitchance.lua or it won't function?
My friends and I did discover a few things when we were researching how to localize it. The script only takes the NPC_.CNAM field, and should then find the corresponding FNAM from CLAS to display the localized occupation name. Add these two lines to sme_widget.lua to display the occupation name in the corresponding language
local classRecord = types.NPC.classes.records[class] class = classRecord and classRecord.name or class
I am using the latest version of OpenMW development (7888a11c36) and I believe that this mod has some issues with game lag given the following being true Turn on "Settings>Visuals>Terrain>Distant Land" Turn on Graphic Herbalism Turn on this mod.
With those all on I find that looting herbs will cause a very significant drop in frames. Subsequent looting of herbs will be fine for a few seconds but it will return.
Herbalism + Distant Lands don't have this issue on their own. Happy to do more troubleshooting if you cannot reproduce this. Love the mod btw!
can you add if not types.Actor.getEquipment(self, types.Actor.EQUIPMENT_SLOT.CarriedRight) then return endto sme_hitchance.lua line 263 so it doesnt spam warnings when unarmed?
59 comments
Meanwhile, I plan to continue exploring the possibilities of OpenMW UI Lua.
Would be also great to know which widgets do you prefer.
1. Download this file:
https://filebin.net/cev7pa56mnrzachn
2. Replace sme_widget.lua from this mod with it
All props go to Grempington for finding the solution.
PS. There is no need to do anything further, hit chance widget and everything else should work properly without any additional edits.
Edit: NVM, just downloaded the one 6R4V3N provided
Thank you practitioners of the dark arts that is morrowind modding
I just wanted to make the health bars blue. :)
Just wanted to say I experience a large hiccup (1-5 second freeze) when picking up herbs with graphics herbalism on as well. I was able to narrow it down to this mod (turning off this mod stops the freezes, turning on this mod starts the freezes)
Commenting out functionality from the script, I was able to also narrow it down specifically to the async raycast call itself. The callback had nothing to do with it, the state management had nothing to do with it. It was SPECIFICALLY the asynchronous raycasting.
I tried limiting it to not create additional raycast calls until the callback was handled so there's only one async raycast per queue, but that didn't have any effect.
Finally, I replaced the async raycast with a synchronous one (this required adding an onFrame engine handler and calling the getTooltipTarget in onFrame instead - as castRenderingRay should not be called outside of onFrame):
local result = nearby.castRenderingRay(from, to)
...
This solved all the performance issues I was having and the script still behaves exactly the same (In fact, it had to have behaved the same - as an async call, the callback was only called after the onUpdate that called the asyncCastRenderingRay finished executing - so having it happen onFrame is no different in terms of behaviour. Hell, it was even possible to have multiple asyncCastRenderingRay calls queued up without a single callback called yet because of that, which could've also created performance issues - particularly on lower end machines)
Again, great job, and I'm happy that you're enjoying the mod :)
Anyhow for the fix:
--Casting a raycast and getting our actors, sync to be used onFrame
local function getTooltipTargetSync(dt)
local from = camera.getPosition()
local to = from + camera.viewportToWorldVector(util.vector2(0.5, 0.5)) * settings.behavior:get('SMERaycastLength')
local result = nearby.castRenderingRay(from, to)
tooltipTarget = result.hitObject
if result.hitPos ~= nil then
raycastCurrentLength = (result.hitPos - from):length()
end
end
local function onFrame(dt)
getTooltipTargetSync()
end
return {
engineHandlers =
{
onUpdate = onUpdate,
onFrame = onFrame
},
interfaceName = "SME_CORE",
interface = {
getRaycastTarget = getRaycastTarget,
getDistance = getDistance,
},
}
Also regarding what I said with multiple asyncCastRenderingRay calls queueing up - I thought about it and it's probably not actually possible. The callback is most likely always called right before or after the next call to onFrame so the callback should always called in between two onUpdate calls. But that's irrelevant since the freezing happened to me anyways.
Since you're not experiencing it but me and other POTI users have experienced it, it could be some strange interaction between this mod and another lua mod causing it. But since this fix works I don't think there's a reason to worry about compatibility
Edit: Never mind, it works fine if you just modify sme_widget.lua. Modify sme_hitchance.lua too if you want the hit chance.
The script only takes the NPC_.CNAM field, and should then find the corresponding FNAM from CLAS to display the localized occupation name.
Add these two lines to sme_widget.lua to display the occupation name in the corresponding language
local classRecord = types.NPC.classes.records[class]
class = classRecord and classRecord.name or class
Turn on "Settings>Visuals>Terrain>Distant Land"
Turn on Graphic Herbalism
Turn on this mod.
With those all on I find that looting herbs will cause a very significant drop in frames. Subsequent looting of herbs will be fine for a few seconds but it will return.
Herbalism + Distant Lands don't have this issue on their own.
Happy to do more troubleshooting if you cannot reproduce this.
Love the mod btw!
if not types.Actor.getEquipment(self, types.Actor.EQUIPMENT_SLOT.CarriedRight) then return end
to sme_hitchance.lua line 263 so it doesnt spam warnings when unarmed?