Was looking to make monsters who are resistant to certain attacks without being completely immune.
Example;
resist_fire = 50,
resist_shock = 50,
Thought this would do it, since other stats like protection and evasion work this way for monsters, but it doesn't. Can monsters just not have resistance?
Monster Resistance
Re: Monster Resistance
I don't think there is an easy way to do this.Soaponarope wrote:Was looking to make monsters who are resistant to certain attacks without being completely immune.
Example;
resist_fire = 50,
resist_shock = 50,
Thought this would do it, since other stats like protection and evasion work this way for monsters, but it doesn't. Can monsters just not have resistance?
Maybe you can use the onDamage event on the monster, check it's damage type, reduce it and damage it for the reduced amount in a category that the monster has 0 reduction.
Example:
Monster has 0% resistance against physical attack, and 50% resistance against fire.
The onDamage() event might look like this
Code: Select all
function onDamage(who, amount, kind)
if (kind == "fire") then
damageTile(who.level, who.x, who.y, who.facing, 61, "physical", amount/2)
return false
end
endDid you visit the Wine Merchant's Basement? And heard about the Awakening of Taarnab?
Re: Monster Resistance
ok, I'm back, I like answering easy questions, makes me look smart.
If you wanted a monster that was 70% resistant to fire, you would use the onDamage hook like this:
Haven't tested so no guarantees. 
If you wanted a monster that was 70% resistant to fire, you would use the onDamage hook like this:
Code: Select all
onDamage = function(self, amount, type)
if type == "fire" then
amount = amount * 0.3
end
return amount
end,- Soaponarope
- Posts: 180
- Joined: Thu Oct 04, 2012 3:21 am
Re: Monster Resistance
Batty, your script really should work, but it doesn't either.
Damage is the same no matter what.
Damage is the same no matter what.
Re: Monster Resistance
Yeah, doesn't work, it seems to return all or nothing for damage. Mahric's should work but you need to figure out which champ did the damage so they get exp.
Re: Monster Resistance
You could hack it by having the damage be completely negated (make the hook return false) but then also trigger a script to damage the square with the reduced amount of damage
Finished Dungeons - complete mods to play
- Soaponarope
- Posts: 180
- Joined: Thu Oct 04, 2012 3:21 am
Re: Monster Resistance
At first I wasn't sure about using damageTile for this, but it works well.
I use this to find champion doing damage.
local originator = 2 ^ (champion:getOrdinal()+1)
Thanks Mahric
I use this to find champion doing damage.
local originator = 2 ^ (champion:getOrdinal()+1)
Thanks Mahric
Re: Monster Resistance
No problem, glad to help anytime! 
Did you visit the Wine Merchant's Basement? And heard about the Awakening of Taarnab?
