If you don't like the critical display, element damage display, etc., try editing lines 129 to 158 of [HardOrSoft.lua]. If the damage is "Gray", no additional damage notation, such as a critical indication, can be added.
I fixed a major performance issue for this mod while customizing it to my liking. Instead of hooking the execute method, that is updated several times per frame, this version only hooks once per damage text to display. I have added my code below so that you may use it for a future version if you wish. It is missing functionality that I didn't care about but the logic remains mostly the same.
local config = {} local damageNumDisp local damageResult local damageCalcParam local damageTable = {} local currentVersion = 1.0
local function Reset() config.Version = currentVersion; config.Enable = true; config.BuddyDamageHide = false; config.CriticalDisplay = false; config.ElementDisplay = false; config.ChangeFont = false config.FontType = 0; end
local function SaveConfig() config.Version = currentVersion json.dump_file("DamageDisplay.json", config); end
local function LoadConfig() loadConfig = json.load_file("DamageDisplay.json") if loadConfig ~= nil then config = loadConfig end if config.Version ~= currentVersion then Reset() SaveConfig() end end
local function getDamageStats(damageTable, damageValue) for i = 1, #damageTable do if damageTable[i][1] == damageValue then local retval = damageTable[i] table.remove(damageTable, i) return retval end end return {0, 0, 0, 0} end
LoadConfig()
re.on_config_save(function() SaveConfig() end)
sdk.hook(sdk.find_type_definition("snow.gui.GuiDamageDisp.NumDisp"):get_method("startNumDisp"), function(args) if not config.Enable then return end damageNumDisp = sdk.to_managed_object(args[2]) end, function(retval) if not config.Enable then return retval end local text = damageNumDisp._DamageText local damageStats = getDamageStats(damageTable, tonumber(text:get_Message())) if damageNumDisp.DispType == -1 or damageNumDisp.DispType == 3 then return retval end local damageDispValue = text:get_Message() local newDamageDispValue = damageDispValue if config.CriticalDisplay then if damageStats[4] == 1 then newDamageDispValue = newDamageDispValue .. "!" elseif damageStats[4] == 2 then newDamageDispValue = newDamageDispValue .. "?" end end if config.ElementDisplay and damageStats[3] ~= 0 then newDamageDispValue = newDamageDispValue .. " (" .. math.floor(damageStats[3]) .. ")" end if config.ChangeFont then text:set_FontSlot(config.FontType) else text:set_FontSlot(1) end if damageDispValue ~= newDamageDispValue then text:set_Message(newDamageDispValue) end
return retval end)
sdk.hook(sdk.find_type_definition("snow.enemy.EnemyUtility"):get_method("getHitUIColorType"), function(args) if not config.Enable then return end damageResult = sdk.to_managed_object(args[2]) damageCalcParam = damageResult._CalcParam local dmg = damageResult:get_TotalDamage() local physical = damageResult:get_PhysicalDamage() local element = damageResult:get_ElementDamage() local critical = damageResult:get_CriticalResult() table.insert(damageTable, 1, {dmg, physical, element, critical}) end, function(retval) if config.Enable and config.BuddyDamageHide then local ownerType = damageCalcParam:get_OwnerType() if ownerType == 5 or ownerType == 6 then return sdk.to_ptr(-1); end end return retval end)
re.on_draw_ui(function() if imgui.tree_node("Damage Display") then local changed = false; local configChanged = false;
changed, config.Enable = imgui.checkbox("Enabled", config.Enable); if changed then configChanged = configChanged or changed; end
changed, config.BuddyDamageHide = imgui.checkbox("Hide Buddy Damage", config.BuddyDamageHide); if changed then configChanged = configChanged or changed; end
changed, config.CriticalDisplay = imgui.checkbox("Display Critical Hits", config.CriticalDisplay); if changed then configChanged = configChanged or changed; end
changed, config.ElementDisplay = imgui.checkbox("Display Elemental Damage", config.ElementDisplay); if changed then configChanged = configChanged or changed; end
changed, config.ChangeFont = imgui.checkbox("Change Font", config.ChangeFont); if changed then configChanged = configChanged or changed; end
changed, config.FontType = imgui.slider_int("Font Type", config.FontType, 0, 15); if changed then configChanged = configChanged or changed; end
if imgui.button("Reset") == true then Reset() SaveConfig() end
Lovely mod ty so much!its great to been able to see how much job its doing element ,change the color of explosions, change the font tipes,the display timers and hide your budies damage.one thing i would improve its changing the crits with bigger number maybe or outlines for the numbers.Anyway great mod a must have.Support this guy he diserves it.works perfectly on title uptade 4 u can even install it while the game its running just press reset scripts under the script runner tab.
Hi, I was wondering what lines 136 - 137 do after seeing the question marks and how it differs from 134-135. Thank you so much for the mod and happy new year!
134 if v.critical == 1 then 135 msg = msg .. "!" 136 elseif v.critical == 2 then 137 msg = msg .. "?"
can you please add an option for Large White text? I like using color for raw and size for element, and the only one I can't do that for right now is element weakpoints that don't trigger wex or mind's eye.
May I ask how can I make the number appear like mhw (have a X around the numbers) instead of a exclamation mark behind the numbers when I Crit. Really great mod though !
The size can be changed but the display will be a bit unnatural. For this reason I did not add that feature. If you must, try adding the following sentence between lines 120 and 121 for ver 5.0. Changing the default of 35 will change the size. local size=text:call("get_FontSize") size:set_field("w",35) size:set_field("h",35) text:call("set_FontSize",size)
on a totally different subject than the mod mentioned, I GOTTA KNOW what is the blood mod ur using when ur fighting the rajang (shown in the IMAGES tab)? looks really nice!
86 comments
If you don't like the critical display, element damage display, etc., try editing lines 129 to 158 of [HardOrSoft.lua].
If the damage is "Gray", no additional damage notation, such as a critical indication, can be added.
Instead of hooking the execute method, that is updated several times per frame, this version only hooks once per damage text to display.
I have added my code below so that you may use it for a future version if you wish. It is missing functionality that I didn't care about but the logic remains mostly the same.
local config = {}
local damageNumDisp
local damageResult
local damageCalcParam
local damageTable = {}
local currentVersion = 1.0
local function Reset()
config.Version = currentVersion;
config.Enable = true;
config.BuddyDamageHide = false;
config.CriticalDisplay = false;
config.ElementDisplay = false;
config.ChangeFont = false
config.FontType = 0;
end
local function SaveConfig()
config.Version = currentVersion
json.dump_file("DamageDisplay.json", config);
end
local function LoadConfig()
loadConfig = json.load_file("DamageDisplay.json")
if loadConfig ~= nil then
config = loadConfig
end
if config.Version ~= currentVersion then
Reset()
SaveConfig()
end
end
local function getDamageStats(damageTable, damageValue)
for i = 1, #damageTable do
if damageTable[i][1] == damageValue then
local retval = damageTable[i]
table.remove(damageTable, i)
return retval
end
end
return {0, 0, 0, 0}
end
LoadConfig()
re.on_config_save(function()
SaveConfig()
end)
sdk.hook(sdk.find_type_definition("snow.gui.GuiDamageDisp.NumDisp"):get_method("startNumDisp"), function(args)
if not config.Enable then
return
end
damageNumDisp = sdk.to_managed_object(args[2])
end, function(retval)
if not config.Enable then
return retval
end
local text = damageNumDisp._DamageText
local damageStats = getDamageStats(damageTable, tonumber(text:get_Message()))
if damageNumDisp.DispType == -1 or damageNumDisp.DispType == 3 then
return retval
end
local damageDispValue = text:get_Message()
local newDamageDispValue = damageDispValue
if config.CriticalDisplay then
if damageStats[4] == 1 then
newDamageDispValue = newDamageDispValue .. "!"
elseif damageStats[4] == 2 then
newDamageDispValue = newDamageDispValue .. "?"
end
end
if config.ElementDisplay and damageStats[3] ~= 0 then
newDamageDispValue = newDamageDispValue .. " (" .. math.floor(damageStats[3]) .. ")"
end
if config.ChangeFont then
text:set_FontSlot(config.FontType)
else
text:set_FontSlot(1)
end
if damageDispValue ~= newDamageDispValue then
text:set_Message(newDamageDispValue)
end
return retval
end)
sdk.hook(sdk.find_type_definition("snow.enemy.EnemyUtility"):get_method("getHitUIColorType"), function(args)
if not config.Enable then
return
end
damageResult = sdk.to_managed_object(args[2])
damageCalcParam = damageResult._CalcParam
local dmg = damageResult:get_TotalDamage()
local physical = damageResult:get_PhysicalDamage()
local element = damageResult:get_ElementDamage()
local critical = damageResult:get_CriticalResult()
table.insert(damageTable, 1, {dmg, physical, element, critical})
end, function(retval)
if config.Enable and config.BuddyDamageHide then
local ownerType = damageCalcParam:get_OwnerType()
if ownerType == 5 or ownerType == 6 then
return sdk.to_ptr(-1);
end
end
return retval
end)
re.on_draw_ui(function()
if imgui.tree_node("Damage Display") then
local changed = false;
local configChanged = false;
changed, config.Enable = imgui.checkbox("Enabled", config.Enable);
if changed then
configChanged = configChanged or changed;
end
changed, config.BuddyDamageHide = imgui.checkbox("Hide Buddy Damage", config.BuddyDamageHide);
if changed then
configChanged = configChanged or changed;
end
changed, config.CriticalDisplay = imgui.checkbox("Display Critical Hits", config.CriticalDisplay);
if changed then
configChanged = configChanged or changed;
end
changed, config.ElementDisplay = imgui.checkbox("Display Elemental Damage", config.ElementDisplay);
if changed then
configChanged = configChanged or changed;
end
changed, config.ChangeFont = imgui.checkbox("Change Font", config.ChangeFont);
if changed then
configChanged = configChanged or changed;
end
changed, config.FontType = imgui.slider_int("Font Type", config.FontType, 0, 15);
if changed then
configChanged = configChanged or changed;
end
if imgui.button("Reset") == true then
Reset()
SaveConfig()
end
if configChanged then
SaveConfig();
end
imgui.tree_pop()
end
end)
Is there a way to change the color of Non-Critical Hits (Switch Axe Phial Bursts and Charge Blade Phial Damage) into Blue?
134 if v.critical == 1 then
135 msg = msg .. "!"
136 elseif v.critical == 2 then
137 msg = msg .. "?"
For this reason I did not add that feature.
If you must, try adding the following sentence between lines 120 and 121 for ver 5.0.
Changing the default of 35 will change the size.
local size=text:call("get_FontSize")
size:set_field("w",35)
size:set_field("h",35)
text:call("set_FontSize",size)