OK lemme see if I can flesh out this idea in script...
You would need a custom monster with an onDamage hook... so for example if you were using an Ogre. you would put the following in your
monsters.lua file in the folder
YOUR_DUNGEON/mod_assets/scripts
Code: Select all
cloneObject{
name = "immune_ogre",
baseObject = "ogre",
onDamage = function(monster,amount,type)
return immunity_script.checkImmunity(monster,amount,type)
end,
}
you would also need a script entity in your dungeon called
immunity_script
Code: Select all
-- set up the immunity variables at the start
fire_immunity = 1
ice_immunity = 1
shock_immunity = 1
poison_immunity = 1
-- check immunity when the monster is damaged
function checkImmunity(monster,amount,type)
if type == "fire" and fire_immunity == 1 then
return false
elseif type == "ice" and ice_immunity == 1 then
return false
elseif type == "shock" and shock_immunity == 1 then
return false
elseif type == "poison" and poison_immunity == 1 then
return false
end
end
-- alcove scripts to adjust immunity variables and deal damage
That's for the monster immunity part.. Still needing to be added are alcove scripts to adjust the immunities and damage the monster.
Note that with this method every instance of the monster immune_ogre (assuming you spawn more than 1!) will have the exact same immunities... so remove fire immunity and all "immune_ogre"s suddenly become vulnerable to fire!
Regarding the alcove setup I have a couple of questions... can the items be removed from the altars once inserted? If yes, then what happens when they are??