Hello
I am trying to make a mod and I want a node to play a sound when it breaks. the problem is i get a error when I load the world.
here is the node I want to play a sound
minetest.register_node("aluminum:block", {
description = "aluminum block",
tiles = {"aluminum.png"},
groups = {cracky = 3, stone = 1},
drop = 'aluminum:block',
legacy_mineral = true,
sounds = minetest_InsigniaKey.ogg(),
})
2021-05-08 23:08:54: WARNING[Main]: Undeclared global variable "minetest_InsigniaKey" accessed at ...64\minetest-0.4.17.1-win64\bin\..\mods\aluminum\init.lua:237
2021-05-08 23:08:54: ERROR[Main]: ModError: Failed to load and run script from C:\Users\*****\Desktop\minetest-0.4.17.1win64\minetest-0.4.17.1-win64\bin\..\mods\aluminum\init.lua:
2021-05-08 23:08:54: ERROR[Main]: ...64\minetest-0.4.17.1-win64\bin\..\mods\aluminum\init.lua:237: attempt to index global 'minetest_InsigniaKey' (a nil value)
please don't tell me to update the game
thanks
Modding help
-
- Member
- Posts: 59
- Joined: Fri Mar 30, 2018 06:18
- GitHub: MrOverCast
- IRC: MrOverCast
- In-game: MrOverCast
- Nathan.S
- Member
- Posts: 1147
- Joined: Wed Sep 24, 2014 17:47
- GitHub: NathanSalapat
- IRC: NathanS21
- In-game: NathanS21
- Location: Bigsby Texas
- Contact:
Re: Modding help
from the api
so you should be doing something like
Code: Select all
sounds = {
-- Definition of node sounds to be played at various events.
-- All fields in this table are optional.
footstep = <SimpleSoundSpec>,
-- If walkable, played when object walks on it. If node is
-- climbable or a liquid, played when object moves through it
dig = <SimpleSoundSpec> or "__group",
-- While digging node.
-- If `"__group"`, then the sound will be
-- `default_dig_<groupname>`, where `<groupname>` is the
-- name of the tool's digging group with the fastest digging time.
-- In case of a tie, one of the sounds will be played (but we
-- cannot predict which one)
-- Default value: `"__group"`
dug = <SimpleSoundSpec>,
-- Node was dug
place = <SimpleSoundSpec>,
-- Node was placed. Also played after falling
place_failed = <SimpleSoundSpec>,
-- When node placement failed.
-- Note: This happens if the _built-in_ node placement failed.
-- This sound will still be played if the node is placed in the
-- `on_place` callback manually.
fall = <SimpleSoundSpec>,
-- When node starts to fall or is detached
},
Code: Select all
sounds = {
dug = dig_sound}
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course
Check out my website, and brand new Minetest Modding Course
Who is online
Users browsing this forum: Ahrefs [Bot] and 5 guests