Ir para conteúdo
  • 0

[Resolvido] [Pedido] Npc Que Muda de Lugar


LeoTK

Pergunta

Fala galera eu queria criar um conteúdo bem legalzinho no servidor e queria fazer com que alguns npcs mudassem de lugar depois de algum tempo por exemplo na segunda-feira o npc se encontra em uma posição na terça-feira o npc se encontra em outra posição e assim vai alguém pode dar uma força ??? seria com npcs que vendem e compra items npcs de quests etc.... então eu só preciso do código para colocar nos scripts dos npcs vou deixar alguns scripts de alguns npcs que tem no meu servidor para caso vocês precisarem meu tfs é otx 0.3.6

 

Npc de task

Spoiler

domodlib('task_func')
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 msg = string.lower(msg)
if isInArray({"task","tasks","missao","mission"}, msg) then
npcHandler:say("Me diga o nome do monstro que você deseja fazer a task!", cid)
talkState[talkUser] = 1
elseif talkState[talkUser] == 1 then
if tasktabble[msg] then
if CheckTask(cid) ~= true then
local contagem = getPlayerStorageValue(cid, tasktabble[msg].storage)
if (contagem == -1) then contagem = 1 end
if not tonumber(contagem) then npcHandler:say('Desculpe, mas você já terminou a task do '..msg, cid) return true end
setPlayerStorageValue(cid, tasktabble[msg].storage_start, 1)
npcHandler:say("Parabéns, agora você está participando da missão task do "..msg..", falta matar "..string.sub(((contagem)-1)-tasktabble[msg].count, 2).." "..msg, cid)
talkState[talkUser] = 0
else
npcHandler:say('Desculpe, mas você já faz parte de uma task!', cid)
talkState[talkUser] = 0
end
else
npcHandler:say('digite o nome correto da missão task! para mais informações digite {!task}', cid)
talkState[talkUser] = 1
end
elseif isInArray({"receber","reward","recompensa","report","reportar"}, msg) then
if CheckTask(cid) then
for k, v in pairs(tasktabble) do
racetype = k
if getPlayerStorageValue(cid,v.storage_start) >= 1 then
local contagem = getPlayerStorageValue(cid, v.storage)
if (contagem == -1) then contagem = 1 end
if not tonumber(contagem) then npcHandler:say('você só pode receber os items uma única vez!', cid) return true end
if (((contagem)-1) >= v.count) then
for _, check in pairs(configbosses_task) do
if string.lower(check.race) == string.lower(racetype) then
local on = getPlayersOnline()
for i=1, #on do
if HavePlayerPosition(on, check.FromPosToPos[1],check.FromPosToPos[2]) then
selfSay('aguarde alguns instantes, tem pessoas fazendo a task.', cid) return true
end
end
doTeleportThing(cid, check.Playerpos)
local function checkArea(cid)
if not isCreature(cid) then return LUA_ERROR end
if HavePlayerPosition(cid, check.FromPosToPos[1],check.FromPosToPos[2]) then
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
end
end
addEvent(checkArea, check.time*60*1000, cid)
end
end
local str = ""
if v.exp ~= nil then doPlayerAddExp(cid, v.exp ) str = str.."".. (str == "" and "" or ",") .." "..v.exp.." de exp" end
if v.money ~= nil then doPlayerAddMoney(cid, v.money) str = str.."".. (str == "" and "" or ",") ..""..v.money.." gps" end
if v.reward ~= nil then doAddItemsFromList(cid,v.reward) str = str.."".. (str == "" and "" or ",") ..""..getItemsFromList(v.reward) end
npcHandler:say("Obrigado pela sua ajuda Recompensas: "..(str == "" and "nenhuma" or ""..str.."").." por ter completado a task do "..k, cid)
setPlayerStorageValue(cid, v.storage, "Finished")
setPlayerStorageValue(cid, v.storage_start, 0)
setPlayerStorageValue(cid, 521456, getPlayerStorageValue(cid, 521456) == -1 and 1 or getPlayerStorageValue(cid, 521456)+1)
finisheAllTask(cid)
else
npcHandler:say('Desculpe,mas você só matou '..((contagem)-1)..' de '..v.count..' '..k, cid)
end
end
end
else
npcHandler:say("você não está em nenhuma missão task", cid)
end
elseif isInArray({"sair","leave","exit"}, msg) then
if CheckTask(cid) then
talkState[talkUser] = 2
for k, v in pairs(tasktabble) do
if getPlayerStorageValue(cid,v.storage_start) >= 1 then
storagesair = v.storage_start
local contagem = getPlayerStorageValue(cid, v.storage)
if (contagem == -1) then contagem = 1 end
npcHandler:say('você está participando de uma missão task do '..k..' e já tem '..((contagem)-1)..' '..k..' mortos, deseja mesmo sair?', cid)
end
end
else
npcHandler:say("você não está em nenhuma missão task", cid)
end
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
setPlayerStorageValue(cid, storagesair, 0)
npcHandler:say("Você foi retirado da task com sucesso!", cid)
elseif msg == "no" then 
selfSay("Tudo bem então", cid) 
talkState[talkUser] = 0 
npcHandler:releaseFocus(cid) 
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

npc de quest

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, "coracao do rikudou") or msgcontains(msg, "coracao") then
npcHandler:say("voce pode trocar coraçao do rikudou pelo: {rikudou cetro}.", cid)
end

--------------------------Rikudou Cetro--------------------------------
if msgcontains(msg, "rikudou cetro") or msgcontains(msg, "rikudou") then
npcHandler:say("Voce tem certeza que deseja trocar o coraçao do rikudou pelo rikudou cetro? {yes} or {no}.", cid)
talkState[talkUser] = 1

elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then
npcHandler:say("Voce quem sabe...", cid)
talkState[talkUser] = 0

elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
if doPlayerRemoveItem(cid, 11430, 1) == TRUE then
npcHandler:say("Muito Obrigado! Aqui esta.", cid)
doPlayerAddItem(cid, 11431, 1)
else
npcHandler:say("Voce nao tem o{coraçao do rikudou}.", cid)
end
end

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

 

npc de bank

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

--------------------MESSAGES------------------------------------------------------------------------------
if msgcontains(msg, 'depositar') or msgcontains (msg, 'deposit') then
selfSay('Por favor, me diga quantia que voce deseja depositar.', cid)
talkState[talkUser] = 1

elseif msgcontains(msg, 'sacar') or msgcontains (msg, 'withdraw') then
selfSay('Por favor, me diga quantia que voce gostaria de retirar.', cid)
talkState[talkUser] = 3

elseif msgcontains(msg, 'transferir') or msgcontains (msg, 'transfer') then
selfSay('Por favor, me diga a quantia que voce gostaria de transferir.', cid)
talkState[talkUser] = 5

elseif msgcontains(msg, 'trocar moeda') or msgcontains (msg, 'change gold') then
selfSay('Quantas notas voce deseja cada 100 moedas equivalente a um dollar?', cid)
talkState[talkUser] = 8

elseif msgcontains(msg, 'trocar nota') or msgcontains (msg, 'change platium') then
selfSay('Voce deseja trocar seus dollar em barras de ouro cada 100 dollars equivalente a uma barra de ouro?', cid)
talkState[talkUser] = 10

elseif msgcontains(msg, 'trocar ouro') or msgcontains (msg, 'change crystal') then
selfSay('Quantas barras de ouro quer trocar por dollars uma barra de ouro equivalente a 100 dollars?', cid)
talkState[talkUser] = 15

elseif msgcontains(msg, 'estrato') or msgcontains (msg, 'balance') then
n = getPlayerBalance(cid)
selfSay('Seu Saldo e '..n..' moedas.', cid)
talkState[talkUser] = 0


----------------------DEPOSIT-------------------------------------------------------
elseif talkState[talkUser] == 1 then
if msgcontains(msg, 'all') or msgcontains (msg, 'tudo') then
n = getPlayerMoney(cid)
selfSay('Deseja Depositar '..n..' Moedas ?', cid)
talkState[talkUser] = 2    
else
n = getNumber(msg)
selfSay('Deseja Depositar '..n..' Moedas ?', cid)
talkState[talkUser] = 2
end

elseif talkState[talkUser] == 2 then
if msgcontains(msg, 'yes') or msgcontains (msg, 'sim') then
if getPlayerMoney(cid) >= n then
doPlayerDepositMoney(cid,n)    
selfSay('Agora, seu saldo e ' ..getPlayerBalance(cid)..' Moedas.', cid)
talkState[talkUser] = 0
else
selfSay('Voce nao tem nenhum valor depositado.', cid)
end
else
selfSay('Ok Entao', cid)
end

----------------------WITHDRAW-------------------------------------------------------------------------------------

elseif talkState[talkUser] == 3 then
if msgcontains(msg, 'tudo') or msgcontains (msg, 'all') then
n = getPlayerBalance(cid)
selfSay('Deseja Sacar '..n..' Moedas ?', cid)
talkState[talkUser] = 4    
else
n = getNumber(msg)
selfSay('Deseja Sacar '..n..' Moedas ?', cid)
talkState[talkUser] = 4
end

elseif talkState[talkUser] == 4 then
if msgcontains(msg, 'sim') or msgcontains (msg, 'yes') then
if getPlayerBalance(cid) >= n then
doPlayerWithdrawMoney(cid, n)    
selfSay('Hey voce por aqui, '..n..' Moedas. Agora o saldo da sua conta e ' ..getPlayerBalance(cid)..' Moedas.', cid)
talkState[talkUser] = 0
else
selfSay('Saldo da sua conta insuficiente', cid)
end
else
selfSay('Ok Entao', cid)
end

----------------------TRANSFER----------------------------------------------------------------------------------------    

elseif talkState[talkUser] == 5 then
if msgcontains(msg, 'tudo') or msgcontains (msg, 'all') then
n = getPlayerBalance(cid)
selfSay('Para quem voce gostaria de transferir '..n..' Moedas?', cid)
talkState[talkUser] = 6    
else
n = getNumber(msg)
selfSay('Informe o nome para quem deseja transferir '..n..' Moedas?', cid)
talkState[talkUser] = 6
end

elseif talkState[talkUser] == 6 then
p = msg
selfSay('Entao, voce gostaria de transferir '..n..' Moedas para '..p..'?', cid)
talkState[talkUser] = 7

elseif talkState[talkUser] == 7 then
if msgcontains(msg, 'yes') or msgcontains (msg, 'sim') then
if getPlayerBalance(cid) >= n then
if doPlayerTransferMoneyTo(cid, p, n) == TRUE then
selfSay('Voce transferiu '..n..' Moedas para '..p..' E o saldo da sua conta e '..getPlayerBalance(cid)..' Moedas.', cid)
talkState[talkUser] = 0
else
selfSay('Este cliente nao existe. Certifique-se de escrever o nome corretamente!', cid)
talkState[talkUser] = 0
end
else
selfSay('Saldo da sua conta insuficiente', cid)
talkState[talkUser] = 0
end
else
selfSay('Ok Entao', cid)
talkState[talkUser] = 0
end

----------------------CHANGE GOLD---------------------------------------------------------------------------------
elseif talkState[talkUser] == 8 then
n = getNumber(msg)
b = n * 100
selfSay('Entao voce deseja trocar '..b..' as moedas em '..n..' dollars?', cid)
talkState[talkUser] = 9

elseif talkState[talkUser] == 9 then
if msgcontains(msg, 'yes') or msgcontains (msg, 'sim') then
if doPlayerRemoveItem(cid, 2148, b) == TRUE then
doPlayerAddItem(cid, 2152, n)
talkState[talkUser] = 0
else
selfSay('Voce nao possue dinheiro suficiente.', cid)
talkState[talkUser] = 0
end
else
selfSay('Ok. Nos cancelamos.', cid)
talkState[talkUser] = 0
end

---------------------CHANGE PLATINUM-------------------------------------------------------------------------
elseif talkState[talkUser] == 10 then
if msgcontains(msg, 'moeda') or msgcontains (msg, 'gold') then
selfSay('Quantos dollars voce deseja trocar em moedas?', cid)
talkState[talkUser] = 11
elseif msgcontains(msg, 'crystal') or msgcontains (msg, 'ouro') then
selfSay('Quantas barras de ouro voce deseja?', cid)
talkState[talkUser] = 13    
end


elseif talkState[talkUser] == 11 then
n = getNumber(msg)
b = n * 100
selfSay('Entao voce deseja trocar '..n..' seus Dollars em '..b..' Moedas?', cid)
talkState[talkUser] = 12

elseif talkState[talkUser] == 12 then
if msgcontains(msg, 'yes') or msgcontains (msg, 'sim') then
if doPlayerRemoveItem(cid, 2152, n) == TRUE then
doPlayerAddItem(cid, 2148, b)
talkState[talkUser] = 0
else
selfSay('Voce nao possue dinheiro suficiente.', cid)
talkState[talkUser] = 0
end
else
selfSay('Ok. Nos cancelamos.', cid)
talkState[talkUser] = 0
end

elseif talkState[talkUser] == 13 then
n = getNumber(msg)
b = n * 100
selfSay('Entao voce deseja trocar '..b..' seus Dollars em '..n..' Barras de ouro?', cid)
talkState[talkUser] = 14

elseif talkState[talkUser] == 14 then
if msgcontains(msg, 'yes') or msgcontains (msg, 'sim') then
if doPlayerRemoveItem(cid, 2152, b) == TRUE then
doPlayerAddItem(cid, 2160, n)
talkState[talkUser] = 0
else
selfSay('Voce nao possue dinheiro o suficiente.', cid)
talkState[talkUser] = 0
end
else
selfSay('Ok. Nos cancelamos.', cid)
talkState[talkUser] = 0
end

---------------------CHANGE CRYSTAL-------------------------------------------------------------------------------    
elseif talkState[talkUser] == 15 then
n = getNumber(msg)
b = n * 100
selfSay('Entao voce deseja trocar '..n..' suas barras de ouro em '..b..' Dollars?', cid)
talkState[talkUser] = 16

elseif talkState[talkUser] == 16 then
if msgcontains(msg, 'yes') or msgcontains (msg, 'sim') then
if doPlayerRemoveItem(cid, 2160, n) == TRUE then
doPlayerAddItem(cid, 2152, b)
talkState[talkUser] = 0
else
selfSay('Voce nao possue dinheiro suficiente.', cid)
talkState[talkUser] = 0
end
else
selfSay('Ok. Nos cancelamos.', cid)
talkState[talkUser] = 0
end


end


end

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

-- function maded by Gesior--
function getNumber(txt) --return number if its number and is > 0, else return 0
x = string.gsub(txt,"%a","")
x = tonumber(x)
if x ~= nill and x > 0 then
return x
else
return 0
end
end

 

npc de compra e venda de itens

Spoiler

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)


shopModule:addBuyableItem({'chunin legs'}, 8851, 2950,'chunin legs')
shopModule:addBuyableItem({'speed boots'}, 2525, 50000,'speed boots')
shopModule:addBuyableItem({'chakra boots'}, 7417, 95000, 'chakra boots')
shopModule:addBuyableItem({'elite kunai'}, 2416, 610, 'elite kunai')
shopModule:addBuyableItem({'taijutsu glove'}, 2380, 545, 'taijutsu glove')
shopModule:addBuyableItem({'katana imperium'}, 2376, 50000, 'katana imperium')
shopModule:addBuyableItem({'sound glove'}, 2435, 50000, 'sound glove')
shopModule:addBuyableItem({'chakra armor'}, 2397, 5000, 'chakra armor')
shopModule:addBuyableItem({'jounin armor'}, 2400, 25000, 'jounin armor')
shopModule:addBuyableItem({'kankuru hat'}, 7438, 2000, 'kankuru hat')
shopModule:addBuyableItem({'leaft jounin protector'}, 7427, 50000, 'leaft jounin protector')


shopModule:addSellableItem({'gaara legs'}, 7457, 5000, 'gaara legs')
shopModule:addSellableItem({'icy legs'},                   2428, 15000,       'icy legs')
shopModule:addSellableItem({'haku armor'},         2422, 5000,       'haku armor')
shopModule:addSellableItem({'shikamaru armor'},                   7381, 5000,       'shikamaru armor')
shopModule:addSellableItem({'sakura armor'},         7430, 5000,       'sakura armor')
shopModule:addSellableItem({'jounin armor'},                   2400, 10000,       'jounin armor')
shopModule:addSellableItem({'chouji armor'},                   8852, 10240,       'chouji armor')
shopModule:addSellableItem({'anbu armor'},                   8874, 15000,       'anbu armor')
shopModule:addSellableItem({'orochimaru tunic'},                   2534, 20000,       'orochimaru tunic')

shopModule:addSellableItem({'anbu mask'},         7431, 5000,       'anbu mask')
shopModule:addSellableItem({'leaft jounin protector'},         7427, 7000,       'leaft jounin protector')
shopModule:addSellableItem({'chakra mask'},                   2447, 11030,       'chakra mask')        
shopModule:addSellableItem({'health mask'},                   2451, 11025,       'health mask')        
shopModule:addSellableItem({'katana'},                   2382, 2090,       'katana')    
shopModule:addSellableItem({'dual slayer'},                   7867, 10000,       'dual slayer')      

shopModule:addSellableItem({'scytle'},                     2398, 25000,       'scytle')
shopModule:addSellableItem({'shukaku spear'},                           7862, 15000,       'shukaku spear')
shopModule:addSellableItem({'lee taijutsu glove'},                     2372, 7060,       'lee taijutsu glove')
shopModule:addSellableItem({'jounin glove'},         2648, 10350,       'jounin glove')
shopModule:addSellableItem({'chakra glove'},                     2383, 12000,       'chakra glove')
shopModule:addSellableItem({'raikage glove'},                     2516, 17000,       'raikage glove')
shopModule:addSellableItem({'speed boots'},2525, 10000,'speed boots')

shopModule:addSellableItem({'chakra boots'},7417, 13150,'chakra boots')
shopModule:addSellableItem({'akatsuki boots'},2529, 13500,'akatsuki boots')


npcHandler:addModule(FocusModule:new())

 

Link para o comentário
Compartilhar em outros sites

11 respostass a esta questão

Posts Recomendados

  • 0
local dia ={	["Sunday"] = {['npc name'] = {x=0,y=0,z=0},['other npc']={x=0,y=0,z=0}}, -- domingo	["Monday"] = {['npc name'] = {x=0,y=0,z=0},['other npc']={x=0,y=0,z=0}}, -- segunda	["Tuesday"] = {['npc name'] = {x=0,y=0,z=0},['other npc']={x=0,y=0,z=0}}, -- terça	["Wednesday"] = {['npc name'] = {x=0,y=0,z=0},['other npc']={x=0,y=0,z=0}}, -- quarta	["Thursday"] = {['npc name'] = {x=0,y=0,z=0},['other npc']={x=0,y=0,z=0}}, -- quinta	["Friday"] = {['npc name'] = {x=0,y=0,z=0},['other npc']={x=0,y=0,z=0}}, -- sexta	["Saturday"] = {['npc name'] = {x=0,y=0,z=0},['other npc']={x=0,y=0,z=0}}, -- sabado}function onStartup()local CM = dia[os.date("%A")]	for npc,pos in pairs(CM) do 		if not(doCreateNpc(npc, pos))then print("Npc: "..npc.." não foi criado na pos: x="..pos.x..", y="..pos.y..", z="..pos.z..".") end	end	return trueend

 

Link para o comentário
Compartilhar em outros sites

  • 0

Eu fiz esse sistema para o npc rashid. usa ele como base.

local dia ={	["Sunday"] = {x=1091, y=1089, z=6}, -- domingo	["Monday"] = {x=1029, y=1094, z=6}, -- segunda	["Tuesday"] = {x=989, y=999, z=7}, -- terça	["Wednesday"] = {x=1036, y=867, z=6}, -- quarta	["Thursday"] = {x=1029, y=1094, z=6}, -- quinta	["Friday"] = {x=989, y=999, z=7}, -- sexta	["Saturday"] = {x=1036, y=867, z=6}, -- sabado}function onStartup()local CM = dia[os.date("%A")]	if(doCreateNpc('rashid', CM))then		print('Rashid is now summoned in '..getTownName(getTownInArea(CM,30)))	else		print('Error ao criar o npc Rashid em '..getTownName(getTownInArea(CM,30))..'.')	end	return trueend

 

Link para o comentário
Compartilhar em outros sites

  • 0
24 minutos atrás, Poccnn disse:

Eu fiz esse sistema para o npc rashid. usa ele como base.


local dia ={
	["Sunday"] = {x=1091, y=1089, z=6}, -- domingo
	["Monday"] = {x=1029, y=1094, z=6}, -- segunda
	["Tuesday"] = {x=989, y=999, z=7}, -- terça
	["Wednesday"] = {x=1036, y=867, z=6}, -- quarta
	["Thursday"] = {x=1029, y=1094, z=6}, -- quinta
	["Friday"] = {x=989, y=999, z=7}, -- sexta
	["Saturday"] = {x=1036, y=867, z=6}, -- sabado
}

function onStartup()
local CM = dia[os.date("%A")]
	if(doCreateNpc('rashid', CM))then
		print('Rashid is now summoned in '..getTownName(getTownInArea(CM,30)))
	else
		print('Error ao criar o npc Rashid em '..getTownName(getTownInArea(CM,30))..'.')
	end
	return true
end

 

posso editar essa parte e ir adicionando npcs novos? ou tenho que criar um desse por npc?

 

if(doCreateNpc('rashid', CM))then

@Poccnn o que seria CM?

@Poccnn só uma dúvida isso é uma lib/globalevents ou coloca dentro da script do npc?

Link para o comentário
Compartilhar em outros sites

  • 0
local CM = dia[os.date("%A")]

Vai puxar o dia atual do sistema. Se for domingo vai retornar:

 

dia["Sunday"]

 

por exemplo.

 

 

 

 

Link para o comentário
Compartilhar em outros sites

  • 0
5 minutos atrás, Nogard disse:
local CM = dia[os.date("%A")]

Vai puxar o dia atual do sistema. Se for domingo vai retornar:

 

dia["Sunday"]

 

por exemplo.

 

 

 

 

tendi o nogard é oque isso ai uma lib/globalevents tem que colocar no script do npc?

Link para o comentário
Compartilhar em outros sites

  • 0
2 minutos atrás, Nogard disse:

globalevents/scripts, o código todo.

 

vlw

@Poccnn

 

Man ta dando erro referente a town o número 30 é referente a town da cidade?

 


[16/08/2017 20:11:34] [Error - GlobalEvent Interface] 
[16/08/2017 20:11:34] data/globalevents/scripts/harumi.lua:onStartup
[16/08/2017 20:11:34] Description: 
[16/08/2017 20:11:34] data/globalevents/scripts/harumi.lua:14: attempt to call global 'getTownInArea' (a nil value)
[16/08/2017 20:11:34] stack traceback:
[16/08/2017 20:11:34]     data/globalevents/scripts/harumi.lua:14: in function <data/globalevents/scripts/harumi.lua:11>

Link para o comentário
Compartilhar em outros sites

  • 0
5 minutos atrás, Poccnn disse:

Isso é apenas um exemplo que eu te passei, não é pra usar como ele esta.

única coisa que sou péssimo é em lua @Poccnn kkkk preciso de algo mais literal 

Link para o comentário
Compartilhar em outros sites

  • 0
47 minutos atrás, Poccnn disse:

local dia ={
	["Sunday"] = {['npc name'] = {x=0,y=0,z=0},['other npc']={x=0,y=0,z=0}}, -- domingo
	["Monday"] = {['npc name'] = {x=0,y=0,z=0},['other npc']={x=0,y=0,z=0}}, -- segunda
	["Tuesday"] = {['npc name'] = {x=0,y=0,z=0},['other npc']={x=0,y=0,z=0}}, -- terça
	["Wednesday"] = {['npc name'] = {x=0,y=0,z=0},['other npc']={x=0,y=0,z=0}}, -- quarta
	["Thursday"] = {['npc name'] = {x=0,y=0,z=0},['other npc']={x=0,y=0,z=0}}, -- quinta
	["Friday"] = {['npc name'] = {x=0,y=0,z=0},['other npc']={x=0,y=0,z=0}}, -- sexta
	["Saturday"] = {['npc name'] = {x=0,y=0,z=0},['other npc']={x=0,y=0,z=0}}, -- sabado
}

function onStartup()
local CM = dia[os.date("%A")]
	for npc,pos in pairs(CM) do 
		if not(doCreateNpc(npc, pos))then print("Npc: "..npc.." não foi criado na pos: x="..pos.x..", y="..pos.y..", z="..pos.z..".") end
	end
	return true
end

 

vlw @Poccnn seu lindu

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...