XM

[Encerrado] Trocar sprite no cliente...

Por xmaster0, 20 de fev. de 2013 em Tópicos Sem Resposta

poke
dash
sprite
cliente
editar
rods
vara de pescar
ajudar
resolvido
45
5k
xmaster0X
20 de fevereiro de 2013 às 12:24

Galera eu criei 4 rods novas para meu serve, mais eu quero um npc que substitua a rod que ja vem no cliente por uma que eu criei e esse npc pedisse alguns itens em troca

 

ID dos itens: 4258 / 2458 so isso obrigado... quem ajudar rep++!

 

Obs: eu uso o dash advanced sem level by notle

Editado Fevereiro 20 por xmaster0

RoksasR
20 de fevereiro de 2013 às 12:36

Esses dois IDS são doque você criou? Quais sãso os IDS das outras?

xmaster0X
20 de fevereiro de 2013 às 12:40

Esses dois IDS são doque você criou? Quais sãso os IDS das outras?

 

ei pow esses ID são os itens que o npc vai pedir pra trocar a rod, os ids da rods são 12246,12247,12248 e 12249

RoksasR
20 de fevereiro de 2013 às 12:51

Ok, deixa eu ver se entendo, o player da os itens de ID

4258 / 2458

e recebe a nova rod?

xmaster0X
20 de fevereiro de 2013 às 12:56

Ok, deixa eu ver se entendo, o player da os itens de ID

4258 / 2458

e recebe a nova rod?

 

isso isso isso ... mesmo aí vai trocar a rod la do slot do client so isso

RoksasR
20 de fevereiro de 2013 às 13:10

vá em data/npc, crie uma arquivo chamado onerod.xml e adicione isso dentro:

 

<?xml version="1.0"?>

 

<npc name="One Rod" script="data/npc/scripts/onerod.lua" access="3" lookdir="1" walkinterval="2" speed="200">

<health now="1" max="1"/>

<look type="120" head="38" body="79" legs="107" feet="114"/>

</npc>

 

 

E em data/npc/scripts, crie um arquivo chamado onerod.lua e adicione isso dentro:

 

local focus = 0

local talk_start = 0

local target = 0

local following = false

local attacking = false

local addon_state = 0

 

function onThingMove(creature, thing, oldpos, oldstackpos)

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

selfSay('Olá ' .. getCreatureName(cid) .. '... eu troco items pela great rod!')

focus = cid

talk_start = os.clock()

 

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.')

 

elseif focus == cid then

talk_start = os.clock()

if msgcontains(msg, 'great') then

if doPlayerRemoveItem(cid,4258,1) == 1 then

doPlayerRemoveItem(cid,2458,1) == 1 then

doPlayerAddItem(cid, 12246, 1)

addon_state = 0

else

selfSay('Voce nao tem os items necessarios para trocar a rod!')

talk_start = 0

end

 

elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then

selfSay('Good bye, ' .. getCreatureName(cid) .. '! Come back soon..')

focus = 0

talk_start = 0

end

end

end

 

function onCreatureChangeOutfit(creature)

end

 

function onThink()

doNpcSetCreatureFocus(focus)

if (os.clock() - talk_start) > 30 then

if focus > 0 then

selfSay('Next Please...')

end

focus = 0

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 5 then

selfSay('Good bye then.')

focus = 0

end

end

end

 

 

Para o NPC aparecer basta entrar no GOD e falar /n One Rod

Ou colocá-lo no mapa!

Editado Fevereiro 20 por Roksas

xmaster0X
20 de fevereiro de 2013 às 14:23
vá em data/npc, crie uma arquivo chamado onerod.xml e adicione isso dentro:

 

E em data/npc/scripts, crie um arquivo chamado onerod.lua e adicione isso dentro:

local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false local addon_state = 0 function onThingMove(creature, thing, oldpos, oldstackpos) 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 selfSay('Olá ' .. getCreatureName(cid) .. '... eu troco items pela 'great rod'!') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'great rod') then if doPlayerRemoveItem(cid,4258,1) == 1 and doPlayerRemoveItem(cid,2458,1) == 1 then doPlayerAddItem(cid, 12246, 1) addon_state = 0 else selfSay('Voce nao tem os items necessarios para trocar a rod!') talk_start = 0 end elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Good bye, ' .. getCreatureName(cid) .. '! Come back soon..') focus = 0 talk_start = 0 end end end function onCreatureChangeOutfit(creature) end function onThink() doNpcSetCreatureFocus(focus) if (os.clock() - talk_start) > 30 then if focus > 0 then selfSay('Next Please...') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Good bye then.') focus = 0 end end end

Para o NPC aparecer basta entrar no GOD e falar /n One Rod Ou colocá-lo no mapa!

 

Deu esse erro

 

[20/02/2013 14:17:44] [Warning - Npc::loadFromXml] Cannot load npc file (data/npc/One Rod.xml).

[20/02/2013 14:17:44] Info: failed to load external entity "data/npc/One Rod.xml"

 

 

[20/02/2013 14:18:11] [Warning - Npc::loadFromXml] Cannot load npc file (data/npc/One rod.xml).

[20/02/2013 14:18:11] Info: failed to load external entity "data/npc/One rod.xml"

 

 

[20/02/2013 14:21:09] [Warning - Npc::loadFromXml] Cannot load npc file (data/npc/Myshelle.xml).

[20/02/2013 14:21:09] Info: failed to load external entity "data/npc/Myshelle.xml"

 

 

[20/02/2013 14:21:27] [Notice - Npc::Npc] NPC Name: One Rod - autowalk has been deprecated, use walkinterval.

[20/02/2013 14:21:27] [Error - LuaScriptInterface::loadFile] data/npc/scripts/onerod.lua:33: ')' expected near 'great'

[20/02/2013 14:21:27] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/onerod.lua

[20/02/2013 14:21:27] data/npc/scripts/onerod.lua:33: ')' expected near 'great'

[20/02/2013 14:21:36] [Warning - Npc::loadFromXml] Cannot load npc file (data/npc/onerod.xml.xml).

[20/02/2013 14:21:36] Info: failed to load external entity "data/npc/onerod.xml.xml"

RoksasR
20 de fevereiro de 2013 às 14:29

seguinte, você colocou One Rod.xml.xml

junte o onerod, e tire 1 .xml, ficando:

onerod.xml

 

@Agora no meu poost acima /\ eu editei os scripts, substitua-os

xmaster0X
20 de fevereiro de 2013 às 14:45

seguinte, você colocou One Rod.xml.xml

junte o onerod, e tire 1 .xml, ficando:

onerod.xml

 

@Agora no meu poost acima /\ eu editei os scripts, substitua-os

 

ok apareceu o npc, mas quando eu falo great rod, ele pega meu primeiro item e o segundo nao e nao me da nada....

RoksasR
20 de fevereiro de 2013 às 14:48

Eu tinha posto para falar "great" apenas, já arrumei para "great rod" e coloquei para remover e add items, havia feito errado ^^

xmaster0X
20 de fevereiro de 2013 às 15:06

Eu tinha posto para falar "great" apenas, já arrumei para "great rod" e coloquei para remover e add items, havia feito errado ^^

 

não ta acontecendo nada .... nao ta substituindi... vc ja testou isso?

 

Eu tinha posto para falar "great" apenas, já arrumei para "great rod" e coloquei para remover e add items, havia feito errado ^^

 

pow o script é assim eu quero que o player fale com o npc e ela troque a rod q ta no slot do cliente que é 12246 e quando ele der os itens pra npc ela substituisse aquela rod pela nova que seria 12247

 

e os itens que a npc iria pedir era 12239 e 11442 so isso....

RoksasR
20 de fevereiro de 2013 às 15:07

Algum erro no distro?

 

@EDIT

 

É que você tinha pedidos outros IDS, é isso, OK vou postar em segundos e você substitui

Editado Fevereiro 20 por Roksas

xmaster0X
20 de fevereiro de 2013 às 15:09

Algum erro no distro?

 

o npc pega o iten mais nao substitui,,,, vou verificar depois okk

RoksasR
20 de fevereiro de 2013 às 15:14

Cara, o ID do slot que ta a rod antiga é 12246? tem certeza? ela fica onde? no lugar do helmet, ring, aonde?

tenta assim entao

 

 

 

local focus = 0

local talk_start = 0

local target = 0

local following = false

local attacking = false

local addon_state = 0

 

function onThingMove(creature, thing, oldpos, oldstackpos)

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

selfSay('Olá ' .. getCreatureName(cid) .. '... eu troco items pela great rod!')

focus = cid

talk_start = os.clock()

 

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.')

 

elseif focus == cid then

talk_start = os.clock()

if msgcontains(msg, 'great') then

if doPlayerRemoveItem(cid,12239,1) == 1 then

doPlayerRemoveItem(cid,11442,1)

local bagss = getPlayerSlotItem(cid, 12246)

doAddContainerItem(bagss.uid, 12247, 1)

addon_state = 0

else

selfSay('Voce nao tem os items necessarios para trocar a rod!')

talk_start = 0

end

 

elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then

selfSay('Good bye, ' .. getCreatureName(cid) .. '! Come back soon..')

focus = 0

talk_start = 0

end

end

end

 

function onCreatureChangeOutfit(creature)

end

 

function onThink()

doNpcSetCreatureFocus(focus)

if (os.clock() - talk_start) > 30 then

if focus > 0 then

selfSay('Next Please...')

end

focus = 0

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 5 then

selfSay('Good bye then.')

focus = 0

end

end

end

 

Editado Fevereiro 20 por Roksas

xmaster0X
20 de fevereiro de 2013 às 21:52

Cara, o ID do slot que ta a rod antiga é 12246? tem certeza? ela fica onde? no lugar do helmet, ring, aonde?

tenta assim entao

 

 

 

local focus = 0

local talk_start = 0

local target = 0

local following = false

local attacking = false

local addon_state = 0

 

function onThingMove(creature, thing, oldpos, oldstackpos)

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

selfSay('Olá ' .. getCreatureName(cid) .. '... eu troco items pela great rod!')

focus = cid

talk_start = os.clock()

 

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.')

 

elseif focus == cid then

talk_start = os.clock()

if msgcontains(msg, 'great') then

if doPlayerRemoveItem(cid,12239,1) == 1 then

doPlayerRemoveItem(cid,11442,1)

local bagss = getPlayerSlotItem(cid, 12246)

doAddContainerItem(bagss.uid, 12247, 1)

addon_state = 0

else

selfSay('Voce nao tem os items necessarios para trocar a rod!')

talk_start = 0

end

 

elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then

selfSay('Good bye, ' .. getCreatureName(cid) .. '! Come back soon..')

focus = 0

talk_start = 0

end

end

end

 

function onCreatureChangeOutfit(creature)

end

 

function onThink()

doNpcSetCreatureFocus(focus)

if (os.clock() - talk_start) > 30 then

if focus > 0 then

selfSay('Next Please...')

end

focus = 0

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 5 then

selfSay('Good bye then.')

focus = 0

end

end

end

 

 

è poketiiba... mano nao tibia.... pokemon dash advanced....