deu bug na formatação,algums sinais como "<",">" e outros bugaram,arrume
- Fórum
- OTServ
- Recursos
- Scripting
- NPCs, monsters e raids
- Npc Resetador
info
Grupo: Conde
Registrado: 30/10/11
Posts: 625
Reputação: +101
Gênero: Masculino

info
Grupo: Campones
Registrado: 13/06/12
Posts: 95
Reputação: +14

Tente agora !
info
Grupo: Conde
Registrado: 30/10/11
Posts: 625
Reputação: +101
Gênero: Masculino

eu n testei.eu apenas avisei, por que estava visivel. e nem testarei
'then' expected near '&' error
info
Grupo: Artesão
Registrado: 30/03/11
Posts: 138
Reputação: +4
Char no Tibia: Druida de Asgard

Aqui está
-- SCRIPT FEITO POR YUNIE
-- config
minlevel = 400 -- level para resetar
price = 0
newlevel = 10 -- level após reset
newexp = 9300 -- nova experiencia após reset
-- end config
function addReset(cid)
resets = getResets(cid)
setPlayerStorageValue(cid,36874,resets+1)
return true
end
function getResets(cid)
resets = getPlayerStorageValue(cid,36874)
if resets < 0 then
resets = 0
end
return resets
end
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, 'reset') then
selfSay('Do you want to reset your character level? Your character will be logged off if you confirm. You must pay '..price..' gold coins to reset.', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if getPlayerMoney(cid) < price then
selfSay('You must pay '..price..' gold coins to reset.', cid)
elseif getPlayerLevel(cid) < minlevel then
selfSay('You must be at least level '.. minlevel ..' to reset.', cid)
else
doPlayerRemoveMoney(cid,price)
addReset(cid)
playerid = getPlayerGUID(cid)
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level`="..newlevel..",`experience`="..newexp.." WHERE `players`.`id`= ".. playerid .."")
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('Ok.', cid)
elseif msgcontains(msg, 'quant') then
selfSay('You have '..getResets(cid)..' reset(s).', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
info
Grupo: Campones
Registrado: 16/06/12
Posts: 8
Reputação: 0
Char no Tibia: Coronel Pasatempo

Tem como colocar quando resetar muda a vocaçao
info
Grupo: Artesão
Registrado: 03/04/09
Posts: 149
Reputação: +6
Char no Tibia: Hiporion

Ta dando erro aqui -' / fexa o Ot quando o player vai falar com o NPC
info
Grupo: Campones
Registrado: 13/06/12
Posts: 95
Reputação: +14

Eu acho que em tfs não roda eu estava testando ele em Forgu~
info
Grupo: Campones
Registrado: 13/06/12
Posts: 95
Reputação: +14

Eu refiz alguns testes aqui o script ta funcionando em TFS 8.6 DEV 0.4 (REV3884)+ ...100%
@up
Refiz o topico!Agora ficara mais facil abrçs
Editado Agosto 4 por Spraypaint
info
Grupo: Barão
Registrado: 06/02/12
Posts: 207
Reputação: +1
Char no Tibia: Não lembro :(

Como faz pra reseta o magic level também?
info
Grupo: Artesão
Registrado: 24/10/11
Posts: 133
Reputação: +55
Char no Tibia: ...

Teria como colocar para trocar a vocação? E não só com um personagem mais com varios.
CrazzyMaster
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
local config = {
--[Vocation] = ( Nova Vocation, New Outfit )
[8] = { 9, 137},
[19] = { 20, 198},
[30] = { 31, 565},
[41] = { 42, 565}
}
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, 'reborn') and getPlayerStorageValue(cid,30025) == 4 then
selfSay('You are reborn.', cid)
focus = 0
talk_start = 0
elseif msgcontains(msg, 'reborn') and getPlayerLevel(cid) < 250 and getPlayerStorageValue(cid,30025) ~= 4 then
selfSay('Hmm, Desculpe. Você não tem level 250.', cid)
elseif msgcontains(msg, 'reborn') then
selfSay('Are you sure? {yes}', cid)
talkState[talkUser] = 2
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 and getPlayerLevel(cid) >= 250 then
local voc = config[getPlayerVocation(cid)]
doPlayerSetVocation(cid, voc[1])
local outfit = {lookType = voc[2]}
doCreatureChangeOutfit(cid, outfit)
doPlayerAddExp(cid, -(getPlayerExperience(cid)-getExperienceForLevel(1)))
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+20000)
setCreatureMaxMana(cid, getCreatureMaxMana(cid)+30000)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
doCreatureAddMana(cid, getCreatureMaxMana(cid))
setPlayerStorageValue(cid,30025,4)
talkState[talkUser] = 0
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
selfSay('Desculpe, ' .. getCreatureName(cid) .. '! Voce precisa reverter ou transformar para rebornar.', cid)
talkState[talkUser] = 0
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye.', cid)
focus = 0
talk_start = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
<npc name="Reborn" script="data/npc/scripts/reborn.lua" walkinterval="0" floorchange="0" access="5" level="1" maglevel="1"> <health now="100" max="100"/> <look type="118" head="57" body="59" legs="40" feet="76" addons="3"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|. Reborn!" /> </parameters> </npc>
Espero que isso ajude.





info
Grupo: Campones
Registrado: 13/06/12
Posts: 95
Reputação: +14
Funcional em:
TFS 8.6 DEV 0.4 (REV3884)
Esse npc não foi criando somente por mim eu apenas aperfeiçoei e coloquei novas
funções tirando também diversos bugs que atrapalhavam seu funcionamento.
Em data/npc coloque:
<?xml version="1.0"?><npc name="Resetador" script="data/npc/scripts/reseter.lua" walkinterval="0" floorchange="0">
<health now="100" max="100"/>
<look type="133" head="10" body="122" legs="19" feet="10"/>
<parameters>
<parameter key="message_greet" value="Ola, |PLAYERNAME|. Eu posso {resetar} seu level. "/>
</parameters>
</npc>
Crie um arquivo .lua em data\npc\scripts e coloque
-- config
local minlevel = 50 -- level inical para resetar
local price = 1000 -- preço inicial para resetar
local newlevel = 8 -- level após reset
local newexp = 4200 -- nova experiencia após reset
local lvlByReset = 50 -- level acrescentado por reset
local priceByReset = 100 -- preço acrescentado por reset
local maxResets = 100 -- máximo de resets
-- end config
function addReset(cid)
resets = getResets(cid)
setPlayerStorageValue(cid,1020,resets+1)
return true
end
function getResets(cid)
resets = getPlayerStorageValue(cid,1020)
if resets < 0 then
resets = 0
end
return resets
end
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 needlvl = minlevel + (getResets(cid) * lvlByReset)
local newPrice = price + (getResets(cid) * priceByReset)
if msgcontains(msg, 'resetar') then
if getResets(cid) < maxResets then
selfSay('Voce deseja reset seu char? Isto custará '..newPrice..' gp\'s!', cid)
talkState[talkUser] = 1
else
selfSay('Você ja alcançou seu limite de resets!', cid)
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if getPlayerMoney(cid) < newPrice then
selfSay('É Necessario ter '..newPrice..' gp\'s para resetar!', cid)
elseif getPlayerLevel(cid) < needlvl then
selfSay('O level minimo para reset é '..needlvl..'!', cid)
else
doPlayerRemoveMoney(cid,newPrice)
if isInArray(vocs, getPlayerVocation(cid)) then
doPlayerSetVocation(cid, getPlayerVocation(cid)+4)
end
addReset(cid)
playerid = getPlayerGUID(cid)
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level`="..newlevel..",`experience`="..newexp.." WHERE `players`.`id`= ".. playerid .."")
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('Ok.', cid)
elseif msgcontains(msg, 'quant') then
selfSay('Voce tem um total de '..getResets(cid)..' reset(s).', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Creditos pelo npc base:
@nubinho
Qualquer duvida postem ai abaixo!
Editado Agosto 4 por Spraypaint