Rotating the party

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
SinusPi
Posts: 8
Joined: Fri Oct 19, 2012 11:57 am

Rotating the party

Post by SinusPi »

Perhaps the most famous dungeon-crawler "puzzle" is having the party randomly turned around.

So, how do I do this..?
- Party.facing is read-only
- I tried a teleporter with setChangeFacing(true), but I can't change a teleporter's .facing either

So... am I stuck with having to create 4 teleporters on one square, and activating the one that I need in order to turn the party in a specific direction..? Sounds like terrible overkill for me...
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: Rotating the party

Post by Grimwold »

This has definitely been mentioned on the forums before. I think it may have been in the EOB thread - viewtopic.php?f=14&t=3350&start=50&hilit=waterdeep
but there are 11 pages and with a cursory glance I can't just find it.

I think if I were going to try scripting it I would use hidden pressure plates at each entrance that destroy the existing teleporter and spawn a new one with the appropriate facing.

e.g. something like:

Code: Select all

rotator_teleporter:destroy()
spawn("teleporter",level,x,y,facing,"rotator_teleporter")
  :setTriggeredByMonster(false)
  :setTriggeredByItem(false)
  :setTeleportTarget(x,y,facing)
  :setChangeFacing(true)
  :setInvisible(true)
  :setSilent(true)
  :setScreenFlash(false)
Last edited by Grimwold on Fri Oct 19, 2012 1:37 pm, edited 1 time in total.
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Rotating the party

Post by Komag »

You also want the teleporter to only work for an extremely short period of time or else the player won't be able to move!
Finished Dungeons - complete mods to play
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: Rotating the party

Post by Grimwold »

Komag wrote:You also want the teleporter to only work for an extremely short period of time or else the player won't be able to move!
I didn't realise this was an issue.. I thought, like falling, a teleporter wouldn't activate if you entered it from another teleporter.
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Rotating the party

Post by Komag »

Ah, yes you're right about single teleporters, my mistake. The problem occurs if you loop two or more teleporters, then you can't get out.
Finished Dungeons - complete mods to play
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: Rotating the party

Post by Grimwold »

Komag wrote:Ah, yes you're right about single teleporters, my mistake. The problem occurs if you loop two or more teleporters, then you can't get out.
Ah, that makes sense. Thanks.
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: Rotating the party

Post by Grimwold »

Just tested it, and this worked well for me:

Code: Select all

function replaceTeleport(plate)
  -- hudPrint(plate.id)
  if plate.id == "plate_N" then
    Tfacing = 3
  elseif plate.id == "plate_E" then
    Tfacing = 0
  elseif plate.id == "plate_S" then
    Tfacing = 1
  elseif plate.id == "plate_W" then
    Tfacing = 2
  else
    Tfacing = 0
  end
  turner_teleporter:destroy()
  spawn("teleporter",1,22,8,Tfacing,"turner_teleporter")
    :setTriggeredByMonster(false)
    :setTriggeredByItem(false)
    :setTeleportTarget(22,8,Tfacing)
    :setChangeFacing(true)
    :setInvisible(true)
    :setSilent(true)
    :setScreenFlash(false)
end
* Create 4 plates and name them plate_N; plate_E; plate_S and plate_W
* Link all 4 plates to a script entity with the above code and the action replaceTeleport
* Place a teleporter and name it turner_teleporter
* Change the co-ordinates of the spawn location and teleport target to suit.

This setup rotates the party clockwise... for other combinations, change the Tfacing values.
SinusPi
Posts: 8
Joined: Fri Oct 19, 2012 11:57 am

Re: Rotating the party

Post by SinusPi »

Hummm. I guess it would work then...

function rotateParty(facing)
spawn("teleporter",party.level,party.x,party.y,facing,"turner_teleporter")
:setTriggeredByMonster(false)
:setTriggeredByItem(false)
:setTeleportTarget(party.x,party.y,facing)
:setChangeFacing(true)
:setInvisible(true)
:setSilent(true)
:setScreenFlash(false)
end
end

... and later just remove it.
Hum, is it just me, or is there no "Activated" hook on a teleporter..?
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: Rotating the party

Post by Grimwold »

SinusPi wrote: Hum, is it just me, or is there no "Activated" hook on a teleporter..?
do you mean to test if it is activated, like

Code: Select all

turner_teleporter:isActivated()
Or do you mean a way to call a function the moment it is activated ?
SinusPi
Posts: 8
Joined: Fri Oct 19, 2012 11:57 am

Re: Rotating the party

Post by SinusPi »

I mean the moment a party/monster/item gets teleported, if I were to make - say - a teleporter that only works under certain conditions, or only teleports certain items thrown at it, and lets others through.
Post Reply