blocker for party?

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Alcator
Posts: 37
Joined: Fri Apr 13, 2012 9:59 am

Re: blocker for party?

Post by Alcator »

SpiderFighter wrote: 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?
It would appear that you cannot use cloneObject in lua script objects in game (it fails with an error message hinting at illegality of cloneObject).

But as Komag said, it's much better to do all hook alterations in external scripts.
Alcator
Posts: 37
Joined: Fri Apr 13, 2012 9:59 am

Re: blocker for party?

Post by Alcator »

SpiderFighter wrote: (...) I think I misunderstood the usage of the cloned party as being incompatible with a custom party.
There should be no conflict.

you can do whatever you need to CUSTOMize your party (i.e., change your champions etc.), the whole idea behind clone'd party is that the party object that is moving through the dungeon has additional checks or options attached to it. The same would be true for clone'd champions -- for instance, there's a script around here somewhere where if a champion dies, that champion is teleported into a prison CELL, and when the party comes into that cell and "touches" the prisoner there, the champion is returned to the party. It's done with cloned Champion that has an onDie hook.
User avatar
SpiderFighter
Posts: 789
Joined: Thu Apr 12, 2012 4:15 pm

Re: blocker for party?

Post by SpiderFighter »

Alcator wrote:
SpiderFighter wrote: (...) I think I misunderstood the usage of the cloned party as being incompatible with a custom party.
There should be no conflict.

you can do whatever you need to CUSTOMize your party (i.e., change your champions etc.), the whole idea behind clone'd party is that the party object that is moving through the dungeon has additional checks or options attached to it. The same would be true for clone'd champions -- for instance, there's a script around here somewhere where if a champion dies, that champion is teleported into a prison CELL, and when the party comes into that cell and "touches" the prisoner there, the champion is returned to the party. It's done with cloned Champion that has an onDie hook.
Thanks, that makes sense now. I'm trying to learn lua, but it's difficult sometimes to wrap my head around. The last language I learned anything about was TurboPASCAL, and that was a quarter century ago! :shock:
Grimfan
Posts: 369
Joined: Wed Jan 02, 2013 7:48 am

Re: blocker for party?

Post by Grimfan »

Okay scripting gurus and maestros, I need your brilliance.

In my mod I'm using both this party hook:

Code: Select all

cloneObject{
   name = "party",
   baseObject = "party",
	onMove = function(self, dir)
      if (cMove:getValue() == 0) then
         return false
      end
         return true
   end,
}
and party_blockers:

Code: Select all

cloneObject {
   name = "party",
   baseObject = "party",
   onMove = function(party,direction)
	local dx,dy = getForward(party.facing)
	
	local destX = party.x + dx
    
	local destY = party.y + dy
	
	for i in entitiesAt(party.level,destX,destY,party.facing) do
      	
		if i ~= nil and i.name == "party_blocker" then
        	
			return false
		end
	end
However the cMove script is preventing my party_blockers from working. The party_blockers show up and I can activate and deactivate them, but they don't block the party. What is the best way of combining these two onMove hooks so they retain their functionality and work together? I have yet to trial any ideas in case somebody with true scripting cred can come up with a good way of combining these scripts.

As always, any help would be lovely. :)
Grimfan
Posts: 369
Joined: Wed Jan 02, 2013 7:48 am

Re: blocker for party?

Post by Grimfan »

Okay, the previous problem is solved. I got the two scripts to work together but decided against cMove because party_blockers are more versatile. However, now my deactivated party_blockers are still blocking the party. Anyone have an idea what might cause that to happen?
XkyoSemantic
Posts: 1
Joined: Tue Sep 30, 2014 7:14 am

Re: blocker for party?

Post by XkyoSemantic »

Grimfan wrote:Okay, the previous problem is solved. I got the two scripts to work together but decided against cMove because party_blockers are more versatile. However, now my deactivated party_blockers are still blocking the party. Anyone have an idea what might cause that to happen?
This is a bit old, but figured I'd reply in case your question was still unsolved. If you're using the same code you linked - your cloned party looks for the party_blocker name in general and stops movement, regardless of the activated/deactivated state of it. This is so the party can't pass trough a tile, but monsters still can (since they aren't affected by the deactivated blocker). Quick fix, I'd make a function to spawn the blockers into the placement you want, then destroy them on a timer or pressure plate activation.
Post Reply