Você faz a quest, e o npc te dá EXPERIENCE =D
~> Em actions.xml add:
<action actionid="8001" event="script" value="alburk.lua"/>
No mapa, crie uma chest quest, ou qualquer outro item e de propriedades e em Action id coloque 8001
~> Em acions/scripts: Crie um arquivo chamado alburk.lua e cole isso dentro:
function onUse(cid, item, fromPosition, itemEx, toPosition) lvl = 100 -- level para o player fazer a quest if getPlayerLevel(cid) <= lvl then return doPlayerSendCancel(cid, 'Apenas level 100 ou mais pode fazer a quest') end if getPlayerStorageValue(cid,8001) == 5 then doPlayerSendCancel(cid, 'Você ja fez essa quest') doSendMagicEffect(getCreaturePosition(cid), 2) return true end doPlayerSendTextMessage(cid, 25, 'Você terminou a quest, para receber seu presente fale com Alburk.') doSendMagicEffect(getCreaturePosition(cid), 28) setPlayerStorageValue(cid,8001,0) setPlayerStorageValue(cid,8001,5) end
~> Em data/npc crie um arquivo chamado alburk.xml e cole dentro:
<?xml version="1.0" encoding="UTF-8"?> <npc name="Alburk" script="data/npc/scripts/alburk.lua" access="3" floorchange="0" walkinterval="0"> <mana now="800" max="800"/> <health now="200" max="200"/> <look type="180" head="78" body="113" legs="114" feet="0"/> </npc>
~> Em npc/scripts crie um arquivo chamado alburk.lua e cole dentro:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos, item, itemEx)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and focus == 0) and getDistanceToCreature(cid) < 4 then
if getPlayerStorageValue(cid, 8001) == 5 then
return selfSay('Você ja recebeu seu presente.')
end
setPlayerStorageValue(cid,8001,7)
selfSay('Você deseja receber seu presente?')
focus = cid
talk_start = os.clock()
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'yes') then
if getPlayerStorageValue(cid, 8001) == 2 then
return selfSay('Você ja recebeu seu presente!!.')
end
if getPlayerStorageValue(cid, 8001) == 7 then
return selfSay('Para receber seu presente você precisa terminar a quest!!.')
end
doPlayerAddExp(cid, 15330000) -- 15330000 é a experience que o player irá ganhar!
selfSay('Você foi presentiado com experience!!.')
setPlayerStorageValue(cid,8001,2)
setPlayerStorageValue(cid,8001,5)
focus = 0
talk_start = 0
end
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Tchau!')
focus = 0
talk_start = 0
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Bye.')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Bye.')
focus = 0
end
end
end
Explicando :
Você terá que fazer uma quest,
Ao fazer a quest você deverá falar com o NPC para ele te dar EXPERIENCE.
Para configurar a experience ganha, edite essa parte no NPC:
doPlayerAddExp(cid, 15330000)
15330000 é o tanto de experience que o player ira ganhar.
=D
~~~> Gostou? Foi Util ? Então comente (: <~~~











