Jump to content

Npc Reset Por Vocação.


coyotestark

Recommended Posts

vá em NPC/scripts, Crie um arquivo .lua (Exemplo: reset.lua)

Depois volta na pasta NPC, Crie um Arquivo .XML (Exemplo: reset.xml) e crie um NPC.

o meu ta asssim.

<npc name="reborn" script="data/npc/scripts/reborn.lua" access="6" lookdir="1">
<health now="1000" max="1000"/>
<look type="133" head="95" body="86" legs="86" feet="38" addons="3"/>
<parameters>
 <parameter key="message_greet" value="Hello |PLAYERNAME|.Qual motivo de ter vindo ate mim depois desta jornada {reborn}." />
</parameters>
</npc>

 

no arquivo .lua insira isto dentro

 

-- SCRIPT FEITO POR YUNIE Edited by Stark
-- config
minlevel = 1 -- level para resetar
price = 5000
newlevel = 9 -- level após reset
newexp = 0 -- nova experiencia após reset
-- end config
function addReset(cid)
resets = getResets(cid)
setPlayerStorageValue(cid,1020,resets+1)
return true
endfunction 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 cidif msgcontains(msg, 'renascer') and getPlayerStorageValue(cid,30025) == 4 then
selfSay('Voçe Não Pode Mais renascer.')
focus = 0
talk_start = 0
elseif msgcontains(msg, 'renascer') and getPlayerLevel(cid) < 30 and getPlayerStorageValue(cid,30025) ~= 4 then
selfSay('Mensagem que sera dita caso nao tenha os requerimentos nescessarios')elseif msgcontains(msg, 'renascer') then
selfSay('Entao o grande aventureiro gostaria de renascer? {yes}')
							 talk_state = 2
elseif msgcontains(msg, 'yes') and talk_state ==2 and getPlayerLevel(cid) >= 30 and getPlayerVocation(cid) == 50 then
doPlayerSetVocation(cid, 95)
addReset(cid)
playerid = getPlayerGUID(cid)
setPlayerStorageValue(cid,30025,4)
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level`="..newlevel..",`experience`="..newexp.." WHERE `players`.`id`= ".. playerid .."")
talk_state = 0

elseif msgcontains(msg, 'yes') and talk_state == 2 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! You must revert or transform, Voce deve transformar ou reverter.')

elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye. Deslogue e logue Por Favor!!!!')
focus = 0
talk_start = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

getPlayerLevel(cid) >= 30 ( Level nescessario )

getPlayerVocation(cid) == 50 then (vocação)

doPlayerSetVocation(cid, 95) (vocação que sera inserida apos reset)

 

selfSay('Mensagem que sera dita apos player falar a mensagem de ação') no caso (renascer)

 

 

Duvidas Postar aqui.

Edited by CoyoteStark
Link to comment
Share on other sites

×
×
  • Create New...