- 0
Duvida sons ot cliente
-
Quem Está Navegando 0 membros estão online
- Nenhum usuário registrado visualizando esta página.
-
Conteúdo Similar
-
script alguém pode me ajudar nessa spells aqui, queira que colocassem pro meu personagem ficar inatingível por 6 segundos e podendo atacar livremente
Por lazaroszz,
- 0 respostas
- 620 visualizações
-
- 2 respostas
- 2568 visualizações
-
- 2 respostas
- 1325 visualizações
-
- 1 resposta
- 1291 visualizações
-
- 1 resposta
- 1375 visualizações
-
Pergunta
matheuspeixoto12 4
Ola possuo 1 script de ot cliente que altera os sons adicionados no game de acordo com coordenadas, mas eu queria coloca de acordo com item id, alguem me ajuda a editar? obrigado.
script -
SOUNDS_CONFIG = {
soundChannel = SoundChannels.Music,
checkInterval = 500,
folder = 'music/',
noSound = 'No sound file for this area.',
}
SOUNDS = {
-- Lavender town
{fromPos = {x=1191, y=1039, z=7}, toPos = {x=1244, y=1079, z=7}, sound = "lavender.ogg"},
-- Cerulean
{fromPos = {x=603, y=493, z=7}, toPos = {x=702, y=584, z=7}, priority = 2, sound="cidade 1.ogg"},
{fromPos = {x=1051, y=909, z=7}, toPos = {x=1097, y=945, z=7}, priority = 2, sound="cidade 1.ogg"},
{fromPos = {x=1068, y=890, z=7}, toPos = {x=1102, y=933, z=7}, priority = 2, sound="cidade 1.ogg"},
{fromPos = {x=1019, y=882, z=7}, toPos = {x=1085, y=897, z=7}, priority = 2, sound="cidade 1.ogg"},
-- Saffron
{fromPos = {x=1057, y=1016, z=7}, toPos = {x=1110, y=1028, z=7}, priority = 2, sound="cidade 2.ogg"},
{fromPos = {x=1086, y=1009, z=7}, toPos = {x=1110, y=1024, z=7}, priority = 2, sound="cidade 2.ogg"},
{fromPos = {x=1010, y=1030, z=7}, toPos = {x=1110, y=1040, z=7}, priority = 2, sound="cidade 2.ogg"},
{fromPos = {x=1034, y=1025, z=7}, toPos = {x=1065, y=1035, z=7}, priority = 2, sound="cidade 2.ogg"},
{fromPos = {x=1006, y=1037, z=7}, toPos = {x=1049, y=1077, z=7}, priority = 2, sound="cidade 2.ogg"},
{fromPos = {x=1000, y=1057, z=7}, toPos = {x=1049, y=1077, z=7}, priority = 2, sound="cidade 2.ogg"},
{fromPos = {x=1049, y=1055, z=7}, toPos = {x=1091, y=1078, z=7}, priority = 2, sound="cidade 2.ogg"},
{fromPos = {x=1007, y=1076, z=7}, toPos = {x=1080, y=1086, z=7}, priority = 2, sound="cidade 2.ogg"},
{fromPos = {x=1018, y=1085, z=7}, toPos = {x=1076, y=1092, z=7}, priority = 2, sound="cidade 2.ogg"},
{fromPos = {x=1023, y=1090, z=7}, toPos = {x=1076, y=1095, z=7}, priority = 2, sound="cidade 2.ogg"},
{fromPos = {x=1030, y=1094, z=7}, toPos = {x=1076, y=1099, z=7}, priority = 2, sound="cidade 2.ogg"},
{fromPos = {x=1043, y=1097, z=7}, toPos = {x=1076, y=1109, z=7}, priority = 2, sound="cidade 2.ogg"},
{fromPos = {x=1057, y=1042, z=7}, toPos = {x=1111, y=1056, z=7}, priority = 2, sound="cidade 2.ogg"},
{fromPos = {x=1056, y=1051, z=7}, toPos = {x=1059, y=1054, z=7}, priority = 2, sound="cidade 2.ogg"},
-- Pvp
{fromPos = {x=955, y=1053, z=13}, toPos = {x=996, y=1091, z=13}, priority = 1, sound="pvp.ogg"},
{fromPos = {x=1001, y=917, z=9}, toPos = {x=1002, y=919, z=9}, priority = 1, sound="FF VII - Main.ogg"},
-- Batalha pvp
{fromPos = {x=958, y=983, z=13}, toPos = {x=1008, y=1038, z=13}, priority = 1, sound="batalha.ogg"},
-- Arena de duelos
{fromPos = {x=572, y=1091, z=7}, toPos = {x=585, y=1102, z=7}, priority = 1, sound="batalha.ogg"},
{fromPos = {x=572, y=1080, z=7}, toPos = {x=592, y=1091, z=7}, priority = 1, sound="cp.ogg"},
{fromPos = {x=586, y=1091, z=7}, toPos = {x=592, y=1102, z=7}, priority = 1, sound="cp.ogg"},
-- Main
-- Cp
-- Cerulean
{fromPos = {x=1049, y=1042, z=7}, toPos = {x=1055, y=1054, z=7}, priority = 1, sound="cp.ogg"},
{fromPos = {x=1049, y=1042, z=6}, toPos = {x=1055, y=1054, z=6}, priority = 1, sound="cp.ogg"},
{fromPos = {x=1049, y=1042, z=5}, toPos = {x=1055, y=1054, z=5}, priority = 1, sound="cp.ogg"},
{fromPos = {x=1049, y=1042, z=4}, toPos = {x=1055, y=1054, z=4}, priority = 1, sound="cp.ogg"},
{fromPos = {x=1054, y=1042, z=7}, toPos = {x=1062, y=1050, z=7}, priority = 1, sound="cp.ogg"},
{fromPos = {x=1054, y=1042, z=6}, toPos = {x=1062, y=1050, z=6}, priority = 1, sound="cp.ogg"},
{fromPos = {x=1054, y=1042, z=5}, toPos = {x=1062, y=1050, z=5}, priority = 1, sound="cp.ogg"},
{fromPos = {x=1054, y=1042, z=4}, toPos = {x=1062, y=1050, z=4}, priority = 1, sound="cp.ogg"},
{fromPos = {x=1054, y=898, z=7}, toPos = {x=1067, y=908, z=7}, priority = 1, sound="cp.ogg"},
-- Saffron
{fromPos = {x=1050, y=1043, z=7}, toPos = {x=1055, y=1054, z=7}, priority = 1, sound="cp.ogg"},
{fromPos = {x=1054, y=1043, z=7}, toPos = {x=1056, y=1050, z=7}, priority = 1, sound="cp.ogg"},
{fromPos = {x=1050, y=1043, z=6}, toPos = {x=1055, y=1054, z=6}, priority = 1, sound="cp.ogg"},
{fromPos = {x=1053, y=1043, z=6}, toPos = {x=1056, y=1050, z=6}, priority = 1, sound="cp.ogg"},
{fromPos = {x=1055, y=1044, z=6}, toPos = {x=1062, y=1050, z=6}, priority = 1, sound="cp.ogg"},
{fromPos = {x=1050, y=1043, z=5}, toPos = {x=1055, y=1054, z=5}, priority = 1, sound="cp.ogg"},
{fromPos = {x=1053, y=1043, z=5}, toPos = {x=1056, y=1050, z=5}, priority = 1, sound="cp.ogg"},
{fromPos = {x=1055, y=1044, z=5}, toPos = {x=1062, y=1050, z=5}, priority = 1, sound="cp.ogg"},
{fromPos = {x=1051, y=1045, z=4}, toPos = {x=1060, y=1051, z=4}, priority = 1, sound="cp.ogg"},
{fromPos = {x=1096, y=1088, z=5}, toPos = {x=1110, y=1100, z=6}, priority = 1, sound="Fairy Tail - Main.ogg"},
} ----------
-- Sound
local rcSoundChannel
local showPosEvent
local playingSound
-- Design
soundWindow = nil
soundButton = nil
function toggle()
if soundButton:isOn() then
soundWindow:close()
soundButton:setOn(false)
else
soundWindow:open()
soundButton:setOn(true)
end
end
function onMiniWindowClose()
soundButton:setOn(false)
end
function init()
for i = 1, #SOUNDS do
SOUNDS.sound = SOUNDS_CONFIG.folder .. SOUNDS.sound
end
connect(g_game, { onGameStart = onGameStart,
onGameEnd = onGameEnd })
rcSoundChannel = g_sounds.getChannel(SOUNDS_CONFIG.soundChannel)
-- rcSoundChannel:setGain(value/COUNDS_CONFIG.volume)
soundButton = modules.client_topmenu.addRightGameToggleButton('soundButton', tr('Sound Info') .. '', '/images/audio', toggle)
soundButton:setOn(true)
soundWindow = g_ui.loadUI('rcsound', modules.game_interface.getRightPanel())
soundWindow:disableResize()
soundWindow:setup()
if(g_game.isOnline()) then
onGameStart()
end
end
function terminate()
disconnect(g_game, { onGameStart = onGameStart,
onGameEnd = onGameEnd })
onGameEnd()
soundWindow:destroy()
soundButton:destroy()
end
function onGameStart()
stopSound()
toggleSoundEvent = addEvent(toggleSound, SOUNDS_CONFIG.checkInterval)
end
function onGameEnd()
stopSound()
removeEvent(toggleSoundEvent)
end
function isInPos(pos, fromPos, toPos)
return
pos.x>=fromPos.x and
pos.y>=fromPos.y and
pos.z>=fromPos.z and
pos.x<=toPos.x and
pos.y<=toPos.y and
pos.z<=toPos.z
end
function toggleSound()
local player = g_game.getLocalPlayer()
if not player then return end
local pos = player:getPosition()
local toPlay = nil
for i = 1, #SOUNDS do
if(isInPos(pos, SOUNDS.fromPos, SOUNDS.toPos)) then
if(toPlay) then
toPlay.priority = toPlay.priority or 0
if((toPlay.sound~=SOUNDS.sound) and (SOUNDS.priority>toPlay.priority)) then
toPlay = SOUNDS
end
else
toPlay = SOUNDS
end
end
end
playingSound = playingSound or {sound='', priority=0}
if(toPlay~=nil and playingSound.sound~=toPlay.sound) then
g_logger.info("RC Sounds: New sound area detected:")
g_logger.info(" Position: {x=" .. pos.x .. ", y=" .. pos.y .. ", z=" .. pos.z .. "}")
g_logger.info(" Music: " .. toPlay.sound)
stopSound()
playSound(toPlay.sound)
playingSound = toPlay
elseif(toPlay==nil) and (playingSound.sound~='') then
g_logger.info("RC Sounds: New sound area detected:")
g_logger.info(" Left music area.")
stopSound()
end
toggleSoundEvent = scheduleEvent(toggleSound, SOUNDS_CONFIG.checkInterval)
end
function playSound(sound)
rcSoundChannel:enqueue(sound, 0)
setLabel(clearName(sound))
end
function clearName(soundName)
local explode = string.explode(soundName, "/")
soundName = explode[#explode]
explode = string.explode(soundName, ".ogg")
soundName = ''
for i = 1, #explode-1 do
soundName = soundName .. explode
end
return soundName
end
function stopSound()
setLabel(SOUNDS_CONFIG.noSound)
rcSoundChannel:stop()
playingSound = nil
end
function setLabel(str)
soundWindow:recursiveGetChildById('currentSound'):getChildById('value'):setText(str)
end
Link para o comentário
Compartilhar em outros sites
1 resposta a esta questão
Posts Recomendados