Outbound links
You can add links from your scene out to other content, either to other scenes or to external websites.
Use the Scene Editor #
The easiest way to add an external link or a teleport is to use the Scene Editor . Use the Teleport Smart Item to add teleport to another scene in Genesis City, or use any of the Social Links smart items to add links to external sites.
Teleports #
To teleport a player to another scene, call the following function, indicating the coordinates that you want players to teleport to.
import { teleportTo } from "~system/RestrictedActions"
(...)
teleportTo({ worldCoordinates: { x: -51, y: 1 } })
Players are presented a confirmation screen before they are teleported, this screen displays information from the destination scene’s scene.json file
, including the scene name
, description
and navmapThumbnail
. See
scene metadata
for details on how to set this data.
Bare in mind that teleports take you to a scene in the indicated coordinates, but not necessarily to that same coordinates. This means that when travelling to a scene that has multiple parcels, players may not be landing on the same coordinates as specified, but rather into one of the spawn points designated by the creator of the scene.
To move a player to another set of coordinates inside the current scene, use the movePlayerTo()
function instead. See
Move a Player
.
Teleport to a WORLD #
To send a player to a scene that is not published in the open world Genesis City map, but instead to an isolated
Decentraland WORLD
, use the function changeRealm()
.
import { changeRealm } from "~system/RestrictedActions"
(...)
changeRealm({realm: 'mannakia.dcl.eth'})
Players are presented a confirmation screen before they are teleported, this screen displays information from the destination scene’s scene.json file
, including the scene name
, description
and navmapThumbnail
. See
scene metadata
for details on how to set this data.
The player will spawn in on of the spawn points of the scene in that world, regardless of their current coordinates on the map.
External links #
To add a link to an external website, use the openExternalUrl()
command.
import { openExternalUrl } from '~system/RestrictedActions'
openExternalUrl({ url: 'google.com' })
To prevent any abusive usage of this feature to spam players, it’s only possible to call the openExternalUrl
from an explicit click or button event on an entity. It’s not possible to call this function as a result of a timer, or a collision area, or a global click event. See
Button events
for details on how to do this.
When openExternalUrl
is called, players are prompted with a confirmation screen, where they are informed of where the link will take them, and where can accept of decline to visit the link.
The link is opened in a new tab, keeping the original tab in Decentraland.
If players tick the trust this domain checkbox, they won’t be prompted again during their session, as long as the link comes from the same scene and is to the same domain.