giving immunities to objects

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
Shloogorgh
Posts: 45
Joined: Sat Sep 22, 2012 12:24 am

giving immunities to objects

Post by Shloogorgh »

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.
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" },
}
I tested it in game and everything works except the immunities: I was able to damage it with my fire spells. What gives?
User avatar
Blichew
Posts: 157
Joined: Thu Sep 27, 2012 12:39 am

Re: giving immunities to objects

Post by Blichew »

Isn't that only monsters can have immunities ?
User avatar
Shloogorgh
Posts: 45
Joined: Sat Sep 22, 2012 12:24 am

Re: giving immunities to objects

Post by Shloogorgh »

Ah, that's a shame
User avatar
Montis
Posts: 340
Joined: Sun Apr 15, 2012 1:25 am
Location: Grimrock II 2nd playthrough (hard/oldschool)

Re: giving immunities to objects

Post by Montis »

you should be able to achieve that with a custom onDamage hook like

Code: Select all

if damageType == "poison" then
   return false
end
When destiny calls, the chosen have no choice.

My completed dungeon (LoG1): Hypercube
User avatar
Shloogorgh
Posts: 45
Joined: Sat Sep 22, 2012 12:24 am

Re: giving immunities to objects

Post by Shloogorgh »

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
}
User avatar
Blichew
Posts: 157
Joined: Thu Sep 27, 2012 12:39 am

Re: giving immunities to objects

Post by Blichew »

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
}
User avatar
Shloogorgh
Posts: 45
Joined: Sat Sep 22, 2012 12:24 am

Re: giving immunities to objects

Post by Shloogorgh »

ah, that did it, thanks
Post Reply