Story screen or note for player on game creation

Post Reply
ak1r4l3
New member
Posts: 1
Joined: Sat Jul 07, 2018 00:52

Story screen or note for player on game creation

by ak1r4l3 » Post

Is there a way to pass a note to a player or show a startup screen with test? Maybe a book in inventory or something that would let me create a background story for a subgame? I've searched the forums and I'm not seeing it.

Sokomine
Member
Posts: 4287
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Story screen or note for player on game creation

by Sokomine » Post

Some servers show a formspec when joining. I think they do it via minetest.register_on_joinplayer. There'd still be the problem to tell further parts of the story later on. The wiki mod might be of some help here - provided it's ok for your game to place these wiki blocks wherever needed.
A list of my mods can be found here.

User avatar
ChimneySwift
Member
Posts: 320
Joined: Fri Sep 22, 2017 06:46
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift
Location: 127.0.0.1

Re: Story screen or note for player on game creation

by ChimneySwift » Post

Use minetest.register_on_joinplayer and either:
- Show a formspec and set a player attribute (/metadata) when they have read it (later ignore players with this formspec)
- Add a book to their inventory:

Code: Select all

-- Prepare metadata
newmeta = {}
newmeta.title = "Title"
newmeta.owner = "server"
newmeta.description = "\""..newmeta.title.."\" by server"
newmeta.text = "blah blah blah"
newmeta.text_len = #newmeta.text
newmeta.page = 1
newmeta.page_max = 1

-- Create the stack
local book = ItemStack("default:book")
book:get_meta():from_table({fields = newmeta})

-- Add the stack to the inventory
local inv = player:get_inventory()
inv:add_item("main", book)
- Some other way that might add more control, such as the wiki blocks Sokomine suggested
A spoon is basically a tiny bowl with a stick on it

User avatar
Linuxdirk
Member
Posts: 3219
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: Story screen or note for player on game creation

by Linuxdirk » Post

Use local newmeta instead for not polluting the global namespace.

Post Reply

Who is online

Users browsing this forum: freshreplicant and 14 guests