Prezyoso 44 Postado Novembro 20, 2012 Share Postado Novembro 20, 2012 Link para o comentário https://xtibia.com/forum/topic/199345-erro-nos-npcs-quando-vou-abrir-o-ot-oq-fazer/ Compartilhar em outros sites More sharing options...
0 SkyLigh 453 Postado Novembro 20, 2012 Share Postado Novembro 20, 2012 poste os scripts deles . ddemon.lua fighter.lua reb1.lua Link para o comentário https://xtibia.com/forum/topic/199345-erro-nos-npcs-quando-vou-abrir-o-ot-oq-fazer/#findComment-1391448 Compartilhar em outros sites More sharing options...
0 Prezyoso 44 Postado Novembro 20, 2012 Autor Share Postado Novembro 20, 2012 Me ajuda em 1 apenas q eu faço com os outros, rsrs. Ta ae o do fighter: local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false 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') then selfSay('Hey Do you have 20 dino eye for me?') 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, 'yes') then if getPlayerStorageValue(cid,6021) == 1 then selfSay('Sorry You Cant Do this quest.') elseif msgcontains(msg, 'yes') then if doPlayerRemoveItem(cid,6543,20) == 0 then selfSay('Sorry Dont have that items.') else if doPlayerAddItem(cid,2395,1) then setPlayerStorageValue(cid,6021,1) selfSay('Thanks take this') focus = 0 talk_start = 0 end end end elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Good bye, ' .. getCreatureName(cid) .. '!') focus = 0 talk_start = 0 end end end function onThink() doNpcSetCreatureFocus(focus) if (os.clock() - talk_start) > 45 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 Link para o comentário https://xtibia.com/forum/topic/199345-erro-nos-npcs-quando-vou-abrir-o-ot-oq-fazer/#findComment-1391453 Compartilhar em outros sites More sharing options...
0 SkyLigh 453 Postado Novembro 20, 2012 Share Postado Novembro 20, 2012 . local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false 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') then selfSay('Hey Do you have 20 dino eye for me?') 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, 'yes') then if getPlayerStorageValue(cid,6021) == 1 then selfSay('Sorry You Cant Do this quest.') elseif msgcontains(msg, 'yes') then if doPlayerRemoveItem(cid,6543,20) == 0 then selfSay('Sorry Dont have that items.') else if doPlayerAddItem(cid,2395,1) then setPlayerStorageValue(cid,6021,1) selfSay('Thanks take this') focus = 0 talk_start = 0 end end end elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Good bye, ' .. getCreatureName(cid) .. '!') focus = 0 talk_start = 0 end end end function onThink() if (os.clock() - talk_start) > 45 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 veja agr Link para o comentário https://xtibia.com/forum/topic/199345-erro-nos-npcs-quando-vou-abrir-o-ot-oq-fazer/#findComment-1391457 Compartilhar em outros sites More sharing options...
0 Prezyoso 44 Postado Novembro 20, 2012 Autor Share Postado Novembro 20, 2012 To tentando resolver sozinho entao pode me dizer quais alterações vc fez? Seria melhor para eu aprender Link para o comentário https://xtibia.com/forum/topic/199345-erro-nos-npcs-quando-vou-abrir-o-ot-oq-fazer/#findComment-1391461 Compartilhar em outros sites More sharing options...
0 SkyLigh 453 Postado Novembro 20, 2012 Share Postado Novembro 20, 2012 Havia um erro em uma linha eu so dei uma alterada . nela que eu creio que podera funcionar se querer me passe eles por pm os outros que eu veja neles tbm . Link para o comentário https://xtibia.com/forum/topic/199345-erro-nos-npcs-quando-vou-abrir-o-ot-oq-fazer/#findComment-1391464 Compartilhar em outros sites More sharing options...
0 Prezyoso 44 Postado Novembro 20, 2012 Autor Share Postado Novembro 20, 2012 Ok, vou lhe passar Link para o comentário https://xtibia.com/forum/topic/199345-erro-nos-npcs-quando-vou-abrir-o-ot-oq-fazer/#findComment-1391467 Compartilhar em outros sites More sharing options...
0 Slicer 1070 Postado Novembro 21, 2012 Share Postado Novembro 21, 2012 o erro em si eh q tu n tem a funçao.. ;x doNpcSetCreatureFocus(focus) Link para o comentário https://xtibia.com/forum/topic/199345-erro-nos-npcs-quando-vou-abrir-o-ot-oq-fazer/#findComment-1391565 Compartilhar em outros sites More sharing options...
0 Prezyoso 44 Postado Novembro 21, 2012 Autor Share Postado Novembro 21, 2012 o erro em si eh q tu n tem a funçao.. ;x doNpcSetCreatureFocus(focus) Como eu adicionaria? Link para o comentário https://xtibia.com/forum/topic/199345-erro-nos-npcs-quando-vou-abrir-o-ot-oq-fazer/#findComment-1391846 Compartilhar em outros sites More sharing options...
0 Slicer 1070 Postado Novembro 21, 2012 Share Postado Novembro 21, 2012 ve se tem isso.. doNpcSetCreatureFocus = selfFocus em npc/lib/npc.lua Link para o comentário https://xtibia.com/forum/topic/199345-erro-nos-npcs-quando-vou-abrir-o-ot-oq-fazer/#findComment-1392009 Compartilhar em outros sites More sharing options...
0 Prezyoso 44 Postado Novembro 21, 2012 Autor Share Postado Novembro 21, 2012 Nao tem cara... -- get the distance to a creature function getDistanceToCreature(id) if id == 0 or id == nil then selfGotoIdle() end cx, cy, cz = creatureGetPosition(id) if cx == nil then return nil end sx, sy, sz = selfGetPosition() return math.max(math.abs(sx-cx), math.abs(sy-cy)) end -- do one step to reach position function moveToPosition(x,y,z) selfMoveTo(x, y, z) end -- do one step to reach creature function moveToCreature(id) if id == 0 or id == nil then selfGotoIdle() end tx,ty,tz=creatureGetPosition(id) if tx == nil then selfGotoIdle() else moveToPosition(tx, ty, tz) end end -- stop talking function selfGotoIdle() following = false attacking = false selfAttackCreature(0) target = 0 end -- getCount function by Jiddo function getCount(msg) b, e = string.find(msg, "%d+") if b == nil or e == nil then count = 1 else count = tonumber(string.sub(msg, b, e)) end if count > 2000 then count = 2000 end return count end -- buy an item function buy(cid, itemid, count, cost) cost = count*cost amount = count if doPlayerRemoveMoney(cid, cost) == 1 then if getItemStackable(itemid) then while count > 100 do doPlayerAddItem(cid, itemid, 100) count = count - 100 end doPlayerAddItem(cid, itemid, count) -- add the last items, if there is left else while count > 0 do doPlayerAddItem(cid, itemid, 1) count = count - 1 end end if amount <= 1 then selfSay('Here is your '.. getItemName(itemid) .. '!') else selfSay('Here are your '.. amount ..' '.. getItemName(itemid) .. 's!') end else selfSay('Sorry, you do not have enough money.') end end function buyFluidContainer(cid, itemid, count, cost, fluidtype) cost = count*cost amount = count if doPlayerRemoveMoney(cid, cost) == 1 then while count > 0 do doPlayerAddItem(cid, itemid, fluidtype) count = count - 1 end if amount <= 1 then selfSay('Here is your '.. getItemName(itemid) .. '!') else selfSay('Here are your '.. amount ..' '.. getItemName(itemid) .. 's!') end else selfSay('Sorry, you do not have enough money.') end end -- sell an item function sell(cid, itemid, count, cost) cost = count*cost if doPlayerRemoveItem(cid, itemid, count) == 1 then coins = math.floor(cost/10000) crystals = coins while coins > 100 do doPlayerAddItem(cid, 2160, 100) coins = coins - 100 end doPlayerAddItem(cid, 2160, coins) cost = cost - crystals*10000 coins = math.floor(cost/100) if coins > 0 then doPlayerAddItem(cid, 2152, coins) cost = cost - coins*100 end coins = cost if cost > 0 and cost < 100 then doPlayerAddItem(cid, 2148, coins) cost = cost - coins end if cost > 0 then selfSay('You couldn\'t retrieve '.. cost ..' gold pieces, please contact the admin.') end if count <= 1 then selfSay('Thanks for this '.. getItemName(itemid) .. '!') else selfSay('Thanks for these '.. count..' '.. getItemName(itemid) .. 's!') end else selfSay('Sorry, you do not have this item.') end end -- pay for anything? function pay(cid, cost) if doPlayerRemoveMoney(cid, cost) == 1 then return true else return false end end -- Travel player function travel(cid, x, y, z) destpos = {x = x, y = y, z = z} doTeleportThing(cid, destpos) 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 Link para o comentário https://xtibia.com/forum/topic/199345-erro-nos-npcs-quando-vou-abrir-o-ot-oq-fazer/#findComment-1392017 Compartilhar em outros sites More sharing options...
0 Slicer 1070 Postado Novembro 21, 2012 Share Postado Novembro 21, 2012 hã... entao adiciona ae em qlqr lugar.. ;x e q versao de serv tas usando Link para o comentário https://xtibia.com/forum/topic/199345-erro-nos-npcs-quando-vou-abrir-o-ot-oq-fazer/#findComment-1392029 Compartilhar em outros sites More sharing options...
0 Prezyoso 44 Postado Novembro 21, 2012 Autor Share Postado Novembro 21, 2012 8.54 a version do sv, tentarei colocar aqui. Link para o comentário https://xtibia.com/forum/topic/199345-erro-nos-npcs-quando-vou-abrir-o-ot-oq-fazer/#findComment-1392030 Compartilhar em outros sites More sharing options...
Pergunta
Prezyoso 44
Link para o comentário
https://xtibia.com/forum/topic/199345-erro-nos-npcs-quando-vou-abrir-o-ot-oq-fazer/Compartilhar em outros sites
12 respostass a esta questão
Posts Recomendados