[Encerrado] (Pedido) Npc

BrunooMaciell
em Tópicos Sem Resposta

BrunooMaciell

Bruno Maciel
avatar
Infante
Infante

INFOS

Grupo: InfanteRegistrado: 27/08/11Posts: 1919Gênero: MasculinoChar no Tibia: Bruno Maciel

Estou aqui pra fazre um pedido relacionado a npc travel !!

 

NPC

 

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, 'ticket')) then
if getPlayerMoney(cid) >= 500 then
selfSay('You want to buy 1 travel ticket?, it cost 5 dollars', cid)
talkState[talkUser] = 1
else
selfSay('You don\'t have enough money, it cost 5 dollars.', cid)
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if doPlayerRemoveMoney(cid, 500) == TRUE then
setPlayerStorageValue(cid, 4592, 1)
selfSay('Here is your ticket, it can not be transfere, when you have used the ticket at the boat, it can not be used again, go to the boat to use it.', cid)
end
end
return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

Eu queria que o cara que for usa este npc ele tem que este com o pokemon dentro da ball !!

 

q quem for mi ajuda se possivelmente puter posta a linha pois tem +3 npcs assim dai eu ia adicionar nos outros 3 ^^

 

Curti++

Warby

It's my life
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 01/11/13Posts: 23Char no Tibia: No Have

Bruno Maciel,

Peguei uma pequena linha do Script da Bike no PDA do Slicer.

if #getCreatureSummons(cid) >= 1 then
return doPlayerSendCancel(cid, "Return your pokemon.")
end

Já que eu não entendo quase nada de Script, tente colocar isso no topo do comando, qualquer erro meu me corrija por favor.

@Edit

Não esqueça de fazer um Backup de seu arquivo!.

BrunooMaciell

Bruno Maciel
avatar
Infante
Infante

INFOS

Grupo: InfanteRegistrado: 27/08/11Posts: 1919Gênero: MasculinoChar no Tibia: Bruno Maciel

tipo esta tag pode ate funciona porem tem que sabe o lugar certo da script pra add pra nao da erro de linha !!

Warby

It's my life
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 01/11/13Posts: 23Char no Tibia: No Have

Bruno,

Pegue a script da Bike inteira e tente onde você acha. Como eu disse acima, sou novo em Scriptings.

local function BikeSpeedOn(cid, t)

setPlayerStorageValue(cid, t.s, t.speed)
doChangeSpeed(cid, -getCreatureSpeed(cid))
doChangeSpeed(cid, t.speed)
end
local function BikeSpeedOff(cid, t)
setPlayerStorageValue(cid, t.s, -1)
doRegainSpeed(cid)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = getThingPos(cid)
local t = {text='Mount, bike!', dtext='Demount, bike!', s=5700, speed = 500}
if #getCreatureSummons(cid) >= 1 then
return doPlayerSendCancel(cid, "Return your pokemon.")
end
if getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 or
getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 75846) >= 1 or
getPlayerStorageValue(cid, 6598754) >= 1 or getPlayerStorageValue(cid, 6598755) >= 1 then --alterado v2.9
return doPlayerSendCancel(cid, "You can't do that right now.")
end
if getPlayerStorageValue(cid, t.s) <= 0 then
doSendMagicEffect(pos, 177)
doCreatureSay(cid, t.text, 19)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You have mounted in a bike.')
BikeSpeedOn(cid, t)
if getPlayerSex(cid) == 1 then
doSetCreatureOutfit(cid, {lookType = 1394}, -1)
else
doSetCreatureOutfit(cid, {lookType = 1393}, -1)
end
else
doSendMagicEffect(pos, 177)
doCreatureSay(cid, t.dtext, 19)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You haven demouted of a bike.')
BikeSpeedOff(cid, t)
doRemoveCondition(cid, CONDITION_OUTFIT)
end
return true
end



Creio que seja no topo do comando.

zipter98

avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 20/09/12Posts: 2553Gênero: Masculino

Tenta assim:

 

 

 

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, 'ticket')) then
        if getPlayerMoney(cid) >= 500 then
            selfSay('You want to buy 1 travel ticket?, it cost 5 dollars', cid)
            talkState[talkUser] = 1
        else
            selfSay('You don\'t have enough money, it cost 5 dollars.', cid)
        end
    elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
        if #getCreatureSummons(cid) >= 1 then
            selfSay("Retorne seu pokémon para a pokeball, antes...")
            talkState[talkUser] = 1
            return true
        elseif doPlayerRemoveMoney(cid, 500) == TRUE then
            setPlayerStorageValue(cid, 4592, 1)
            selfSay('Here is your ticket, it can not be transfere, when you have used the ticket at the boat, it can not be used again, go to the boat to use it.', cid)
        end
    end
    return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Não respondo PMs solicitando suporte. Já existem seções no fórum para isto.

BrunooMaciell

Bruno Maciel
avatar
Infante
Infante

INFOS

Grupo: InfanteRegistrado: 27/08/11Posts: 1919Gênero: MasculinoChar no Tibia: Bruno Maciel

Vlw ^^

 

Curti++

zipter98

avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 20/09/12Posts: 2553Gênero: Masculino

Tópico movido para a seção de dúvidas e pedidos resolvidos.

Não respondo PMs solicitando suporte. Já existem seções no fórum para isto.

Stigal

don't ever stop...
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 28/11/10Posts: 3402Gênero: Masculino
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.

VI6MDIG.png

 

"O fracasso é a oportunidade de se começar de novo inteligentemente"

Minhas Redes Sociais: Youtube | Página & Grupo | Steam  | Discord Xtibia | Skype: @mrooger

 

OTpanel