Skip to content
False.Genesis edited this page Dec 25, 2018 · 2 revisions

Warping via nodes

Warping across maps, using WARP nodes

Let's say we have 3 maps, map1, map2 and map3, and we want to put "doors" to warp from one map to another:

Warping between maps

  • For the door on the right of map1, you need to put a node: warp map2 r (because the door is on the right of the map)
  • For the door on the left of map2, you need to put a node: warp map1 l (because the door is on the left of the map)
  • For the door on the bottom of map2, you need to put a node: warp map3 d (because the door is down)
  • For the door on top of map3, you need to put a node: warp map2 u (because the door is up)

The doors are automatically connected according to their location (right<->left, up<->down).

You will wrap as soon as the node is entered, and be placed on the opposing edge just outside of the node.

Warping across maps, using WARPNODE nodes

Works the same way, except you can specify where you want to go on the map. Naija will be placed on the node you specify:

warpnode map2 myNode r

Just place a myNode node somewhere on the map and you will warp to it. The node name should be unique on that map.

The warp destination is always the center of the target node.

Optionally, after the target node name you can specify whether you will be facing left (l) or right (r) upon map load.

Local Warping on a single maps, using WARPLOCALNODE nodes

This is used for houses or entrances to small caves, where the warp target lies on the same map.

To warp into a cave (place a node called 1in next to the out-warp inside of the cave:

warplocalnode 1in in

To wrap out of the cave, same thing in reverse (place a node called 1out near the entrance warp:

warplocalnode 1out out

A picture explains this much better:

Local warps explanation

Here, 1in and 1out are (arbitrarily chosen) names of warp target nodes, and the last parameter (in/out) specifies whether the warp goes inside a cave or back out into the open world.

While inside a local cave, the game enters a special mode where your world map position does not change, you'll still be displayed as if you were at the entrance location of the cave. This is because local caves are typically omitted from the world map, and it makes sense to lock your apparent location this way.

If you don't need the distinction between inside and outside, use "out".

Warping via tube flowers

A tube flower

This warp type is a bit special. If you want any customized behavior in your mod you need to copy & modify the script file to your needs (see scripts/entities/sporechildflowerportal.lua).

The vanilla behavior can be summed up as follows:

  • If we're on a specially handled map (and those maps are built to have only one tube flower) then warp to whatever special target. Look at the code.
  • Otherwise try to find another tube flower on the same map, and warp to it.
    • This implies that you can only have two tube flowers per map to ensure a reliable two-way connection, as it's undefined which tube flower it finds first if there are more than two.

Lua functions for warping

If the above warp types are not sufficient, you can also initiate warping from scripts.


warpAvatar(mapname, x, y)

Warp to position (x, y) on map mapname.


warpNaijaToSceneNode(mapname, nodename, facing)

Warp to map mapname, node nodename, facing left or right (use "l" or "r" as parameter).


[Deprecated] warpNaijaToEntity(entityname, xoffs, yoffs)

Find an entity named entityname on the current map, fade out, put Naija where the entity is plus an optional offset, then fade back in. Nothing happens if the entity isn't found.


loadMap(mapname, nodename)

Disable input, then warp to map mapname, node nodename. Very similar to warpNaijaToSceneNode() except you can't set the facing direction.


[OSE only] setCanWarp(bool)

If false, warp/warpnode/warplocalnode nodes are ignored.