[Question]How to make this?

User avatar
MineYoshi
Member
 
Posts: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

[Question]How to make this?

by MineYoshi » Mon Oct 12, 2015 18:47

How to make when you touch or make an action with a tool, the tool sounds?
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 

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

Re: [Question]How to make this?

by Don » Tue Oct 13, 2015 11:05

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: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

Re: [Question]How to make this?

by MineYoshi » Wed Oct 14, 2015 13:27

explain me ,please.
i Don't understand that wiki article!
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 

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

Re: [Question]How to make this?

by Don » Wed Oct 14, 2015 14:04

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

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
   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
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: [Question]How to make this?

by kaeza » Thu Oct 15, 2015 06:51

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 | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

User avatar
MineYoshi
Member
 
Posts: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

Re: [Question]How to make this?

by MineYoshi » Mon Oct 19, 2015 13:46

Thanks kaeza ! that was i wanted to say

EDIT: i am making a "Headphones Mod" and that was what i need THANKS!
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

cron