Author Topic: Feature Request : Change the attack sound  (Read 50 times)

Lucifer

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Mon site
Feature Request : Change the attack sound
« on: May 23, 2018, 07:59:24 pm »
Hi everyone !
I've got a question : how can I change the attack sound in Solarus ? If in my sword.lua item, I change :
Code: Lua
  1. function item:on_using()
  2. sol.audio.play_sound("some ogg sound")
  3. end
I get this :
Error: Cannot find sound file 'sounds/sword1.ogg'
How can I fix this, please ?

Diarandor

  • Hero Member
  • *****
  • Posts: 956
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: Feature Request : Change the attack sound
« Reply #1 on: May 23, 2018, 09:26:13 pm »
By default the engine plays the sound sword.ogg (or maybe swordX.ogg with X your current sword level, but I don't remember it now). If you want a different sound, just replace that file. If you want randomized sounds, there is only 1 unclean solution: replace sword.ogg by a silent sound and then call your random sounds from item:on_using().

EDIT: you need to add the file requested by that error.
« Last Edit: May 23, 2018, 09:28:50 pm by Diarandor »
“If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you.”

Lucifer

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Mon site
Re: Feature Request : Change the attack sound
« Reply #2 on: May 24, 2018, 12:57:10 pm »
Thank you !