Page 1 of 1

blocker = block spells - how to?

Posted: Tue Mar 10, 2015 6:27 pm
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,
}

Re: blocker = block spells - how to?

Posted: Wed Mar 11, 2015 12:01 am
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.

Re: blocker = block spells - how to?

Posted: Wed Mar 11, 2015 11:37 am
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.

Re: blocker = block spells - how to?

Posted: Wed Mar 11, 2015 7:08 pm
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.