Open Necrym59 opened 2 weeks ago
local user_defined_global_toughness = "MyArmourToughness"
if user_defined_global_toughness > "" then
if _G["g_UserGlobal['"..user_defined_global_toughness.."']"] ~= nil then
chanceofarmourdegredation = math.random(1,10 / _G["g_UserGlobal['"..user_defined_global_toughness.."']"])
If g_UserGlobal.MyArmourToughness is 0 then 10/0 will give infinity and result in a NaN error in the parameter to math.random, that would cause the error shown.
I could suggest a fix if I knew what MyArmourToughness is supposed to represent!
Iv discovered it only seems happen if the "MyArmourToughness" value is set to higher than 10, so it wasnt a random thing at all i just happened by accident to set the value higher than 10, perhaps a check not to exceed that number in the global created would suffice.
Ahh, that makes sense as then the second parameter to random will be less than the first, maybe that is what is generating the error.
This errore will pop up when hurt in gameplay.![gameplayererror](https://github.com/TheGameCreators/GameGuruRepo/assets/95015657/91d75e27-8435-49ff-b4cb-5d5b02acc20f)