[Quest/npc] Quest Que Dá Exp Dps Que Fala Com Npc!

thalia
Por thalia
em Actions e Talkactions

thalia

Avatar Legends Online
avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 03/07/07Posts: 104

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 (: <~~~

 

felipejc12

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 15/10/07Posts: 21Char no Tibia: Rykon

gostei :winksmiley02:

devirom

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 14/10/10Posts: 12Char no Tibia: Devirom

vc testou em qual versão do tibia? '-'

soucalibur

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 09/11/10Posts: 3Char no Tibia: Ek Barzinss

otimo cara adorei agr + uma quest xD

Vodkart

Sumus Validus
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 21/05/10Posts: 3406Gênero: Masculino

da para diminuir um pouco usando elseif

bossisg.png

drcorrea

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 18/04/08Posts: 1

Muito bom!

rodrigocmj18

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 17/01/11Posts: 15

Deu tudo certo ate na hora que o player volta para o npc para pegar o premio, o npc nao da o premio e fala que ja recebeu o premio.