Page 2 of 2

Re: disabling movement

Posted: Tue Jul 08, 2014 9:32 am
by maneus
That is another solution, Chimera005ao. But the problem here is that every time the player wants to move he run into the blockage and make the sound "party_move_blocked".
So in my eyes the cMove counter solution is more professional than yours.

Re: disabling movement

Posted: Tue Jul 08, 2014 12:37 pm
by Komag
Best to use Notepad++ for lua text editing, you can even set the programming language to LUA for a little extra syntax help, and it looks nice and neat, and no chance of line break errors that Notepad or Wordpad can sometimes cause.

Re: disabling movement

Posted: Tue Jul 08, 2014 8:48 pm
by Chimera005ao
But the problem here is that every time the player wants to move he run into the blockage and make the sound "party_move_blocked".
So in my eyes the cMove counter solution is more professional than yours.
True... and I suppose you could still use an onMove hook to block player movement in a specific direction.
I'm thinking about how you could do that dynamically. Perhaps onMove return false if a certain object is on that tile?

Generally what I wanted was to prevent player and monster movement and attacks toward one another, while enemies line a hall, until after a certain event.
And generating an invisible maze might also be on the list.

Re: disabling movement

Posted: Wed Jul 09, 2014 12:55 pm
by aaneton
This thread describes how to create a party_blocker, which is easy to spawn or/and place with level editor (I used this in ORRR2).

viewtopic.php?f=14&t=4886&start=20

Add to 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,
    }