I tested it in game and everything works except the immunities: I was able to damage it with my fire spells. What gives?cloneObject{
name = "destructable_dungeon_cave_in",
baseObject = "dungeon_cave_in",
health = 100,
evasion = -1000,
hitSound = "impact_blade",
brokenModel = "assets/models/env/floor_dirt.fbx",
immunities = { "poison", "assassination", "fire", "backstab", "cold", "shock" },
}
giving immunities to objects
- Shloogorgh
- Posts: 45
- Joined: Sat Sep 22, 2012 12:24 am
giving immunities to objects
I noticed that monsters can have immunity to damage types, so when I was making a destructible version of the cave in, I attempted to give it immunities to a lot of different damage types.
Re: giving immunities to objects
Isn't that only monsters can have immunities ?
- Shloogorgh
- Posts: 45
- Joined: Sat Sep 22, 2012 12:24 am
Re: giving immunities to objects
Ah, that's a shame
- Montis
- Posts: 340
- Joined: Sun Apr 15, 2012 1:25 am
- Location: Grimrock II 2nd playthrough (hard/oldschool)
Re: giving immunities to objects
you should be able to achieve that with a custom onDamage hook like
Code: Select all
if damageType == "poison" then
return false
end
- Shloogorgh
- Posts: 45
- Joined: Sat Sep 22, 2012 12:24 am
Re: giving immunities to objects
That's a great idea, but it doesn't seem to work for me. Tried to make it immune to fire, but right now fire spells seem to work normally
Code: Select all
cloneObject{
name = "destructable_dungeon_cave_in",
baseObject = "dungeon_cave_in",
health = 100,
evasion = -1000,
brokenModel = "assets/models/env/floor_dirt.fbx",
onDamage = function()
if damageType == "fire" then
hudPrint("Seems to have no effect")
return false
else
playSound("impact_blade")
end
end
}
Re: giving immunities to objects
Seems like you have an error in your onDamage function - it should have 3 parameters, like here:
Code: Select all
cloneObject{
name = "destructable_cave_in",
baseObject = "dungeon_cave_in",
health = 100,
evasion = -1000,
brokenModel = "assets/models/env/floor_dirt.fbx",
onDamage = function(self, damage, damageType)
if damageType == "fire" then
hudPrint("Seems to have no effect")
return false
else
playSound("impact_blade")
end
end
}
- Shloogorgh
- Posts: 45
- Joined: Sat Sep 22, 2012 12:24 am
Re: giving immunities to objects
ah, that did it, thanks