Page 1 of 4

blocker for party?

Posted: Tue Jan 22, 2013 8:19 pm
by Pandafox
hi,

I would like to ask, what is the best way to make a "blocker" for the party (not for monsters) ?
I mean, something invisible but acting like a wall. The party can't walk, but the monsters can.

Re: blocker for party?

Posted: Tue Jan 22, 2013 10:05 pm
by Phitt
I guess the best way to do this would be a party hook. You use an onMove hook, check for x, y , level and the direction the player tries to move to and then you cancel it if necessary. Like this (not tested):

Code: Select all

onMove = function(self, dir)

if self.x == 1 and self.y == 13 and self.level == 3 and dir == 0 then
return false
end

end
Which would cancel any movement in north direction if the player is standing on the specified tile on level 3.

Re: blocker for party?

Posted: Tue Jan 22, 2013 10:11 pm
by Komag
Yeah that should do the trick very nicely. And it should be accompanied by a good fair explanation, because as a player I usually hate invisible walls unless there is a good plausible reason!

Re: blocker for party?

Posted: Tue Jan 22, 2013 10:29 pm
by Pandafox
Phitt wrote:I guess the best way to do this would be a party hook. You use an onMove hook, check for x, y , level and the direction the player tries to move to and then you cancel it if necessary. Like this (not tested):

Code: Select all

onMove = function(self, dir)

if self.x == 1 and self.y == 13 and self.level == 3 and dir == 0 then
return false
end

end
Which would cancel any movement in north direction if the player is standing on the specified tile on level 3.
Good idea but I need to place a lot of these... not easy to use this way...

Explanation of why I want to do that :
SpoilerShow
I want to make my ghost monsters walk through the walls.
I can make false walls monsters can walk through but the party also can... :? That's why I want to block the party same as if there is a real wall.

Re: blocker for party?

Posted: Tue Jan 22, 2013 10:37 pm
by Phitt
The only thing I could think of to make this work for more than just a few special occasions would be to place hidden pressure plates that set a counter to 1 when activated and set it back to 0 when deactivated. You'd need one for north, east, west and south and could place them properly (I hope multiple pressure plates on the same spot activate all at once). Then you could check for the counters in the script instead of a specific position. Would still be a lot of work to place all the pressure plates, but it would be doable at least unless you plan to have your ghost warriors everywhere in the whole dungeon.

Re: blocker for party?

Posted: Tue Jan 22, 2013 10:53 pm
by Pandafox
Phitt you gave to me an idea ;)
I will code that the same way I coded one of my wall puzzles, by creating secret doors and destroy them on activate and deactivate hidden plates!
If you are interesting about that I can copy here the code I will do.

Re: blocker for party?

Posted: Tue Jan 22, 2013 11:50 pm
by Pandafox
I made it :D

That's really cool to see the ghosts walk through the walls ! :mrgreen:

Image

The method to make it (using the skull wallset) :

1. make your way
2. place "false" walls where you want to have a wall the ghosts can walk through
3. place pillars (to make it good looking)
4. place pressure plates hidden on the way you have these walls
Pressure plates must be named like this :
" real_wall_1010_1 "
where 1 means place a WALL and 0 means don't place a WALL
1010 = a wall on facing 0, no wall onfacing 1, a wall on facing 2, no wall on facing 3
the last number is a unique ID (1, 2, 3, 4.........)

Image

Make a script and copy this code :

Code: Select all

function realwall(trigger)

	local dir0 = string.sub(trigger.id, 11, 11)
	local dir1 = string.sub(trigger.id, 12, 12)
	local dir2 = string.sub(trigger.id, 13, 13)
	local dir3 = string.sub(trigger.id, 14, 14)

	if (dir0=="1") then
		spawn("ast_skull_secret_door", party.level, party.x, party.y, 0, "rw0")
	end
	if (dir1=="1") then
		spawn("ast_skull_secret_door", party.level, party.x, party.y, 1, "rw1")
	end
	if (dir2=="1") then
		spawn("ast_skull_secret_door", party.level, party.x, party.y, 2, "rw2")
	end
	if (dir3=="1") then
		spawn("ast_skull_secret_door", party.level, party.x, party.y, 3, "rw3")
	end
	
end

function destrealwall()

	if findEntity ("rw0") then rw0:destroy() end
	if findEntity ("rw1") then rw1:destroy() end
	if findEntity ("rw2") then rw2:destroy() end
	if findEntity ("rw3") then rw3:destroy() end
	
end
Then, each pressure plate have :
- on activate : realwall()
- on deactivate : destrealwall()


I tried to be more clear as possible to explain this... But maybe it was not very very clear... sorry :roll:


EDIT: The result is very very cool ! Running into the maze to escape the ghosts and seeing them walking through the walls to catch you is awesome ! :lol:

Re: blocker for party?

Posted: Tue Jan 22, 2013 11:58 pm
by hyteria
how realllllllllllly great idea panda ! thx for sharing ! :p

Re: blocker for party?

Posted: Wed Jan 23, 2013 5:58 pm
by Leki
SpoilerShow
Pandafox wrote:I made it :D

That's really cool to see the ghosts walk through the walls ! :mrgreen:

Image

The method to make it (using the skull wallset) :

1. make your way
2. place "false" walls where you want to have a wall the ghosts can walk through
3. place pillars (to make it good looking)
4. place pressure plates hidden on the way you have these walls
Pressure plates must be named like this :
" real_wall_1010_1 "
where 1 means place a WALL and 0 means don't place a WALL
1010 = a wall on facing 0, no wall onfacing 1, a wall on facing 2, no wall on facing 3
the last number is a unique ID (1, 2, 3, 4.........)

Image

Make a script and copy this code :

Code: Select all

function realwall(trigger)

	local dir0 = string.sub(trigger.id, 11, 11)
	local dir1 = string.sub(trigger.id, 12, 12)
	local dir2 = string.sub(trigger.id, 13, 13)
	local dir3 = string.sub(trigger.id, 14, 14)

	if (dir0=="1") then
		spawn("ast_skull_secret_door", party.level, party.x, party.y, 0, "rw0")
	end
	if (dir1=="1") then
		spawn("ast_skull_secret_door", party.level, party.x, party.y, 1, "rw1")
	end
	if (dir2=="1") then
		spawn("ast_skull_secret_door", party.level, party.x, party.y, 2, "rw2")
	end
	if (dir3=="1") then
		spawn("ast_skull_secret_door", party.level, party.x, party.y, 3, "rw3")
	end
	
end

function destrealwall()

	if findEntity ("rw0") then rw0:destroy() end
	if findEntity ("rw1") then rw1:destroy() end
	if findEntity ("rw2") then rw2:destroy() end
	if findEntity ("rw3") then rw3:destroy() end
	
end
Then, each pressure plate have :
- on activate : realwall()
- on deactivate : destrealwall()


I tried to be more clear as possible to explain this... But maybe it was not very very clear... sorry :roll:


EDIT: The result is very very cool ! Running into the maze to escape the ghosts and seeing them walking through the walls to catch you is awesome ! :lol:
Heh - I have the same trick in my ToW --> one less surprise / I must find something else now :-)

Re: blocker for party?

Posted: Wed Jan 23, 2013 6:07 pm
by Pandafox
Leki wrote: Heh - I have the same trick in my ToW --> one less surprise / I must find something else now :-)
:D oh sorry !