Page 1 of 1
[SOLVED] Teleporters that don't conserve momentum?
Posted: Sun Feb 22, 2015 9:13 pm
by Zo Kath Ra
I've made a simple test dungeon with a 4-sided teleporter.
Depending on what direction you enter the teleporter from, it takes you to one of four possbile destinations (done with floor triggers and scripts that change the teleporter destination).
When you fall into the teleporter from above, it takes you to a 5th destination.
Problem: teleporters conserve momentum.
There are a few solutions in this thread, but they aren't exactly what I'm looking for:
http://grimrock.net/forum/viewtopic.php?f=14&t=8406
Is there any way to make a teleporter not conserve momentum?
Re: Teleporters that don't conserve momentum?
Posted: Sun Feb 22, 2015 9:25 pm
by minmay
Use party.gravity:setFallingSpeed() to remove their vertical momentum.
Re: Teleporters that don't conserve momentum?
Posted: Mon Feb 23, 2015 6:55 pm
by Zo Kath Ra
minmay wrote:Use party.gravity:setFallingSpeed() to remove their vertical momentum.
I've put a floor trigger under the teleporter.
The floor trigger is linked to a script that calls party.gravity:setFallingSpeed(0)
This solution doesn't work, because the floor trigger doesn't get activated (teleporter has a higher priority).
It doesn't matter if I walk into the teleporter from the same elevation, or if I fall into it from above.
Then I put a floor trigger on the destination square.
The floor trigger does get activated, but only after the party takes falling damage.
Since there are no "onEnterTeleporter" or "onLeaveTeleporter" hooks, I guess I'll just have to put a water tile at the destination.
Re: Teleporters that don't conserve momentum?
Posted: Mon Feb 23, 2015 8:14 pm
by minmay
Put floor triggers in the air squares above the teleporter that the party can walk into, and check the party's position every frame after they are triggered.
Re: Teleporters that don't conserve momentum?
Posted: Wed May 27, 2015 7:43 pm
by Zo Kath Ra
Place a script entity called "script_entity_1" in a level and put this code in it:
Code: Select all
function timerTick()
local level, x, y, elevation = teleporter_1.teleporter:getTeleportTarget()
if ((party.level == level) and (party.x == x) and (party.y == y) and (party.elevation == elevation)) then
party.gravity:setFallingSpeed(0)
timer_1.timer:disable()
end
end
Place a timer called "timer_1" in the same level, and
- disable its timer component
- set its timerInterval to 0
- set its onActivate connector to script_entity_1 / timerTick
Place a teleporter called "teleporter_1" in the level at h=0.
The teleporter_1's destination should be at ground level.
Place a floor trigger called "floor_trigger_1" above teleporter_1, and set its onActivate connector to timer_1 / start
When you walk onto floor_trigger_1 (from a tile that has the same elevation), you will fall into teleporter_1, and emerge at its destination without taking falling damage.