Ir para conteúdo
  • 0

xisraelx

Pergunta

Oi pessoal de xtibia :D

 

Eu venho fazer uma pergumta ae pra vcs... To trabalhando com o sistema do Roksas (Obrigado cara pelo o sistema de torneio pvp ;D), mais eu to fazendo uma modificaçao pra ele em ves de fazer tp pra 1 lugar... eu quero fazer que leve pra 4 lugar mais quero que ele leve pela sorte uma ajuda ae.

 

Aque ta o scripts do NPC Tournament. na pasta Data/Npc/scripts

 

 

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
local cfg = {
price = 100, -- Money to sign in tournament
startPos = {x = 1064, y = 1053, z = 7}, -- Posição central da sala de torneio
hour = "20:00:00", -- Hour to start
maxhour = "20:10:00", -- Max to start
}
if msgcontains(msg, 'torneio') or msgcontains(msg, 'enter') then
selfSay('You want to participate in the tournament by '..cfg.price..' gps / dollars?', cid)
talkState[talkUser] = 2
elseif talkState[talkUser] == 2 then
if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then
if os.date("%X") < cfg.hour or os.date("%X") > cfg.maxhour then
selfSay('Registration for the tournament finished, come back later.', cid)
return true
end
if doPlayerRemoveMoney(cid, cfg.price) then
doTeleportThing(cid, {x = 1818, y = 1340, z = 7})
doPlayerSendTextMessage(cid, 27, "Welcome to the tournament, the fights will start on time, good luck, hahaha!")
else
selfSay('You do not have enough money ('..cfg.price..').', cid)
end
else
selfSay('Sure you do not want to participate? Okay, see you next time!!', cid)
talkState[talkUser] = 0
end
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Vermelho: Tp que o npc faiz

 

Ae eu quero que faça pra 4 lugar diferentes, so na sorte

 

Aque os lugar que eu quero que leve.


 

1818 x 1340 y 7 z

1821 x 1340 y 7 z
1824 x 1340 y 7 z
1827 x 1340 y 7 z

 

 

 

Link para o comentário
Compartilhar em outros sites

6 respostass a esta questão

Posts Recomendados

  • 0

FEITO!

 

 

 
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
 
local cfg = {
price = 100, -- Money to sign in tournament
startPos = {x = 1064, y = 1053, z = 7}, -- Posição central da sala de torneio
 
hour = "20:00:00", -- Hour to start
maxhour = "20:10:00", -- Max to start
}
 
if msgcontains(msg, 'torneio') or msgcontains(msg, 'enter') then
selfSay('You want to participate in the tournament by '..cfg.price..' gps / dollars?', cid)
talkState[talkUser] = 2
 
 
elseif talkState[talkUser] == 2 then
 
if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then
 
if os.date("%X") < cfg.hour or os.date("%X") > cfg.maxhour then
selfSay('Registration for the tournament finished, come back later.', cid)
return true
end
 
 
 local telar {
[1] = {x= 1818, y= 1340, z = 7},
[2] = {x= 1821, y= 1340, z = 7},
[3] = {x= 1824, y= 1340, z = 7},
[4] = {x= 1827, y= 1340, z = 7},
}
 
if doPlayerRemoveMoney(cid, 10000) then
local random = math.random(0, 5)
doTeleportThing(cid, telar[random])
doPlayerSendTextMessage(cid, 27, "Welcome to the tournament, the fights will start on time, good luck, hahaha!")
return true
else
selfSay('You do not have enough money ('..cfg.price..').', cid)
end
else
selfSay('Sure you do not want to participate? Okay, see you next time!!', cid)
talkState[talkUser] = 0
end
end
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Editado por Cleberadm
Link para o comentário
Compartilhar em outros sites

  • 0

Obrigado vou testar :D +1


Deu erro
no server

 

[Error - LuaScriptInterface::loadFile] data/npc/scripts/tournament.lua:42: unexpected symbol near '{'

[27/07/2013 10:29:05] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/tournament.lua
[27/07/2013 10:29:05] data/npc/scripts/tournament.lua:42: unexpected symbol near '{'
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...