Page 3 of 4

Re: blocker for party?

Posted: Wed Mar 20, 2013 5:42 pm
by Neikun
Couldn't you just use an invisible textured blockage or door?

Re: blocker for party?

Posted: Wed Mar 20, 2013 5:46 pm
by SpiderFighter
Neikun wrote:Couldn't you just use an invisible textured blockage or door?
Indeed! Got one in your pocket? ;)

[Edit: ...and isn't that what I just said, in many, many more words? rofl!]

Re: blocker for party?

Posted: Wed Mar 20, 2013 5:55 pm
by Neikun
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.

Re: blocker for party?

Posted: Wed Mar 20, 2013 6:03 pm
by SpiderFighter
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.
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. :)

Re: blocker for party?

Posted: Thu Mar 21, 2013 9:54 am
by Alcator
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)

Re: blocker for party?

Posted: Thu Mar 21, 2013 2:31 pm
by SpiderFighter
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)
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?

Re: blocker for party?

Posted: Thu Mar 21, 2013 3:38 pm
by Alcator
Yep, this is the best way:

Put this into your objects.lua:

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,
}
Demo map source: Party Blocker Test
In the map, you have a room with drainage tiles on the floor which the party cannot enter, but spiders run across it easily.

Re: blocker for party?

Posted: Thu Mar 21, 2013 4:07 pm
by SpiderFighter
Alcator wrote:Yep, this is the best way:

Put this into your objects.lua:

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,
}
Demo map source: Party Blocker Test
In the map, you have a room with drainage tiles on the floor which the party cannot enter, but spiders run across it easily.
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?

[EDIT: Never mind, that question was due to my own ignorance. You've created the fix that everyone's been asking for, and it works beautifully! ]

Re: blocker for party?

Posted: Thu Mar 21, 2013 4:18 pm
by Komag
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.

Re: blocker for party?

Posted: Thu Mar 21, 2013 4:24 pm
by SpiderFighter
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.
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.

[EDIT: Never mind, my question was due to my own ignorance. Alcator has created the fix that everyone's been asking for, and it works beautifully! ]