Ir para conteúdo

Featured Replies

Postado

Bom, em meu servidor base cyan há 2 NPC's que trocam Pokémon +50 por um outro melhor +0 (Ex: Shiny Electabuzz+50 por Shiny Electivire+0).

Feito isso eu clonei os script dele e tentei criar um que fizesse a mesma função, fui no RME coloquei ele no mapa, porém ele não aparece e também não aparece quando é criado pelo comando /n.

Obs: Queria que o NPC trocasse uma Shiny Tangela +50 por um Shiny Tangrowth +0.

 

Segue abaixo sua configuração simples:
 

Spoiler

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Naturi Trainer" script="Trocatan.lua" walkinterval="0" floorchange="0" access="5" level="1" maglevel="1">
<health now="150" max="150"/>
<look type="1434" head="114" body="119" legs="114" feet="114" corpse="2212"/>
<parameters>
<parameter key="message_greet" value="Welcome |PLAYERNAME|, you want to Transform you poke in {shiny}?"/>
</parameters>
</npc>

 

 

Segue abaixo o script:

Spoiler

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if (msgcontains(msg, 'Shiny') or msgcontains(msg, 'shiny')) then --alterado v1.7
selfSay("Voce quer tranformar seu Shiny Tangela em Shiny Tangrowth? Voce precisa do Shiny Tangela+50 + 5kk!", cid)
talkState[talkUser] = 1
elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'Yes')) and talkState[talkUser] == 1 then
if getPlayerSlotItem(cid, 8).uid <= 0 then
selfSay("Desculpe, voce nao esta com o pokemon na slot!", cid)
talkState[talkUser] = 0
return true
end 
--alterado v1.2
if #getCreatureSummons(cid) >= 1 then
selfSay("Puxe seu pokemon para pokebola!", cid)
talkState[talkUser] = 0
return true
end
local pb = getPlayerSlotItem(cid, 8).uid
if getItemAttribute(pb, "poke") ~= "Shiny Tangela" then
selfSay("Coloque seu Shiny Tangela+50 na slot, por favor!", cid)
talkState[talkUser] = 0
return true
end
if not getItemAttribute(pb, "boost") or getItemAttribute(pb, "boost") < 50 then
selfSay("Desculpe, seu Shiny Tangela não esta boosted +50!", cid)
talkState[talkUser] = 0
return true
end
                                          --100000 = 1k, 1000000 = 10k, 10000000 = 100k
           if doPlayerRemoveMoney(cid, 500000000) == true then
              selfSay("So there is it! Enjoy!", cid)
              doItemSetAttribute(pb, "hp", 1)
              doItemSetAttribute(pb, "poke", "Shiny Tangrowth")
        doItemSetAttribute(pb, "description", "Contains a Shiny Tangrowth.")
        doItemEraseAttribute(pb, "boost")
        doTransformItem(getPlayerSlotItem(cid, 7).uid, fotos["Shiny Tangrowth"])
  doItemSetAttribute(pb, "Icone", "yes") 
  doTransformItem(pb, icons[getItemAttribute(pb, "poke")].on)
        if useKpdoDlls then
          doCreatureExecuteTalkAction(cid, "/pokeread")
           end
        talkState[talkUser] = 0
        return true
       else
           selfSay("Você nao tem dinheiro suficiente!", cid)
           talkState[talkUser] = 0
           return true
          end
        end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

~ Se ajudei +Rep

sheele_schere__akame_ga_kill__minimalist

~ Sheele

  • Respostas 6
  • Visualizações 266
  • Created
  • Última resposta

Top Posters In This Topic

Postado

vou fazer um aqui, calma

 

Eu não testei, mas acho que dará certo.

Citar

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end

function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end

function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end

function onThink() npcHandler:onThink() end

function creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then

return false

end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

    
        if msgcontains(msg, 'shiny') or msgcontains(msg, 'Shiny') thenelse
        else
              selfSay(""Voce quer tranformar seu Shiny Tangela em Shiny Tangrowth? Voce precisa de Shiny Tangela+50  + 5kk!", cid)

              talkState[talkUser] = 4
        elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'Yes')) and talkState[talkUser] == 4 then

           if getPlayerSlotItem(cid, 8).uid <= 0 then

              selfSay("Sorry, you don't have a pokemon in the main slot!", cid)

              talkState[talkUser] = 0

        return true

        end

                                                                              --alterado v1.2

        if #getCreatureSummons(cid) >= 1 then

           selfSay("Go back your pokemon!", cid)

              talkState[talkUser] = 0

              return true

           end


        local pb = getPlayerSlotItem(cid, 8).uid


        if getItemAttribute(pb, "poke") ~= "Shiny Tangela" then

           selfSay("Put a Shiny Tangela's pokeball atleast +50 in main slot!", cid)

              talkState[talkUser] = 0

              return true

           end


           if not getItemAttribute(pb, "boost") or getItemAttribute(pb, "boost") < 50 then

              selfSay("Sorry, your Shiny Tangela is not boosted +50!", cid)

              talkState[talkUser] = 0

              return true

           end

                                          --100000 = 1k, 1000000 = 10k, 10000000 = 100k

           if doPlayerRemoveMoney(cid, 500000000) == true then

              selfSay("So there is it! Enjoy!", cid)

              doItemSetAttribute(pb, "hp", 1)

              doItemSetAttribute(pb, "poke", "Shiny Tangrowth")

        doItemSetAttribute(pb, "description", "Contains a Shiny Tangrowth.")

        doItemEraseAttribute(pb, "boost")

        doTransformItem(getPlayerSlotItem(cid, 7).uid, fotos["Shiny Tangrowth"])

        if useKpdoDlls then

          doCreatureExecuteTalkAction(cid, "/pokeread")

           end

        talkState[talkUser] = 0

        return true

       else

           selfSay("You don't have enough money!", cid)

           talkState[talkUser] = 0

           return true

          end

        end

return true

end

 

Postado
  • Autor

@lkrazy farei um teste e assim que possível, lhe aviso! Obg pela atenção.

Testei ... porém mesmo erro na distro :s

[02/08/2016 22:51:20] [Error - LuaScriptInterface::loadFile] data/npc/scripts/Trocatan.lua:1: unexpected symbol near 'ï'
[02/08/2016 22:51:20] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/Trocatan.lua
[02/08/2016 22:51:20] data/npc/scripts/Trocatan.lua:1: unexpected symbol near 'ï'

Com isso ele não aparece no jogo :c

 

~ Se ajudei +Rep

sheele_schere__akame_ga_kill__minimalist

~ Sheele

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo