Story screen or note for player on game creation
Story screen or note for player on game creation
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.
-
- Member
- Posts: 4290
- Joined: Sun Sep 09, 2012 17:31
- GitHub: Sokomine
- IRC: Sokomine
- In-game: Sokomine
Re: Story screen or note for player on game creation
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.
- 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
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:
- Some other way that might add more control, such as the wiki blocks Sokomine suggested
- 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)
A spoon is basically a tiny bowl with a stick on it
- 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
Use local newmeta instead for not polluting the global namespace.
Who is online
Users browsing this forum: Ahrefs [Bot] and 25 guests