[Question]How to make this?

Post Reply
User avatar
MineYoshi
Member
Posts: 5373
Joined: Wed Jul 08, 2015 13:20
Contact:

[Question]How to make this?

by MineYoshi » Post

How to make when you touch or make an action with a tool, the tool sounds?
Oi

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [Question]How to make this?

by Don » Post

MineYoshi wrote:How to make when you touch or make an action with a tool, the tool sounds?
http://dev.minetest.net/minetest.sound_play
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
MineYoshi
Member
Posts: 5373
Joined: Wed Jul 08, 2015 13:20
Contact:

Re: [Question]How to make this?

by MineYoshi » Post

explain me ,please.
i Don't understand that wiki article!
Oi

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [Question]How to make this?

by Don » Post

For example if you wanted to make a sound when you destroy a block then add this to your node definition

Code: Select all

	on_destruct = function(pos)
		minetest.sound_play("your_sound_file", {
			pos = pos,
			max_hear_distance = 100,
			gain = 10.0,
		})
	end,
In your mod folder make a folder called sounds. Put you sound file in there. It has to be an ogg file.
In your code put the name of the sound file where I wrote "your_sound_file". Do not put .ogg.
If your file is called mineyoshi.ogg then you would write "mineyoshi".
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: [Question]How to make this?

by kaeza » Post

I think he means when you use a tool (i.e. by clicking [not necessarily a node] while the tool is in hand).

If that's the case, you should define an `on_use` callback for the tool itself, and call `sound_play` from there..
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
MineYoshi
Member
Posts: 5373
Joined: Wed Jul 08, 2015 13:20
Contact:

Re: [Question]How to make this?

by MineYoshi » Post

Thanks kaeza ! that was i wanted to say

EDIT: i am making a "Headphones Mod" and that was what i need THANKS!
Oi

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest