Page 1 of 1

Make spawn coordinates always the same?

PostPosted: Fri May 31, 2013 00:54
by cypher-neo
Here's the issue: Everytime i play, I eventually get the Update Listener: Invalid Value bug.
The only way to play then is to close and reopen the game and teleport back to the map. I like 0, 0, 0 because it's easy to remember.

The problem is: whenever I start a new game, I spawn into the new map randomly.
Is there a way to set the spawn location to 0, (surface), 0 so that I don't have to teleport to 0, 0, 0 at the beginning of every game?

PostPosted: Fri May 31, 2013 02:16
by tinoesroho
Yeah. I think there's a static_spawn setting in minetest.conf you can set- see minetest.conf.example. The alternative is this thread's tweak to /builtin/chatcommands.lua. Take your pick- and remember to open lua files with Wordpad!

PostPosted: Fri May 31, 2013 16:45
by cypher-neo
tinoesroho wrote:Yeah. I think there's a static_spawn setting in minetest.conf you can set- see minetest.conf.example. The alternative is this thread's tweak to /builtin/chatcommands.lua. Take your pick- and remember to open lua files with Wordpad!


I found a static_spawn.lua in /usr/share/minetest/builtin but there doesn't seem to be an option to enable it in the game. All that minetest.conf seems to have is the settings already available in the game.

PostPosted: Fri May 31, 2013 17:44
by Evergreen
Create a folder called worldmods inside the world you want to set spawn, then create a folder called "spawn" inside the worldmods folder. Go into the folder you just created, and make a file called "init.lua" and put this code in the file. Code:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_on_respawnplayer(function(player)
    player:setpos({x=0.0, y=(surface coordinate), z=0.0})
    return true
end)

Hope it helped.

PostPosted: Sun Jun 02, 2013 02:14
by BrunoMine
Okay but now I want the player to appear in coordinated when you start the game in such a world.
How would that be?

PostPosted: Sun Jun 02, 2013 04:10
by tinoesroho
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_on_respawnplayer(function(player)
    player:setpos({x=0.0, y=(surface coordinate), z=0.0})
    return true
end)

minetest.register_on_newplayer(function(player)
    player:setpos({x=0.0, y=(surface coordinate), z=0.0})
    return true
end)