Make it immune against everything?Up
How i make the monster dont recieve damage...
Just make modifications to this
You would have to do something like this, but I would be worried how much resources this script would take.How can i create an imortal monster, that is imortal only when there is another x monster in the area??
local area_range = 7
local creature_needed = "Demon"
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
local specs = Game.getSpectators(creature:getPosition(), false, false, area_range, area_range, area_range, area_range)
for key, spec in pairs(specs) do
if spec:getName() == creature_needed then
return 0, 0, 0, 0
end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
creature:registerEvent(eventName)
Sure if he used this for all demons but he wouldn't be returning any valuesYou would have to do something like this, but I would be worried how much resources this script would take.
LUA:local area_range = 7 local creature_needed = "Demon" function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) local specs = Game.getSpectators(creature:getPosition(), false, false, area_range, area_range, area_range, area_range) for key, spec in pairs(specs) do if spec:getName() == creature_needed then return 0, 0, 0, 0 end end return primaryDamage, primaryType, secondaryDamage, secondaryType end
Also you'll have to register the event to the creature when it's spawned.
If it's spawned at map load then you would have to add something like this:LUA:creature:registerEvent(eventName)