blocker = block spells - how to?

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

blocker = block spells - how to?

Post by bongobeat »

Is there any way to make a blocker that block spells? (fireball, lightning bolt, etc...)

I need this for this custom blocker, that block the party, but not the monsters.
SpoilerShow

Code: Select all

defineObject{
	name = "blocker_party",
	components = {
		{
			class = "Obstacle",
			blockParty = true,
			blockItems = true,
			blockMonsters = false,
		},
		{
			class = "Controller",
			onActivate = function(self)
				self.go.obstacle:enable()
			end,
			onDeactivate = function(self)
				self.go.obstacle:disable()
			end,
			onToggle = function(self)
				if self.go.obstacle:isEnabled() then
					self.go.obstacle:disable()
				else
					self.go.obstacle:enable()
				end
			end,
		},
	},
	tags = { "scripting" },
	placement = "floor",
	editorIcon = 96,
}
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: blocker = block spells - how to?

Post by minmay »

Use ProjectileColliderComponent to block only projectiles but not monsters or the party. If you want to block only some projectiles but not others, use the collision mask field on your projectiles and collider.
Last edited by minmay on Wed Mar 11, 2015 7:08 pm, edited 1 time in total.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: blocker = block spells - how to?

Post by bongobeat »

I feel dumb, I ve looked for the projectilleCollider in the forcefield definition and just use same thing. :roll:
SpoilerShow

Code: Select all

defineObject{
	name = "blocker_party",
	components = {
		{
			class = "Obstacle",
			hitSound = "impact_blunt",
			hitEffect = "hit_wood",
			blockParty = true,
			blockItems = true,
			blockMonsters = false,
		},
		{
			class = "ProjectileCollider",
			size = vec(3, 3, 3),
		},
		{
			class = "Controller",
			onActivate = function(self)
				self.go.obstacle:enable()
				self.go.projectilecollider:enable()
			end,
			onDeactivate = function(self)
				self.go.projectilecollider:disable()
				self.go.obstacle:disable()
			end,
			onToggle = function(self)
				if self.go.obstacle:isEnabled() then
					self.go.obstacle:disable()
				else
					self.go.obstacle:enable()
				end
			end,
		},
	},
	tags = { "scripting" },
	placement = "floor",
	editorIcon = 96,
}
yes I need such obstacle, I use it with a special tile. It's somekind of obstacle that block the party, but not monsters like ghost.
it's ok now, thank you for your help!

what do you mean that you couldn't fake it? Actually this blocker works great. It blocks party shots, spells, party and allow monster to pass.
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: blocker = block spells - how to?

Post by minmay »

bongobeat wrote:what do you mean that you couldn't fake it? Actually this blocker works great. It blocks party shots, spells, party and allow monster to pass.
Oops...you're right. That feature does exist in LoG2. I was still thinking of Grimrock 1 obstacles which don't allow selective blocking like that.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Post Reply