Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
function changeResistances(monster,newResistances)
local damageTypes = {"fire","cold","shock","poison","physical","dispel"}
local resists = {}
for _,type in ipairs(damageTypes) do
resists[type] = newResistances[type] or monster:getResistance(type)
end
monster:setResistances(resists)
end
it brings up an error code that says attempt to index local 'newResistances' (a nil value)
so I tried to fill in some of the stuff where it says type :S
The error is occurring because you are not passing anything as the second argument in the function call. I even gave an example. I responded to your post believing that you had a Grimrock 2 modding question, not that you were asking someone to teach you Lua in disguise. There are many tutorials and manuals online that you can consult for that.
This will be my last post in this topic. I am not interested in wasting my time with someone who is not acting in good faith.