User Tools

Site Tools


script:world_event:playsoundeffectonpos

playSoundEffectOnPos

  • Parameters and types:
    • pos: tableposition
    • soundId: numbersound effect ID
    • volume: numbervolume adjustment
  • Pitch: numberPitch adjustment
    • isLoop: boolWhether to play in a loop
  • Return value and type:
    • code: numberSuccess (ErrorCode.OK) ErrorCode
  • The main function of this method is to play the specified sound effect at the specified position.
  • The specific use cases are as follows:
--Play music 10713 at the position of height 7 (0,0)
--The first parameter is a table composed of the coordinates of the music being played
--The second parameter 10713 is the sound effect id played, which can be viewed in the "Sound Effect Table Data" of "Mini World ID Query"
--The last three parameters are: volume, pitch, whether to play in a loop
World:playSoundEffectOnPos({x=0,y=7,z=0},10713,100,1,false)
--Display in the chat box
Chat:sendSystemMsg("Music is playing at the position of height 7 (0,0)")
script/world_event/playsoundeffectonpos.txt · Last modified: 2024/06/10 14:21 by don