Por SmiX, 11 de out. de 2012 em NPCs, monsters e raids
info
Grupo: Conde
Registrado: 25/01/12
Posts: 963
Reputação: +265
Olá gentalhas, hoje venho postar um npc interessante que achei em outro fórum e que nunca vi ele por aqui.
Bom, ele é um NPC que upa o teu char para você. Porem tem um certo custo e demora um certo tempo em que você não pode entrar no char.
Scripts:
Crie um arquivo chamado treiner.xml na pasta NPCS e coloque isso dentro:
Código:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="iuniX, The Trainer" script="trainer.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="268" head="114" body="114" legs="114" feet="114" addons="3"/>
</npc>
Agora vá na pasta npc/scripts e crie um arquivo chamado trainer.lua e coloque isso daqui dentro:
local price2 = 100000 -- Preço por hora
local tipo_de_tempo = 3600 --[[ O tempo é dividido em:
3600 = horas
60 = minutos
1 = segundos
0 = instantaneo ]]
local focuses = {}
local function isFocused(cid)
for i, v in pairs(focuses) do
if(v == cid) then
return true
end
return false
local function addFocus(cid)
if(not isFocused(cid)) then
table.insert(focuses, cid)
local function removeFocus(cid)
table.remove(focuses, i)
break
local function lookAtFocus()
if(isPlayer(v)) then
doNpcSetCreatureFocus(v)
return
doNpcSetCreatureFocus(0)
function onCreatureAppear(cid)
function doTrainPlayer (cid, time)
setPlayerStorageValue(cid, 1338, os.time() + (time * tipo_de_tempo))
setPlayerStorageValue(cid, 1339, time)
doRemoveCreature(cid)
function onCreatureDisappear(cid)
if(isFocused(cid)) then
selfSay("Hmph!")
removeFocus(cid)
if(isPlayer(cid)) then
closeShopWindow(cid)
function onCreatureSay(cid, type, msg)
if((msg == "hi") and not (isFocused(cid))) then
selfSay("Welcome, ".. getCreatureName(cid) ..".", cid, true)
selfSay("Do you want {train}?", cid)
addFocus(cid)
elseif((isFocused(cid)) and (msg == "train")) then
selfSay("I can train you in one hour, maybe do you up some levels.", cid)
selfSay("How long time do you want train? say: {10 hours}. Or say {price} to see my prices.", cid)
talkstatus = 1
elseif isFocused(cid) and (talstatus == 1 ) and (msg == "price") then
doPlayerPopupFYI(cid, price2 .. " gps - hour")
elseif isFocused(cid) and (talkstatus == 1) then
time = string.match(msg, "(.+) hours")
selfSay("Do you want start the treining?. You must pay " .. price2 .." gold coins.", cid)
talkstatus = 2
elseif isFocused(cid) and (msg == "yes") and (talkstatus == 2) then
if time then
if doPlayerRemoveMoney(cid, time * price2) then
doTrainPlayer(cid, time)
else
selfSay("Sorry, but u don't have money. Say {price} to see my prices.", cid)
elseif isFocused(cid) and (msg == "price") then
elseif((isFocused(cid)) and (msg == "bye")) then
selfSay("Goodbye!", cid, true)
function onPlayerCloseChannel(cid)
selfSay("Madafaquer!")
function onPlayerEndTrade(cid)
selfSay("It was a pleasure doing business with you.", cid)
function onThink()
for i, focus in pairs(focuses) do
if(not isCreature(focus)) then
removeFocus(focus)
local distance = getDistanceTo(focus) or -1
if((distance > 4) or (distance == -1)) then
lookAtFocus()
Agora vá em creaturescripts e abra o creaturescripts.xml e adicione isso:
<event type="login" name="Trainer" event="script" value="trainer.lua"/>
E vá na pasta creaturescripts/scripts e crie um arquivo chamado trainer.lua e coloque isso daqui dentro:
local exp = 100000
function onLogin(cid)
local time = getPlayerStorageValue(cid, 1339)
if time > 0 then
if getPlayerStorageValue(cid, 1338) > os.time() then
doPlayerPopupFYI(cid, "You are training, please let your treiner finish.")
addEvent(doRemoveThing, 500, cid)
setPlayerStorageValue(cid, 1338,-1)
setPlayerStorageValue(cid, 1339, -1)
doPlayerAddExp(cid, exp * time)
doPlayerPopupFYI(cid, "Thanks for training with us.")
Configuração:
NPC:
Onde estiver price2 você coloca o preço que será cobrado por tempo.
Onde estiver tipo_de_tempo você coloca o tipo de tempo: Minutos, segundos, horas ou até instantaneamente.
Creaturescripts:
info
Grupo: Conde
Registrado: 25/01/12
Posts: 963
Reputação: +265
Olá gentalhas, hoje venho postar um npc interessante que achei em outro fórum e que nunca vi ele por aqui.
Bom, ele é um NPC que upa o teu char para você. Porem tem um certo custo e demora um certo tempo em que você não pode entrar no char.
Scripts:
Crie um arquivo chamado treiner.xml na pasta NPCS e coloque isso dentro:
Código:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="iuniX, The Trainer" script="trainer.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="268" head="114" body="114" legs="114" feet="114" addons="3"/>
</npc>
Agora vá na pasta npc/scripts e crie um arquivo chamado trainer.lua e coloque isso daqui dentro:
Código:
local price2 = 100000 -- Preço por hora
local tipo_de_tempo = 3600 --[[ O tempo é dividido em:
3600 = horas
60 = minutos
1 = segundos
0 = instantaneo ]]
local focuses = {}
local function isFocused(cid)
for i, v in pairs(focuses) do
if(v == cid) then
return true
end
end
return false
end
local function addFocus(cid)
if(not isFocused(cid)) then
table.insert(focuses, cid)
end
end
local function removeFocus(cid)
for i, v in pairs(focuses) do
if(v == cid) then
table.remove(focuses, i)
break
end
end
end
local function lookAtFocus()
for i, v in pairs(focuses) do
if(isPlayer(v)) then
doNpcSetCreatureFocus(v)
return
end
end
doNpcSetCreatureFocus(0)
end
function onCreatureAppear(cid)
end
function doTrainPlayer (cid, time)
setPlayerStorageValue(cid, 1338, os.time() + (time * tipo_de_tempo))
setPlayerStorageValue(cid, 1339, time)
doRemoveCreature(cid)
end
function onCreatureDisappear(cid)
if(isFocused(cid)) then
selfSay("Hmph!")
removeFocus(cid)
if(isPlayer(cid)) then
closeShopWindow(cid)
end
end
end
function onCreatureSay(cid, type, msg)
if((msg == "hi") and not (isFocused(cid))) then
selfSay("Welcome, ".. getCreatureName(cid) ..".", cid, true)
selfSay("Do you want {train}?", cid)
addFocus(cid)
elseif((isFocused(cid)) and (msg == "train")) then
selfSay("I can train you in one hour, maybe do you up some levels.", cid)
selfSay("How long time do you want train? say: {10 hours}. Or say {price} to see my prices.", cid)
talkstatus = 1
elseif isFocused(cid) and (talstatus == 1 ) and (msg == "price") then
doPlayerPopupFYI(cid, price2 .. " gps - hour")
elseif isFocused(cid) and (talkstatus == 1) then
time = string.match(msg, "(.+) hours")
selfSay("Do you want start the treining?. You must pay " .. price2 .." gold coins.", cid)
talkstatus = 2
elseif isFocused(cid) and (msg == "yes") and (talkstatus == 2) then
if time then
if doPlayerRemoveMoney(cid, time * price2) then
doTrainPlayer(cid, time)
else
selfSay("Sorry, but u don't have money. Say {price} to see my prices.", cid)
end
end
elseif isFocused(cid) and (msg == "price") then
doPlayerPopupFYI(cid, price2 .. " gps - hour")
elseif((isFocused(cid)) and (msg == "bye")) then
selfSay("Goodbye!", cid, true)
removeFocus(cid)
end
end
function onPlayerCloseChannel(cid)
if(isFocused(cid)) then
selfSay("Madafaquer!")
removeFocus(cid)
end
end
function onPlayerEndTrade(cid)
selfSay("It was a pleasure doing business with you.", cid)
end
function onThink()
for i, focus in pairs(focuses) do
if(not isCreature(focus)) then
removeFocus(focus)
else
local distance = getDistanceTo(focus) or -1
if((distance > 4) or (distance == -1)) then
selfSay("Madafaquer!")
removeFocus(cid)
end
end
end
lookAtFocus()
end
Agora vá em creaturescripts e abra o creaturescripts.xml e adicione isso:
Código:
<event type="login" name="Trainer" event="script" value="trainer.lua"/>
E vá na pasta creaturescripts/scripts e crie um arquivo chamado trainer.lua e coloque isso daqui dentro:
Código:
local exp = 100000
function onLogin(cid)
local time = getPlayerStorageValue(cid, 1339)
if time > 0 then
if getPlayerStorageValue(cid, 1338) > os.time() then
doPlayerPopupFYI(cid, "You are training, please let your treiner finish.")
addEvent(doRemoveThing, 500, cid)
else
setPlayerStorageValue(cid, 1338,-1)
setPlayerStorageValue(cid, 1339, -1)
doPlayerAddExp(cid, exp * time)
doPlayerPopupFYI(cid, "Thanks for training with us.")
end
end
return true
end
Configuração:
NPC:
Código:
local price2 = 100000 -- Preço por hora
local tipo_de_tempo = 3600 --[[ O tempo é dividido em:
3600 = horas
60 = minutos
1 = segundos
0 = instantaneo ]]
Onde estiver price2 você coloca o preço que será cobrado por tempo.
Onde estiver tipo_de_tempo você coloca o tipo de tempo: Minutos, segundos, horas ou até instantaneamente.
Creaturescripts:
Código:
local exp = 100000