Page 1 of 1
Is there a working Spinner Plate Script?
Posted: Sun Oct 20, 2013 4:30 am
by fazzasx
HI Guys, I am back again!
I have trawled through the forum looking for a way to get the party to rotate either 180 degrees (basically turn opposite) and if they step back onto the plate from the opposite direction they will spin again. I can find anything that will do this.
I have tried djoldgames teleport rotate scripts but they dont seem to work for me? I tried installing the framework but I just cant get the script to work with it so i am not sure if the framework is working or not.
Does anyone have a reliable spinner plate technique out there? I have been looking since 10pm UK time and its now 0330

See how I love this
Let me now
Thanks
Re: Is there a working Spinner Plate Script?
Posted: Sun Oct 20, 2013 5:05 am
by Dr.Disaster
This should not be too hard to do from scratch.
1st: at the place you want to spin the party place a face-changing invisible silent teleporter activated by party only
2nd: around that teleporter place up to four invisible silent pressure plates activated by party only
3rd: now let each of those pressure plates call a script entitiy on the deactivation event, similar to the party stepping off from it
The script entity now needs to do this:
- read the parties facing with party.facing (see
http://www.grimrock.net/modding/scripting-reference/ )
- call Teleport:setTeleportTarget(x, y, facing, [level]) for the teleporter placed at 1st to set the facing the party shall have
for your always-180 set facing like this
Code: Select all
read <> set <> change
0 2 +2
1 3 +2
2 0 -2
3 1 -2
It could be this simple (not LUA tested, just to show the logic):
Code: Select all
if (party.facing > 1)
then
Teleport:setTeleportTarget(teleporter-x-location, teleporter-y-location, party.facing -2)
else
Teleport:setTeleportTarget(teleporter-x-location, teleporter-y-location, party.facing +2)
end
Re: Is there a working Spinner Plate Script?
Posted: Sun Oct 20, 2013 8:08 am
by alois
Dr.Disaster wrote:
Code: Select all
if (party.facing > 1)
then
Teleport:setTeleportTarget(teleporter-x-location, teleporter-y-location, party.facing -2)
else
Teleport:setTeleportTarget(teleporter-x-location, teleporter-y-location, party.facing +2)
end
Actually, it is easier than that (without if's):
Code: Select all
Teleport:setTeleportTarget(teleporter-x-location, teleporter-y-location, (party.facing+2)%4)
using the modulus "a%b" function which gives the remainder of the division of "a" by "b"; and "add two, then take the remainder of the divsion by 4" gives you exactly the results in your table (modulo 4, adding 2 or subtracting 2 is the same thing!)
alois

Re: Is there a working Spinner Plate Script?
Posted: Sun Oct 20, 2013 1:35 pm
by DesperateGames
I would choose the following approach:
1. create a script in the dungeon with an universal "spin" function:
Code: Select all
function spin()
party:setPosition(party.x, party.y, (party.facing+2)%4, party.level)
party:playScreenEffect("teleport_screen")
end
2. Insert pressure plates (visible or hidden, as you like) and let them call the spin() function on activation.
The "teleport_screen" effect is optional, but I would add a screen effect and maybe a sound effect to let the player know that the spinning is intentional and not a bug in the dungeon

Re: Is there a working Spinner Plate Script?
Posted: Sun Oct 20, 2013 5:29 pm
by fazzasx
DesperateGames wrote:I would choose the following approach:
1. create a script in the dungeon with an universal "spin" function:
Code: Select all
function spin()
party:setPosition(party.x, party.y, (party.facing+2)%4, party.level)
party:playScreenEffect("teleport_screen")
end
2. Insert pressure plates (visible or hidden, as you like) and let them call the spin() function on activation.
The "teleport_screen" effect is optional, but I would add a screen effect and maybe a sound effect to let the player now that the spinning is intentional and not a bug in the dungeon

Thanks to maloi and desperategames for the ideas here. I went with desperategames suggesion as this was very simple to implement for a newbie like me.
Big thanks to all that contributed to this
