Make spawn coordinates always the same?

cypher-neo
Member
 
Posts: 46
Joined: Wed Oct 17, 2012 12:15

Make spawn coordinates always the same?

by cypher-neo » Fri May 31, 2013 00:54

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?
 

tinoesroho
Member
 
Posts: 570
Joined: Fri Feb 17, 2012 21:55

by tinoesroho » Fri May 31, 2013 02:16

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!
We are what we create.

I tinker and occasionally make (lousy) mods. Currently building an MMO subgame and updating mods. Pirate Party of Canada member. Sporadic author. 21 years old.

My github:
https://github.com/tinoesroho/
 

cypher-neo
Member
 
Posts: 46
Joined: Wed Oct 17, 2012 12:15

by cypher-neo » Fri May 31, 2013 16:45

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.
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Fri May 31, 2013 17:44

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.
Last edited by Evergreen on Fri May 31, 2013 17:45, edited 1 time in total.
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

User avatar
BrunoMine
Member
 
Posts: 902
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine

by BrunoMine » Sun Jun 02, 2013 02:14

Okay but now I want the player to appear in coordinated when you start the game in such a world.
How would that be?
My small square universe under construction ... Minemacro
Comunidade Minetest Brasil
www.minetestbrasil.com
 

tinoesroho
Member
 
Posts: 570
Joined: Fri Feb 17, 2012 21:55

by tinoesroho » Sun Jun 02, 2013 04:10

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)
Last edited by tinoesroho on Sun Jun 02, 2013 04:11, edited 1 time in total.
We are what we create.

I tinker and occasionally make (lousy) mods. Currently building an MMO subgame and updating mods. Pirate Party of Canada member. Sporadic author. 21 years old.

My github:
https://github.com/tinoesroho/
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 8 guests

cron