Ajuda Com Script!

Nitrox
Por Nitrox
em Lixeira Pública

Nitrox

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 23/10/05Posts: 18Char no Tibia: Murruga

Ot 8.6<

Bom pessoal mexi em algumas coisas, juntei alguns script, e acabei fazendo um npc que dá xp por storage! bem como assim?

bom você faz uma quest e volta pra falar com o npc, assim, ele te da tando de xp, só que,

ele continua dando xp sempre, queria saber como faço pra ele só dar uma vez!

 

 

 

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

npcHandler:setMessage(MESSAGE_GREET, "Hello welcome to Global Server RPG, Make quest in 2 floor up of my House, and back to me saying Quest ")

function creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then

return false

end

 

local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid

-- Conversa Jogador/NPC

if(msgcontains(msg, 'Quest')) and getPlayerStorageValue(cid, 60994)>=1 then

doSendAnimatedText(getPlayerPosition(cid),"Exp", TEXTCOLOR_RED)

doPlayerAddExp(cid,100)

selfSay('Thanks, can continue your expedition!.',cid)

talkState[talkUser] = 1

else

selfSay('You dont maked quest!.',cid)

talkState[talkUser] = 1

end

return TRUE

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

Ta ai, desde já agradecido!

SkyDangerous

Deus Kalec
avatar
Lorde
Lorde

INFOS

Grupo: LordeRegistrado: 17/01/09Posts: 2098Char no Tibia: Adra Sata

Você precissa verificar a storage:

 

if getPlayerStorageValue(cid, storage)

 

E depois você precissa setar a storage:

 

setPlayerStorageValue(cid, storage)

 

-=

No script você fez certo, para ele verificar porém você não setou nemhuma storage, nunca funcionará

Me segui lá (:

 

b906.png

http://ageofwar.servegame.com/

IP: ageofwar.servegame.com

TIBIA: 10.78

GLOBAL PERFECT CUSTOM

Nitrox

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 23/10/05Posts: 18Char no Tibia: Murruga

@SkyDangerous

Poderia me mandar como ficaria o script,

e como eu faço pra adicionar outra dessa nesse mesmo npc,

só que usando a storage anterior pra pedir a próximo missão?

dou REP+

jhon992

Dono JhonBot
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 30/06/11Posts: 631Char no Tibia: Warrior of Mort

esse aqui vai funcionar:

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
npcHandler:setMessage(MESSAGE_GREET, "Hello welcome to Global Server RPG, Make quest in 2 floor up of my House, and back to me saying Quest ")
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
-- Conversa Jogador/NPC
if(msgcontains(msg, 'Quest')) and getPlayerStorageValue(cid, 60994)>=1 then
doSendAnimatedText(getPlayerPosition(cid),"Exp", TEXTCOLOR_RED)
doPlayerAddExp(cid,100)
setPlayerStorageValue(cid, 60994,0)  -- quando o jogador receber o xp o storage dele é zerado, ou seja quando ele falar com o npc novamente ñ ganhara mais esse xp
selfSay('Thanks, can continue your expedition!.',cid)
talkState[talkUser] = 1
else
selfSay('You dont maked quest!.',cid)
talkState[talkUser] = 1
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

se não éh isso que tu quer, explica melhor que a galera aqui te ajuda!

Fir3element

avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 16/06/08Posts: 998Gênero: Masculino
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
npcHandler:setMessage(MESSAGE_GREET, "Hello welcome to Global Server RPG, Make quest in 2 floor up of my House, and back to me saying Quest ")
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
-- Conversa Jogador/NPC
if getPlayerStorageValue(cid, 60995) <= 0 then
if(msgcontains(msg, 'Quest')) and getPlayerStorageValue(cid, 60994) >= 1 then
doSendAnimatedText(getPlayerPosition(cid),"Exp", TEXTCOLOR_RED)
doPlayerAddExp(cid,100)
setPlayerStorageValue(cid, 60995, 1)
setPlayerStorageValue(cid, 60994, 0)
selfSay('Thanks, can continue your expedition!.', cid)
talkState[talkUser] = 1
else
selfSay('You do not maked quest!.', cid)
talkState[talkUser] = 1
end
else selfSay('You have done this quest!.', cid) end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())