teleport stations

Post Reply
crlyttle
Member
Posts: 64
Joined: Tue Jun 29, 2021 19:28
In-game: crl

teleport stations

by crlyttle » Post

I'm trying to implement a dungeon crawl game like the old Zork and need something for "magic motion" aka "teleport".
One example is the "Round Room" which has 8 doors. When spinning , exiting through any door randomly selects one of 8 destinations.
Attached is an example representing a "maze of twisty passages all alike" for finding a route between biomes.
I've been looking at "Random Teleport" by Droog71, Travelnet bySokomine, and Travelnet by mt-mods, and tpad.
I would like a pad (or mirror) the player could strike and be teleported to another co-ordinate. The destination could be
fixed or randomly selected from a list.
Is there a mod that does that?
(sorry about poor quality of image. All paths are one-way)
Attachments
twistyPassages.png
twistyPassages.png (12.67 KiB) Viewed 718 times

Droog71
Member
Posts: 37
Joined: Sat May 29, 2021 21:09

Re: teleport stations

by Droog71 » Post

Since you need something very specific, you will probably have to make the mod yourself.
Here is an example of how you can create a teleport pad with 8 locations and a randomly selected destination.

Code: Select all

local locations = {
    vector.new(1000,10,1000),
    vector.new(2000,10,2000),
    vector.new(1000,10,-1000),
    vector.new(2000,10,-2000),
    vector.new(-1000,10,1000),
    vector.new(-2000,10,1000),
    vector.new(-1000,10,-1000),
    vector.new(-2000,10,-2000)
}

minetest.register_node("zork:teleport_pad", {
    name = "teleport_pad",
    description = "teleport_pad",
    tiles = {"teleport_pad.png"}
})

minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
    if node.name == "zork:teleport_pad" then
        local random_pos = math.random(1,8)
        puncher:set_pos(locations[random_pos])
    end
end)

User avatar
Blockhead
Member
Posts: 1623
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: teleport stations

by Blockhead » Post

Droog71 wrote:
Sat Jan 15, 2022 23:16
Since you need something very specific, you will probably have to make the mod yourself.
Here is an example of how you can create a teleport pad with 8 locations and a randomly selected destination.
This, but move the on_punch to the node definition instead of a global on_punchnode. Also could remove the variable but that's un-useful code golfing.

Code: Select all

minetest.register_node("zork:teleport_pad", {
    ....
    on_punch = function(pos, node, puncher, pointed_thing)
        local random_pos = math.random(1,8)
        puncher:set_pos(locations[random_pos])
    end)
})
Or if you wanted to do it based on time, such that the teleport destination is changing in a repeatable fashion:

Code: Select all

    on_punch = function(pos, node, puncher, pointed_thing)
        local random_pos = (minetest.get_gametime() % 8)+1
        puncher:set_pos(locations[random_pos])
    end)
And of course you can retrofit this logic into one of the existing mods which already have other features like playing a sound and sending a chat message. I would go for teleport_potion or warps as I personally find travelnet ugly and overpowered. Another reference for a similar thing to check would be Modular Portals since that dynamically changes the teleport destination as you travel between rooms.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

crlyttle
Member
Posts: 64
Joined: Tue Jun 29, 2021 19:28
In-game: crl

Re: teleport stations

by crlyttle » Post

Thanks all,
I think I have it from here. I like the idea of warp stones.
Another question: Is it possible to teleport between worlds? The story line would have more freedom as a
"parallel worlds" implementation.

Droog71
Member
Posts: 37
Joined: Sat May 29, 2021 21:09

Re: teleport stations

by Droog71 » Post

crlyttle wrote:
Sun Jan 16, 2022 16:58
Is it possible to teleport between worlds?
You might be able to use this mod https://content.minetest.net/packages/A ... imensions/ to do something like that.

crlyttle
Member
Posts: 64
Joined: Tue Jun 29, 2021 19:28
In-game: crl

Re: teleport stations

by crlyttle » Post

That might work. I've downloaded it and will try soon.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests