Monster Resistance

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
Soaponarope
Posts: 180
Joined: Thu Oct 04, 2012 3:21 am

Monster Resistance

Post by Soaponarope »

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?
User avatar
mahric
Posts: 192
Joined: Sun Nov 04, 2012 3:05 pm

Re: Monster Resistance

Post by mahric »

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?
I don't think there is an easy way to do this.

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
end
I didn't check the above function so it might be full of typo's, but it's to give you a general idea of the solution. :)
Did you visit the Wine Merchant's Basement? And heard about the Awakening of Taarnab?
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Monster Resistance

Post by Batty »

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:

Code: Select all

onDamage = function(self, amount, type)
   if type == "fire" then
      amount = amount * 0.3
   end
   return amount
end,
Haven't tested so no guarantees. :)
User avatar
Soaponarope
Posts: 180
Joined: Thu Oct 04, 2012 3:21 am

Re: Monster Resistance

Post by Soaponarope »

Batty, your script really should work, but it doesn't either.

Damage is the same no matter what.
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Monster Resistance

Post by Batty »

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.
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Monster Resistance

Post by Komag »

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
User avatar
Soaponarope
Posts: 180
Joined: Thu Oct 04, 2012 3:21 am

Re: Monster Resistance

Post by Soaponarope »

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
User avatar
mahric
Posts: 192
Joined: Sun Nov 04, 2012 3:05 pm

Re: Monster Resistance

Post by mahric »

No problem, glad to help anytime! :mrgreen:
Did you visit the Wine Merchant's Basement? And heard about the Awakening of Taarnab?
Post Reply