Salve Rapeize, esses dias tava mexendo no meu npc dialog e tava tentando por pra quando abrir aparecer a outfit que o NPC esta usando, porem deu failed.... alguem ae tem algum jeito pra me ajudar???
Script do Modulo
Spoiler
local npcDialogWindow = nil
function init()
connect(g_game, { onGameEnd = onGameEnd })
npcDialogWindow = g_ui.displayUI('npcDialog')
npcDialogWindow:hide()
ProtocolGame.registerExtendedOpcode(80, NpcDialog)
end
function terminate()
disconnect(g_game, { onGameEnd = onGameEnd })
npcDialogWindow:destroy()
ProtocolGame.unregisterExtendedOpcode(80)
end
function onGameEnd()
if npcDialogWindow:isVisible() then
npcDialogWindow:hide()
end
end
function show()
npcDialogWindow:show()
npcDialogWindow:raise()
addEvent(function() g_effects.fadeIn(npcDialogWindow, 250) end)
end
function hide()
addEvent(function() g_effects.fadeOut(npcDialogWindow, 250) end)
scheduleEvent(function() npcDialogWindow:hide() end, 250)
end
function TchauDialog()
addEvent(function() g_effects.fadeOut(npcDialogWindow, 250) end)
scheduleEvent(function() npcDialogWindow:hide() end, 250)
scheduleEvent(g_game.talkChannel(11,0,"tchau"), 250)
end
local function clickOptionButton(option)
g_game.talkChannel(11,0,option)
end
function NpcDialog(protocol, opcode, buffer, creature)
local param = buffer:split('@')
show()
local image = "/modules/game_npcdialog/npcs/"..param[1]..".png"
npcDialogWindow:getChildById('imgPokemon'):setImageSource(image)
npcDialogWindow:getChildById('labelNpcName'):setText(param[1])
npcDialogWindow:getChildById('labelTalk'):setText(param[2])
npcDialogWindow:getChildById('optionButtonOne'):setVisible(false)
npcDialogWindow:getChildById('optionButtonTwo'):setVisible(false)
npcDialogWindow:getChildById('optionButtonThree'):setVisible(false)
if (param[3] ~= nil) then
local options = param[3]:split('&')
if (options[1]) then
local image = "/modules/game_npcdialog/npcs/"..param[1]..".png"
npcDialogWindow:getChildById('imgPokemon'):setImageSource(image)
npcDialogWindow:getChildById('optionButtonOne'):setVisible(true)
npcDialogWindow:getChildById('optionButtonOne'):setText(options[1])
npcDialogWindow:getChildById('optionButtonOne').onClick = function() clickOptionButton(options[1]) end
end
if (options[2]) then
local image = "/modules/game_npcdialog/npcs/"..param[1]..".png"
npcDialogWindow:getChildById('imgPokemon'):setImageSource(image)
npcDialogWindow:getChildById('optionButtonTwo'):setVisible(true)
npcDialogWindow:getChildById('optionButtonTwo'):setText(options[2])
npcDialogWindow:getChildById('optionButtonTwo').onClick = function() clickOptionButton(options[2]) end
end
if (options[3]) then
local image = "/modules/game_npcdialog/npcs/"..param[1]..".png"
npcDialogWindow:getChildById('imgPokemon'):setImageSource(image)
npcDialogWindow:getChildById('optionButtonThree'):setVisible(true)
npcDialogWindow:getChildById('optionButtonThree'):setText(options[3])
npcDialogWindow:getChildById('optionButtonThree').onClick = function() clickOptionButton(options[3]) end
end
end
end
Pergunta
Marshmello 270
Salve Rapeize, esses dias tava mexendo no meu npc dialog e tava tentando por pra quando abrir aparecer a outfit que o NPC esta usando, porem deu failed.... alguem ae tem algum jeito pra me ajudar???
Script do Modulo
local npcDialogWindow = nil
function init()
connect(g_game, { onGameEnd = onGameEnd })
npcDialogWindow = g_ui.displayUI('npcDialog')
npcDialogWindow:hide()
ProtocolGame.registerExtendedOpcode(80, NpcDialog)
end
function terminate()
disconnect(g_game, { onGameEnd = onGameEnd })
npcDialogWindow:destroy()
ProtocolGame.unregisterExtendedOpcode(80)
end
function onGameEnd()
if npcDialogWindow:isVisible() then
npcDialogWindow:hide()
end
end
function show()
npcDialogWindow:show()
npcDialogWindow:raise()
addEvent(function() g_effects.fadeIn(npcDialogWindow, 250) end)
end
function hide()
addEvent(function() g_effects.fadeOut(npcDialogWindow, 250) end)
scheduleEvent(function() npcDialogWindow:hide() end, 250)
end
function TchauDialog()
addEvent(function() g_effects.fadeOut(npcDialogWindow, 250) end)
scheduleEvent(function() npcDialogWindow:hide() end, 250)
scheduleEvent(g_game.talkChannel(11,0,"tchau"), 250)
end
local function clickOptionButton(option)
g_game.talkChannel(11,0,option)
end
function NpcDialog(protocol, opcode, buffer, creature)
local param = buffer:split('@')
show()
local image = "/modules/game_npcdialog/npcs/"..param[1]..".png"
npcDialogWindow:getChildById('imgPokemon'):setImageSource(image)
npcDialogWindow:getChildById('labelNpcName'):setText(param[1])
npcDialogWindow:getChildById('labelTalk'):setText(param[2])
npcDialogWindow:getChildById('optionButtonOne'):setVisible(false)
npcDialogWindow:getChildById('optionButtonTwo'):setVisible(false)
npcDialogWindow:getChildById('optionButtonThree'):setVisible(false)
if (param[3] ~= nil) then
local options = param[3]:split('&')
if (options[1]) then
local image = "/modules/game_npcdialog/npcs/"..param[1]..".png"
npcDialogWindow:getChildById('imgPokemon'):setImageSource(image)
npcDialogWindow:getChildById('optionButtonOne'):setVisible(true)
npcDialogWindow:getChildById('optionButtonOne'):setText(options[1])
npcDialogWindow:getChildById('optionButtonOne').onClick = function() clickOptionButton(options[1]) end
end
if (options[2]) then
local image = "/modules/game_npcdialog/npcs/"..param[1]..".png"
npcDialogWindow:getChildById('imgPokemon'):setImageSource(image)
npcDialogWindow:getChildById('optionButtonTwo'):setVisible(true)
npcDialogWindow:getChildById('optionButtonTwo'):setText(options[2])
npcDialogWindow:getChildById('optionButtonTwo').onClick = function() clickOptionButton(options[2]) end
end
if (options[3]) then
local image = "/modules/game_npcdialog/npcs/"..param[1]..".png"
npcDialogWindow:getChildById('imgPokemon'):setImageSource(image)
npcDialogWindow:getChildById('optionButtonThree'):setVisible(true)
npcDialogWindow:getChildById('optionButtonThree'):setText(options[3])
npcDialogWindow:getChildById('optionButtonThree').onClick = function() clickOptionButton(options[3]) end
end
end
end
Link para o comentário
Compartilhar em outros sites
9 respostass a esta questão
Posts Recomendados