Re: blocker for party?
Posted: Wed Mar 20, 2013 5:42 pm
Couldn't you just use an invisible textured blockage or door?
Indeed! Got one in your pocket?Neikun wrote:Couldn't you just use an invisible textured blockage or door?
I thought this was an odd time for you to be out about. Enjoy your nap, and rest well in the comfort that you do much good in this world.Neikun wrote:Sorry I skimmed to be honest. I'm on the verge of going for a nap.
https://www.dropbox.com/s/pua54yentpbpp ... _empty.dds
Here is a 1 pixel invisible texture.
Just define a material with it, retexture a door model with that material, save the new model and define it as a secret door, perhaps.
Or you could retexture an unbreakable blockage and save it as a new blockage.
Maybe it's too early for me (no coffee yet), but I'm not sure how using blockers that affect only monsters would help stick the party to a specific tile?Alcator wrote:actually, you could use DEactivated BLOCKERS, and in your onMove hook check if at the "destination" tile there is this blocker.
When a blocker is deactivated, monsters can move through it with no problem.
This would be slightly more efficient than placing all those N/S/W/E hidden pressure plates (at the very least, there would be less objects to place) and it would also be easier to check visually (you see the red "X" marks)
Code: Select all
-- this defines party_blocker -- don't forget to always set it to "deactivated", so that monsters can get through.
cloneObject{
name = "party_blocker",
baseObject = "blocker",
editorIcon = 96,
}
-- this defines a party which cannot pass party_blockers:
cloneObject{
name = "party",
baseObject = "party",
onMove = function(self, dir)
local dx,dy = getForward(dir)
local destX = self.x + dx
local destY = self.y + dy
for i in entitiesAt(party.level,destX,destY) do
if i ~= nil and i.name == "party_blocker" then
return false
end
end
end,
}
If this really works, excellent job! This would be the very simple solution that it really seemed was out there waiting to be discovered (I had tried to use the blocker before, but couldn't get it to work without crashing). Is there a way to use it without creating a specific (cloned) party, though, via an in-editor script that calls the party at the start of the game?Alcator wrote:Yep, this is the best way:
Put this into your objects.lua:
Demo map source: Party Blocker TestCode: Select all
-- this defines party_blocker -- don't forget to always set it to "deactivated", so that monsters can get through. cloneObject{ name = "party_blocker", baseObject = "blocker", editorIcon = 96, } -- this defines a party which cannot pass party_blockers: cloneObject{ name = "party", baseObject = "party", onMove = function(self, dir) local dx,dy = getForward(dir) local destX = self.x + dx local destY = self.y + dy for i in entitiesAt(party.level,destX,destY) do if i ~= nil and i.name == "party_blocker" then return false end end end, }
In the map, you have a room with drainage tiles on the floor which the party cannot enter, but spiders run across it easily.
I'm not sure if you're talking to me? I think, maybe because of how active I am here, that people assume I know anything at all about lua, when I really don't. I think I misunderstood the usage of the cloned party as being incompatible with a custom party.Komag wrote:using the onMove party hook seems pretty essential to this approach, but it's also no problem to use a party hook, why the hesitation? You can always just add it to any existing hooks you may have in place, there is no conflict.