Page 1 of 2

Rotating the party

Posted: Fri Oct 19, 2012 12:08 pm
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...

Re: Rotating the party

Posted: Fri Oct 19, 2012 12:33 pm
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)

Re: Rotating the party

Posted: Fri Oct 19, 2012 1:12 pm
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!

Re: Rotating the party

Posted: Fri Oct 19, 2012 1:27 pm
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.

Re: Rotating the party

Posted: Fri Oct 19, 2012 1:31 pm
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.

Re: Rotating the party

Posted: Fri Oct 19, 2012 1:39 pm
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.

Re: Rotating the party

Posted: Fri Oct 19, 2012 1:49 pm
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.

Re: Rotating the party

Posted: Fri Oct 19, 2012 2:04 pm
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..?

Re: Rotating the party

Posted: Fri Oct 19, 2012 2:15 pm
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 ?

Re: Rotating the party

Posted: Fri Oct 19, 2012 4:44 pm
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.