LeoTK 173 Postado Outubro 20, 2012 Share Postado Outubro 20, 2012 galera emtaum eu gostaria que o npc fosse assim eu sou o player upei do lvl 1 pro lvl 2 ai eu vo no npc e falo hi,yes e ele me da 1k e um poko de exp aki ta a script mais nao consigo mudar ja tentei 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 1kk!!.') 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 Link para o comentário https://xtibia.com/forum/topic/196961-galera-eu-gostaria-de-criar-um-npc-que-quando-o-player-upa-1-level-e-da-dinheiro-e-exp/ Compartilhar em outros sites More sharing options...
0 GuhPk 111 Postado Outubro 20, 2012 Share Postado Outubro 20, 2012 (editado) Tem 1 maneira melhor de se fazer isso, tipo assim: Você é um player e esta level 1. Quando você upar para o level 2 automaticamente você ganha este 1k + exp. Se quizer usar assim, pode usar este aqui olha: \/ \/ \/ 1° - Vai em data\creaturescripts\scripts crie um arquivo com nome levelrecompense.lua e dentro dele adicione isto: function onAdvance(cid, oldLevel, newLevel) local text = "Parabens, " .. getCreatureName(cid) .. " você chegou ao level 2, recebera por recompensa 1kk + x de experiencia!!!" if getPlayerLevel(cid) >= 2 and getPlayerStorageValue(cid, 32647) <= 0 then doPlayerSendTextMessage(cid,19,text) doPlayerAddItem(cid,z,1) -- z coloca o id da moeda que vale 1kk doPlayerAddExp(cid,x) -- x coloca o tanto de exp que ele vai ganhar setPlayerStorageValue(cid, 32647, 1) end return true end 2º - Va em login.lua e adicione esta tag: registerCreatureEvent(cid, "levelrecompense") 3º - Por último vai em data\creaturescripts\creaturescripts.XML e adicione esta tag aqui: <event type="advance" name="levelrecompense" event="script" value="levelrecompense.lua"/> Créditos: 30% = Eu - GuhPk 70% = Snokiuthu - Criou o script Ajudei? Da REP+ aew. Editado Outubro 20, 2012 por GuhPk Link para o comentário https://xtibia.com/forum/topic/196961-galera-eu-gostaria-de-criar-um-npc-que-quando-o-player-upa-1-level-e-da-dinheiro-e-exp/#findComment-1367673 Compartilhar em outros sites More sharing options...
0 LeoTK 173 Postado Outubro 20, 2012 Autor Share Postado Outubro 20, 2012 amigo mais tipo eu queria que ganhase todo o lvl que upasse esse script e assim ou so quando pega o lvl 2? cara nao funfo nao eu coloquei certim o id e o exp mais pega lvl 2 e nao ganha amigo valeu +rep pra voce topico resolvi favor alguem reporta pra fechar Link para o comentário https://xtibia.com/forum/topic/196961-galera-eu-gostaria-de-criar-um-npc-que-quando-o-player-upa-1-level-e-da-dinheiro-e-exp/#findComment-1367726 Compartilhar em outros sites More sharing options...
0 GuhPk 111 Postado Outubro 20, 2012 Share Postado Outubro 20, 2012 (editado) Duvida sanada... Tópico reportado para que fechem e movam!!! De nada ai carinha, estou aqui para ajudar sempre. xD Script que ganha a grana e exp sempre que upar ta ai...!! ^^ Em data/actions/script copie 1 arquivo, renomeie ele para levelrecompense, apague tudo dentro dele e depois cole isso dentro dele: function onAdvance(cid, oldLevel, newLevel) doPlayerAddItem(cid, x, z) -- em x coloca o id do dinheiro e no z coloca o tanto que vai ganhar doPlayerAddExperience(cid, a) -- no a você coloca o tanto de experiencia que vai ganhar a cada level que o player passar return true end Depois em data/actions abra o actions.xml e adicione a tag: <event type="advance" name="levelrecompense" event="script" value="levelrecompense.lua"/> Editado Outubro 20, 2012 por GuhPk Link para o comentário https://xtibia.com/forum/topic/196961-galera-eu-gostaria-de-criar-um-npc-que-quando-o-player-upa-1-level-e-da-dinheiro-e-exp/#findComment-1367892 Compartilhar em outros sites More sharing options...
Pergunta
LeoTK 173
galera emtaum eu gostaria que o npc fosse assim eu sou o player upei do lvl 1 pro lvl 2 ai eu vo no npc e falo hi,yes e ele me da 1k e um poko de exp
aki ta a script mais nao consigo mudar ja tentei
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 1kk!!.')
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
Link para o comentário
https://xtibia.com/forum/topic/196961-galera-eu-gostaria-de-criar-um-npc-que-quando-o-player-upa-1-level-e-da-dinheiro-e-exp/Compartilhar em outros sites
3 respostass a esta questão
Posts Recomendados