Ir para conteúdo

MatheusGlad

Conde
  • Total de itens

    528
  • Registro em

  • Última visita

  • Dias Ganhos

    30

Histórico de Reputação

  1. Upvote
    MatheusGlad recebeu reputação de Bennyhappy em Npc Que Usa Outro Item Como Dinheiro   
    Bem, eu fiz algumas alteraçoes no Npc System para que isso fosse possivel, tambem fiz alteraçoes na source, porem as modificaçoes da source nao sao obrigatorias, porem para um otserver serio seria bem legal implementa-las.
     
    Video:


     
    Download dos arquivos ja modificados:
    Npc System Modified.rar
     
    Ou entao modifique voce mesmo.
     
    Entao vamos as alteraçoes:
     
    Vá em data\npc\lib\npcsystem, todas as alteraçoes serao nos arquivos desta pasta entao nao vou ficar falando o destino.
     
    npchandler.lua:
     
    Procure por:
     
    Em baixo adicione essa linha:
     
     
    Procure por:
     
    Substitua por:
     
     
    Procure por:
     
    Substitua por:
     
     
    Agora Procure por:
     
    Mude para:
     
     
    Procure por:
     
    Mude para:
     
     
    modules.lua:
     
    Procure por:
     
    Embaixo bote:
     
     
    Procure por:
     
    Substitua Toda a funçao por:

    function ShopModule:callbackOnBuy(cid, itemid, subType, amount, ignoreCap, inBackpacks, moneyId) local shopItem = nil if amount <= 0 or type(amount) ~= "number" then amount = 1 end for _, item in ipairs(self.npcHandler.shopItems) do if(item.id == itemid and item.subType == subType) then shopItem = item break end end if(shopItem == nil) then error("[shopModule.onBuy]", "Item not found on shopItems list") return false end if(shopItem.buy == -1) then error("[shopModule.onSell]", "Attempt to purchase an item which only sellable") return false end local backpack, totalCost = 1988, amount * shopItem.buy if(inBackpacks) then totalCost = not moneyId and (totalCost + (math.max(1, math.floor(amount / getContainerCapById(backpack))) * 20)) or totalCost end local parseInfo = { [TAG_PLAYERNAME] = getPlayerName(cid), [TAG_ITEMCOUNT] = amount, [TAG_TOTALCOST] = totalCost, [TAG_ITEMNAME] = shopItem.name, [TAG_MONEYNAME] = moneyId and getItemNameById(moneyId) or "gold" } if (not moneyId and getPlayerMoney(cid) < totalCost) or (moneyId and getPlayerItemCount(cid, moneyId) < totalCost) then local msg = self.npcHandler:getMessage(MESSAGE_NEEDMONEY) doPlayerSendCancel(cid, self.npcHandler:parseMessage(msg, parseInfo)) return false end local subType = shopItem.subType or 1 local a, b = doNpcSellItem(cid, itemid, amount, subType, ignoreCap, inBackpacks, backpack) if(a < amount) then local msgId = MESSAGE_NEEDMORESPACE if(a == 0) then msgId = MESSAGE_NEEDSPACE end local msg = self.npcHandler:getMessage(msgId) parseInfo[TAG_ITEMCOUNT] = a doPlayerSendCancel(cid, self.npcHandler:parseMessage(msg, parseInfo)) if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then self.npcHandler.talkStart[cid] = os.time() else self.npcHandler.talkStart = os.time() end if(a > 0) then if not moneyId then doPlayerRemoveMoney(cid, ((a * shopItem.buy) + (b * 20))) else doPlayerRemoveItem(cid, moneyId, ((a * shopItem.buy) + (b * 20))) end return true end return false end local msg = self.npcHandler:getMessage(MESSAGE_BOUGHT) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, self.npcHandler:parseMessage(msg, parseInfo)) if not moneyId then doPlayerRemoveMoney(cid, totalCost) else doPlayerRemoveItem(cid, moneyId, totalCost) end if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then self.npcHandler.talkStart[cid] = os.time() else self.npcHandler.talkStart = os.time() end return true end
     
     
    Agora procure por:
     
    Substitua toda a funçao por:

    function ShopModule:callbackOnSell(cid, itemid, subType, amount, ignoreCap, inBackpacks, moneyId) local shopItem = nil for _, item in ipairs(self.npcHandler.shopItems) do if(item.id == itemid and item.subType == subType) then shopItem = item break end end if(shopItem == nil) then error("[shopModule.onBuy]", "Item not found on shopItems list") return false end if(shopItem.sell == -1) then error("[shopModule.onSell]", "Attempt to sell an item which is only buyable") return false end local parseInfo = { [TAG_PLAYERNAME] = getPlayerName(cid), [TAG_ITEMCOUNT] = amount, [TAG_TOTALCOST] = amount * shopItem.sell, [TAG_ITEMNAME] = shopItem.name, [TAG_MONEYNAME] = moneyId and getItemNameById(moneyId) or "gold" } if(subType < 1 or getItemInfo(itemid).stackable) then subType = -1 end if(doPlayerRemoveItem(cid, itemid, amount, subType)) then local msg = self.npcHandler:getMessage(MESSAGE_SOLD) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, self.npcHandler:parseMessage(msg, parseInfo)) if not moneyId then doPlayerAddMoney(cid, amount * shopItem.sell) else doPlayerAddItem(cid, moneyId, amount * shopItem.sell) end if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then self.npcHandler.talkStart[cid] = os.time() else self.npcHandler.talkStart = os.time() end return true end local msg = self.npcHandler:getMessage(MESSAGE_NEEDITEM) doPlayerSendCancel(cid, self.npcHandler:parseMessage(msg, parseInfo)) if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then self.npcHandler.talkStart[cid] = os.time() else self.npcHandler.talkStart = os.time() end return false end
     
    npcsystem.lua:
     
    Procure por:
     
    Embaixo bote:
     
     
    Agora a parte em C++, lembrando nao é obrigatoria, é mais para uma questao de estetica:
     
    protocolgame.cpp:
     
    Obs: Isso soh ira funcionar com UMA MOEDA DIFERENTE! Voce pode editar para fazer funcionar com mais, porem tenha certeza que sabe o que esta fazendo.
     
    Procure pela funçao:
     
    Substitua toda ela por:

    void ProtocolGame::sendGoods(const ShopInfoList& shop) { NetworkMessage_ptr msg = getOutputBuffer(); if(msg) { TRACK_MESSAGE(msg); msg->AddByte(0x7B); std::string value; player->getStorage(97113, value); if (atoi(value.c_str()) != 1) { msg->AddU32(g_game.getMoney(player)); } else { msg->AddU32(player->__getItemTypeCount(9971)); } std::map<uint32_t, uint32_t> goodsMap; if(shop.size() >= 5) { for(ShopInfoList::const_iterator sit = shop.begin(); sit != shop.end(); ++sit) { if(sit->sellPrice < 0) continue; int8_t subType = -1; if(sit->subType) { const ItemType& it = Item::items[sit->itemId]; if(it.hasSubType() && !it.stackable) subType = sit->subType; } uint32_t count = player->__getItemTypeCount(sit->itemId, subType); if(count > 0) goodsMap[sit->itemId] = count; } } else { std::map<uint32_t, uint32_t> tmpMap; player->__getAllItemTypeCount(tmpMap); for(ShopInfoList::const_iterator sit = shop.begin(); sit != shop.end(); ++sit) { if(sit->sellPrice < 0) continue; int8_t subType = -1; if(sit->subType) { const ItemType& it = Item::items[sit->itemId]; if(it.hasSubType() && !it.stackable) subType = sit->subType; } if(subType != -1) { uint32_t count = player->__getItemTypeCount(sit->itemId, subType); if(count > 0) goodsMap[sit->itemId] = count; } else goodsMap[sit->itemId] = tmpMap[sit->itemId]; } } msg->AddByte(std::min(goodsMap.size(), (size_t)255)); std::map<uint32_t, uint32_t>::const_iterator it = goodsMap.begin(); for(uint32_t i = 0; it != goodsMap.end() && i < 255; ++it, ++i) { msg->AddItemId(it->first); msg->AddByte(std::min(it->second, (uint32_t)255)); } } }
     
    E na linha msg->AddU32(player->__getItemTypeCount(9971)); aonde esta 9971 voce troca pelo id da sua moeda diferente!
     
     
    player.cpp:
     
    Procure por:
     
    Voce achara 2 desses em ambos bote isso embaixo:
     
    Pronto agora para que um npc use a moeda diferente ou nao voce bota isso no XML dele:
     
    Flw
  2. Upvote
    MatheusGlad deu reputação a caotic em Lib - O que é ela e como usar.   
    A pasta lib se encontra no seu otserv ele e ultilizada para a criação de funções ultilizando a propria linguagem LUA.
    Apos feita a função ele pode ser ultilizada em qualquer localidade em seu otserv.
    Para ultilizar deve ser criado um arquivo lua com os codigos das funçoes.
     
    Um exemplo de uma função
     

    function doPlayerAddStorage(cid) setPlayerStorageValue(cid, 22221, 1) return true end
     
    Nesta função adicionara a o valor 1 na storage 22221 e se fosse ultilizada por exemplo em actions executaria tal ação.
     
    Segue a estrutura
     

    function NOME DA FUNÇÃO(parâmetros) ... AÇÃO RETORNO TERMINIO DA FUNÇÃO
     
    Outro exemplo ultilizando um proprio parâmetros
     

    function doPlayerSummon(monster, pos) doSummonCreature(monster, pos) return true end
     
    Aqui uma função que sumona um monstro seguida pelo parâmetros nome do monstro e a posição.
     
    Para adicionar o paramento deve ser usado dentro de uma função o nome do parâmetros eclarado
     
    Exemplo
     

    function doPlayerSendMsg(cid, msg) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, msg) return true end
     
    Nela adicionamos o parâmetros msg se usamos a função
     
     
     
    A funçao que usa o parâmetros ficaria tal
     
     
     
     
     
    Ou seja se quisemos alterar o parâmetros cid para para usar a função
     
     
     
    Ficaria tal
     

    doPlayerSendTextMessage(param, MESSAGE_STATUS_CONSOLE_BLUE, msg)
     
    Para criar funçoes de verificaçoes
    Precisamos retonar o valor que queremos.

    function getPlayerPositionPz(cid) local pz = getTilePzInfo(getCreaturePosition(cid)) return pz end
     
    Como nesta que retornos o local pz mais se quisermos nos poderiamos ultilizar de tal maneira.

    function getPlayerPositionPz(cid) return getTilePzInfo(getCreaturePosition(cid)) end
     
    Depos poderemos usar verificaçoes como
     

    if getPlayerPositionPz(cid) then
     
     
    E isto gente tomara que aprenderam tudo obrigado a todos
     
    Ate mais
  3. Upvote
    MatheusGlad recebeu reputação de Demonbholder em Npc Que Usa Outro Item Como Dinheiro   
    Bem, eu fiz algumas alteraçoes no Npc System para que isso fosse possivel, tambem fiz alteraçoes na source, porem as modificaçoes da source nao sao obrigatorias, porem para um otserver serio seria bem legal implementa-las.
     
    Video:


     
    Download dos arquivos ja modificados:
    Npc System Modified.rar
     
    Ou entao modifique voce mesmo.
     
    Entao vamos as alteraçoes:
     
    Vá em data\npc\lib\npcsystem, todas as alteraçoes serao nos arquivos desta pasta entao nao vou ficar falando o destino.
     
    npchandler.lua:
     
    Procure por:
     
    Em baixo adicione essa linha:
     
     
    Procure por:
     
    Substitua por:
     
     
    Procure por:
     
    Substitua por:
     
     
    Agora Procure por:
     
    Mude para:
     
     
    Procure por:
     
    Mude para:
     
     
    modules.lua:
     
    Procure por:
     
    Embaixo bote:
     
     
    Procure por:
     
    Substitua Toda a funçao por:

    function ShopModule:callbackOnBuy(cid, itemid, subType, amount, ignoreCap, inBackpacks, moneyId) local shopItem = nil if amount <= 0 or type(amount) ~= "number" then amount = 1 end for _, item in ipairs(self.npcHandler.shopItems) do if(item.id == itemid and item.subType == subType) then shopItem = item break end end if(shopItem == nil) then error("[shopModule.onBuy]", "Item not found on shopItems list") return false end if(shopItem.buy == -1) then error("[shopModule.onSell]", "Attempt to purchase an item which only sellable") return false end local backpack, totalCost = 1988, amount * shopItem.buy if(inBackpacks) then totalCost = not moneyId and (totalCost + (math.max(1, math.floor(amount / getContainerCapById(backpack))) * 20)) or totalCost end local parseInfo = { [TAG_PLAYERNAME] = getPlayerName(cid), [TAG_ITEMCOUNT] = amount, [TAG_TOTALCOST] = totalCost, [TAG_ITEMNAME] = shopItem.name, [TAG_MONEYNAME] = moneyId and getItemNameById(moneyId) or "gold" } if (not moneyId and getPlayerMoney(cid) < totalCost) or (moneyId and getPlayerItemCount(cid, moneyId) < totalCost) then local msg = self.npcHandler:getMessage(MESSAGE_NEEDMONEY) doPlayerSendCancel(cid, self.npcHandler:parseMessage(msg, parseInfo)) return false end local subType = shopItem.subType or 1 local a, b = doNpcSellItem(cid, itemid, amount, subType, ignoreCap, inBackpacks, backpack) if(a < amount) then local msgId = MESSAGE_NEEDMORESPACE if(a == 0) then msgId = MESSAGE_NEEDSPACE end local msg = self.npcHandler:getMessage(msgId) parseInfo[TAG_ITEMCOUNT] = a doPlayerSendCancel(cid, self.npcHandler:parseMessage(msg, parseInfo)) if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then self.npcHandler.talkStart[cid] = os.time() else self.npcHandler.talkStart = os.time() end if(a > 0) then if not moneyId then doPlayerRemoveMoney(cid, ((a * shopItem.buy) + (b * 20))) else doPlayerRemoveItem(cid, moneyId, ((a * shopItem.buy) + (b * 20))) end return true end return false end local msg = self.npcHandler:getMessage(MESSAGE_BOUGHT) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, self.npcHandler:parseMessage(msg, parseInfo)) if not moneyId then doPlayerRemoveMoney(cid, totalCost) else doPlayerRemoveItem(cid, moneyId, totalCost) end if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then self.npcHandler.talkStart[cid] = os.time() else self.npcHandler.talkStart = os.time() end return true end
     
     
    Agora procure por:
     
    Substitua toda a funçao por:

    function ShopModule:callbackOnSell(cid, itemid, subType, amount, ignoreCap, inBackpacks, moneyId) local shopItem = nil for _, item in ipairs(self.npcHandler.shopItems) do if(item.id == itemid and item.subType == subType) then shopItem = item break end end if(shopItem == nil) then error("[shopModule.onBuy]", "Item not found on shopItems list") return false end if(shopItem.sell == -1) then error("[shopModule.onSell]", "Attempt to sell an item which is only buyable") return false end local parseInfo = { [TAG_PLAYERNAME] = getPlayerName(cid), [TAG_ITEMCOUNT] = amount, [TAG_TOTALCOST] = amount * shopItem.sell, [TAG_ITEMNAME] = shopItem.name, [TAG_MONEYNAME] = moneyId and getItemNameById(moneyId) or "gold" } if(subType < 1 or getItemInfo(itemid).stackable) then subType = -1 end if(doPlayerRemoveItem(cid, itemid, amount, subType)) then local msg = self.npcHandler:getMessage(MESSAGE_SOLD) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, self.npcHandler:parseMessage(msg, parseInfo)) if not moneyId then doPlayerAddMoney(cid, amount * shopItem.sell) else doPlayerAddItem(cid, moneyId, amount * shopItem.sell) end if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then self.npcHandler.talkStart[cid] = os.time() else self.npcHandler.talkStart = os.time() end return true end local msg = self.npcHandler:getMessage(MESSAGE_NEEDITEM) doPlayerSendCancel(cid, self.npcHandler:parseMessage(msg, parseInfo)) if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then self.npcHandler.talkStart[cid] = os.time() else self.npcHandler.talkStart = os.time() end return false end
     
    npcsystem.lua:
     
    Procure por:
     
    Embaixo bote:
     
     
    Agora a parte em C++, lembrando nao é obrigatoria, é mais para uma questao de estetica:
     
    protocolgame.cpp:
     
    Obs: Isso soh ira funcionar com UMA MOEDA DIFERENTE! Voce pode editar para fazer funcionar com mais, porem tenha certeza que sabe o que esta fazendo.
     
    Procure pela funçao:
     
    Substitua toda ela por:

    void ProtocolGame::sendGoods(const ShopInfoList& shop) { NetworkMessage_ptr msg = getOutputBuffer(); if(msg) { TRACK_MESSAGE(msg); msg->AddByte(0x7B); std::string value; player->getStorage(97113, value); if (atoi(value.c_str()) != 1) { msg->AddU32(g_game.getMoney(player)); } else { msg->AddU32(player->__getItemTypeCount(9971)); } std::map<uint32_t, uint32_t> goodsMap; if(shop.size() >= 5) { for(ShopInfoList::const_iterator sit = shop.begin(); sit != shop.end(); ++sit) { if(sit->sellPrice < 0) continue; int8_t subType = -1; if(sit->subType) { const ItemType& it = Item::items[sit->itemId]; if(it.hasSubType() && !it.stackable) subType = sit->subType; } uint32_t count = player->__getItemTypeCount(sit->itemId, subType); if(count > 0) goodsMap[sit->itemId] = count; } } else { std::map<uint32_t, uint32_t> tmpMap; player->__getAllItemTypeCount(tmpMap); for(ShopInfoList::const_iterator sit = shop.begin(); sit != shop.end(); ++sit) { if(sit->sellPrice < 0) continue; int8_t subType = -1; if(sit->subType) { const ItemType& it = Item::items[sit->itemId]; if(it.hasSubType() && !it.stackable) subType = sit->subType; } if(subType != -1) { uint32_t count = player->__getItemTypeCount(sit->itemId, subType); if(count > 0) goodsMap[sit->itemId] = count; } else goodsMap[sit->itemId] = tmpMap[sit->itemId]; } } msg->AddByte(std::min(goodsMap.size(), (size_t)255)); std::map<uint32_t, uint32_t>::const_iterator it = goodsMap.begin(); for(uint32_t i = 0; it != goodsMap.end() && i < 255; ++it, ++i) { msg->AddItemId(it->first); msg->AddByte(std::min(it->second, (uint32_t)255)); } } }
     
    E na linha msg->AddU32(player->__getItemTypeCount(9971)); aonde esta 9971 voce troca pelo id da sua moeda diferente!
     
     
    player.cpp:
     
    Procure por:
     
    Voce achara 2 desses em ambos bote isso embaixo:
     
    Pronto agora para que um npc use a moeda diferente ou nao voce bota isso no XML dele:
     
    Flw
  4. Upvote
    MatheusGlad recebeu reputação de jhon992 em Npc Que Usa Outro Item Como Dinheiro   
    Bem, eu fiz algumas alteraçoes no Npc System para que isso fosse possivel, tambem fiz alteraçoes na source, porem as modificaçoes da source nao sao obrigatorias, porem para um otserver serio seria bem legal implementa-las.
     
    Video:


     
    Download dos arquivos ja modificados:
    Npc System Modified.rar
     
    Ou entao modifique voce mesmo.
     
    Entao vamos as alteraçoes:
     
    Vá em data\npc\lib\npcsystem, todas as alteraçoes serao nos arquivos desta pasta entao nao vou ficar falando o destino.
     
    npchandler.lua:
     
    Procure por:
     
    Em baixo adicione essa linha:
     
     
    Procure por:
     
    Substitua por:
     
     
    Procure por:
     
    Substitua por:
     
     
    Agora Procure por:
     
    Mude para:
     
     
    Procure por:
     
    Mude para:
     
     
    modules.lua:
     
    Procure por:
     
    Embaixo bote:
     
     
    Procure por:
     
    Substitua Toda a funçao por:

    function ShopModule:callbackOnBuy(cid, itemid, subType, amount, ignoreCap, inBackpacks, moneyId) local shopItem = nil if amount <= 0 or type(amount) ~= "number" then amount = 1 end for _, item in ipairs(self.npcHandler.shopItems) do if(item.id == itemid and item.subType == subType) then shopItem = item break end end if(shopItem == nil) then error("[shopModule.onBuy]", "Item not found on shopItems list") return false end if(shopItem.buy == -1) then error("[shopModule.onSell]", "Attempt to purchase an item which only sellable") return false end local backpack, totalCost = 1988, amount * shopItem.buy if(inBackpacks) then totalCost = not moneyId and (totalCost + (math.max(1, math.floor(amount / getContainerCapById(backpack))) * 20)) or totalCost end local parseInfo = { [TAG_PLAYERNAME] = getPlayerName(cid), [TAG_ITEMCOUNT] = amount, [TAG_TOTALCOST] = totalCost, [TAG_ITEMNAME] = shopItem.name, [TAG_MONEYNAME] = moneyId and getItemNameById(moneyId) or "gold" } if (not moneyId and getPlayerMoney(cid) < totalCost) or (moneyId and getPlayerItemCount(cid, moneyId) < totalCost) then local msg = self.npcHandler:getMessage(MESSAGE_NEEDMONEY) doPlayerSendCancel(cid, self.npcHandler:parseMessage(msg, parseInfo)) return false end local subType = shopItem.subType or 1 local a, b = doNpcSellItem(cid, itemid, amount, subType, ignoreCap, inBackpacks, backpack) if(a < amount) then local msgId = MESSAGE_NEEDMORESPACE if(a == 0) then msgId = MESSAGE_NEEDSPACE end local msg = self.npcHandler:getMessage(msgId) parseInfo[TAG_ITEMCOUNT] = a doPlayerSendCancel(cid, self.npcHandler:parseMessage(msg, parseInfo)) if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then self.npcHandler.talkStart[cid] = os.time() else self.npcHandler.talkStart = os.time() end if(a > 0) then if not moneyId then doPlayerRemoveMoney(cid, ((a * shopItem.buy) + (b * 20))) else doPlayerRemoveItem(cid, moneyId, ((a * shopItem.buy) + (b * 20))) end return true end return false end local msg = self.npcHandler:getMessage(MESSAGE_BOUGHT) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, self.npcHandler:parseMessage(msg, parseInfo)) if not moneyId then doPlayerRemoveMoney(cid, totalCost) else doPlayerRemoveItem(cid, moneyId, totalCost) end if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then self.npcHandler.talkStart[cid] = os.time() else self.npcHandler.talkStart = os.time() end return true end
     
     
    Agora procure por:
     
    Substitua toda a funçao por:

    function ShopModule:callbackOnSell(cid, itemid, subType, amount, ignoreCap, inBackpacks, moneyId) local shopItem = nil for _, item in ipairs(self.npcHandler.shopItems) do if(item.id == itemid and item.subType == subType) then shopItem = item break end end if(shopItem == nil) then error("[shopModule.onBuy]", "Item not found on shopItems list") return false end if(shopItem.sell == -1) then error("[shopModule.onSell]", "Attempt to sell an item which is only buyable") return false end local parseInfo = { [TAG_PLAYERNAME] = getPlayerName(cid), [TAG_ITEMCOUNT] = amount, [TAG_TOTALCOST] = amount * shopItem.sell, [TAG_ITEMNAME] = shopItem.name, [TAG_MONEYNAME] = moneyId and getItemNameById(moneyId) or "gold" } if(subType < 1 or getItemInfo(itemid).stackable) then subType = -1 end if(doPlayerRemoveItem(cid, itemid, amount, subType)) then local msg = self.npcHandler:getMessage(MESSAGE_SOLD) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, self.npcHandler:parseMessage(msg, parseInfo)) if not moneyId then doPlayerAddMoney(cid, amount * shopItem.sell) else doPlayerAddItem(cid, moneyId, amount * shopItem.sell) end if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then self.npcHandler.talkStart[cid] = os.time() else self.npcHandler.talkStart = os.time() end return true end local msg = self.npcHandler:getMessage(MESSAGE_NEEDITEM) doPlayerSendCancel(cid, self.npcHandler:parseMessage(msg, parseInfo)) if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then self.npcHandler.talkStart[cid] = os.time() else self.npcHandler.talkStart = os.time() end return false end
     
    npcsystem.lua:
     
    Procure por:
     
    Embaixo bote:
     
     
    Agora a parte em C++, lembrando nao é obrigatoria, é mais para uma questao de estetica:
     
    protocolgame.cpp:
     
    Obs: Isso soh ira funcionar com UMA MOEDA DIFERENTE! Voce pode editar para fazer funcionar com mais, porem tenha certeza que sabe o que esta fazendo.
     
    Procure pela funçao:
     
    Substitua toda ela por:

    void ProtocolGame::sendGoods(const ShopInfoList& shop) { NetworkMessage_ptr msg = getOutputBuffer(); if(msg) { TRACK_MESSAGE(msg); msg->AddByte(0x7B); std::string value; player->getStorage(97113, value); if (atoi(value.c_str()) != 1) { msg->AddU32(g_game.getMoney(player)); } else { msg->AddU32(player->__getItemTypeCount(9971)); } std::map<uint32_t, uint32_t> goodsMap; if(shop.size() >= 5) { for(ShopInfoList::const_iterator sit = shop.begin(); sit != shop.end(); ++sit) { if(sit->sellPrice < 0) continue; int8_t subType = -1; if(sit->subType) { const ItemType& it = Item::items[sit->itemId]; if(it.hasSubType() && !it.stackable) subType = sit->subType; } uint32_t count = player->__getItemTypeCount(sit->itemId, subType); if(count > 0) goodsMap[sit->itemId] = count; } } else { std::map<uint32_t, uint32_t> tmpMap; player->__getAllItemTypeCount(tmpMap); for(ShopInfoList::const_iterator sit = shop.begin(); sit != shop.end(); ++sit) { if(sit->sellPrice < 0) continue; int8_t subType = -1; if(sit->subType) { const ItemType& it = Item::items[sit->itemId]; if(it.hasSubType() && !it.stackable) subType = sit->subType; } if(subType != -1) { uint32_t count = player->__getItemTypeCount(sit->itemId, subType); if(count > 0) goodsMap[sit->itemId] = count; } else goodsMap[sit->itemId] = tmpMap[sit->itemId]; } } msg->AddByte(std::min(goodsMap.size(), (size_t)255)); std::map<uint32_t, uint32_t>::const_iterator it = goodsMap.begin(); for(uint32_t i = 0; it != goodsMap.end() && i < 255; ++it, ++i) { msg->AddItemId(it->first); msg->AddByte(std::min(it->second, (uint32_t)255)); } } }
     
    E na linha msg->AddU32(player->__getItemTypeCount(9971)); aonde esta 9971 voce troca pelo id da sua moeda diferente!
     
     
    player.cpp:
     
    Procure por:
     
    Voce achara 2 desses em ambos bote isso embaixo:
     
    Pronto agora para que um npc use a moeda diferente ou nao voce bota isso no XML dele:
     
    Flw
  5. Upvote
    MatheusGlad recebeu reputação de Luucas07 em Npc Que Teleporta Se Vc Tiver X Item   
    Bem eu nao sabia se era pra viajar e tirar o item ou se era pra viajar so se voce tivesse o item mas nao removesse, caso nao seja isso que voce queira me fale que eu tiro.
     
    Va em npc/scripts e crie um arquivo itemtravel.lua e bote isto dentro:

    local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local pos = {x=152,y=58,z=7} -------------- Pos para onde o player sera levado local itemid = 2468 ----------------- Id do item que vai ser removido do player function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end if msgcontains(msg, "offer") or msgcontains(msg, "help") then selfSay("Eu posso te levar a TAL lugar por um "..getItemNameById(itemid).." item, fale {travel} se quizer viajar.", cid) talkState[cid] = 0 elseif msgcontains(msg, 'travel') then if doPlayerRemoveItem(cid, itemid, 1) then selfSay("Boa viagem.", cid) doTeleportThing(cid, pos) else selfSay("Voce nao tem o item nescessario.", cid) end end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
     
    Depois crie um arquivo NOMEDONPC.lua e bote isto dentro:

    <npc name="NOMEDONPC" script="data/npc/scripts/itemtravel.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="134" head="78" body="88" legs="0" feet="88" addons="3"/> <parameters> <parameter key="message_greet" value="Ola. Para mais informacoes de meus servicos diga {offer}." /> <parameter key="message_farewell" value="Tchau." /> <parameter key="message_walkaway" value="Tchau." /> </parameters> </npc>
     
    NAO SE ESQUEÇA DE CONFIGURAR O LOCAL E O ITEMID NO SCRIPT....
     
    flw
  6. Upvote
    MatheusGlad recebeu reputação de edu6279 em Barco Que Anda Por Uma Rota.   
    Preview:


     
    Va na pasta mod crie um arquivo XML com o nome de boatsystem e bote isso:

    <?xml version="1.0" encoding="UTF-8"?> <mod name="BoatSystem" enabled="yes" author="MatheusMkalo" forum="XTibia.com"> <config name="BoatSystemLib"><![CDATA[ mydirs= { [1] = {type = 1, ids = {3587, 3590, 3591}, xy = {0, -1}}, [2] = {type = 2, ids = {3592, 3595, 3596}, xy = {1, 0}}, [3] = {type = 1, ids = {3587, 3590, 3591}, xy = {0, 1}}, [4] = {type = 2, ids = {3592, 3595, 3596}, xy = {-1, 0}} } allids = {3587, 3590, 3591, 3592, 3595, 3596} function newEndb(endb, dir) local xx = endb.x local yy = endb.y for i = 1, #dir do xx = xx+mydirs[dir[i]].xy[1] yy = yy+mydirs[dir[i]].xy[2] end return {x=xx, y=yy, z=endb.z} end function doMoveBoat(post, dir, cid) local newboat = {} for i,s in ipairs(post) do local backu = getThingPos(s) doRemoveItem(s, 1) doCreateItem(mydirs[dir].ids[i], 1, {x=backu.x+mydirs[dir].xy[1], y=backu.y+mydirs[dir].xy[2], z=backu.z}) table.insert(newboat, getThingFromPos({x=backu.x+mydirs[dir].xy[1], y=backu.y+mydirs[dir].xy[2], z=backu.z, stackpos=1}).uid) end if mydirs[dir].type ~= post.type and mydirs[dir].type == 1 then doCreateItem(getThing(newboat[1]).itemid, 1, {x=getThingPos(newboat[1]).x+1, y=getThingPos(newboat[1]).y-1, z=getThingPos(newboat[1]).z}) doRemoveItem(newboat[1], 1) doCreateItem(getThing(newboat[3]).itemid, 1, {x=getThingPos(newboat[3]).x-1, y=getThingPos(newboat[3]).y+1, z=getThingPos(newboat[3]).z}) doRemoveItem(newboat[3], 1) elseif mydirs[dir].type ~= post.type and mydirs[dir].type == 2 then doCreateItem(getThing(newboat[1]).itemid, 1, {x=getThingPos(newboat[1]).x-1, y=getThingPos(newboat[1]).y+1, z=getThingPos(newboat[1]).z}) doRemoveItem(newboat[1], 1) doCreateItem(getThing(newboat[3]).itemid, 1, {x=getThingPos(newboat[3]).x+1, y=getThingPos(newboat[3]).y-1, z=getThingPos(newboat[3]).z}) doRemoveItem(newboat[3], 1) end if cid then doTeleportThing(cid, {x=getCreaturePosition(cid).x+mydirs[dir].xy[1], y=getCreaturePosition(cid).y+mydirs[dir].xy[2], z=getCreaturePosition(cid).z}, false) end end function getPosBoat(cid, pos) local pcid = not pos and getCreaturePosition(cid) or pos local check = getThingFromPos({x=pcid.x, y=pcid.y, z=pcid.z, stackpos=1}).itemid == mydirs[1].ids[2] and 1 or 2 if check == 1 then return {getThingFromPos({x=pcid.x, y=pcid.y-1, z=pcid.z, stackpos=1}).uid, getThingFromPos({x=pcid.x, y=pcid.y, z=pcid.z, stackpos=1}).uid, getThingFromPos({x=pcid.x, y=pcid.y+1, z=pcid.z, stackpos=1}).uid, type = check} elseif check == 2 then return {getThingFromPos({x=pcid.x-1, y=pcid.y, z=pcid.z, stackpos=1}).uid, getThingFromPos({x=pcid.x, y=pcid.y, z=pcid.z, stackpos=1}).uid, getThingFromPos({x=pcid.x+1, y=pcid.y, z=pcid.z, stackpos=1}).uid, type = check} end return false end function reverse(t) local result = {} for i = #t, 1, -1 do table.insert(result, t[i] == 1 and 3 or t[i] == 2 and 4 or t[i] == 3 and 1 or t[i] == 4 and 2) end return result end ]]></config> <movevent type="StepIn" actionid="6616" event="script"><![CDATA[ domodlib("BoatSystemLib") local t = {4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} local postart = {x=968, y=1001, z=7, stackpos=1} local posback = {x=994, y=978, z=7, stackpos=1} local delay = 350 if toPosition.x == posback.x and toPosition.y == posback.y then doCreatureSetNoMove(cid, true) for i = 1, #reverse(t) do addEvent(function() doMoveBoat(getPosBoat(cid), reverse(t)[i], cid) end, i*delay) end addEvent(doCreatureSetNoMove, delay*#reverse(t)+100, cid, false) addEvent(function() doItemSetAttribute(getThingFromPos(postart).uid, "aid", 6616) end, delay*#t+100) elseif toPosition.x == postart.x and toPosition.y == postart.y then doCreatureSetNoMove(cid, true) for i = 1, #t do addEvent(function() doMoveBoat(getPosBoat(cid), t[i], cid) end, i*delay) end addEvent(doCreatureSetNoMove, delay*#t+100, cid, false) addEvent(function() doItemSetAttribute(getThingFromPos(posback).uid, "aid", 6616) end, delay*#t+100) end ]]></movevent> <movevent type="StepIn" actionid="6617" event="script"><![CDATA[ domodlib("BoatSystemLib") if not isInArray(allids, getThingFromPos({x=toPosition.x, y=toPosition.y, z=toPosition.z, stackpos=1}).itemid) then doTeleportThing(cid, fromPosition, false) end ]]></movevent> </mod>
     
    Agora configurando o script:
     
     
    No local t, sao todas as direçoes que o barco vai andar, em sentido horario:
    1 = norte
    2 = leste
    3 = sul
    4 = oeste
     
    No local postart eh a posiçao que o meio do barco vai estar quando ele estiver indo para algum lugar.
    No local posback eh a posiçao que o meio do barco vai estar quando ele estiver voltando.
     
    O delay eh o tempo em milesegundos que demora pra o barco andar.
     
    Adicionando no Map editor:
     
    Faça 3 sqms do id 4820.
    Adicione o actionid 6617 nesses sqms.
    Faça 3 ids de barco, voce escolhe se eh o virado para cima ou para o lado.
    Bote o actionid 6616 no meio do barco.
     
    Fica assim:

    O vermemlho indica que tem o id 4820 e o actionid 6617.
     

    O verde indica o actionid 6616
     
    Na pos que ele vai chegar soh faça o negocio na agua, nao precisa fazer outro bote.
     
    OBS: PONHA OS SQMS DA ROTA PARA NAO PODER LOGA SE ALGUEM LOGA NO BARCO VAI DAR BUG
  7. Upvote
    MatheusGlad recebeu reputação de Miinerva em Barco Que Anda Por Uma Rota.   
    Preview:


     
    Va na pasta mod crie um arquivo XML com o nome de boatsystem e bote isso:

    <?xml version="1.0" encoding="UTF-8"?> <mod name="BoatSystem" enabled="yes" author="MatheusMkalo" forum="XTibia.com"> <config name="BoatSystemLib"><![CDATA[ mydirs= { [1] = {type = 1, ids = {3587, 3590, 3591}, xy = {0, -1}}, [2] = {type = 2, ids = {3592, 3595, 3596}, xy = {1, 0}}, [3] = {type = 1, ids = {3587, 3590, 3591}, xy = {0, 1}}, [4] = {type = 2, ids = {3592, 3595, 3596}, xy = {-1, 0}} } allids = {3587, 3590, 3591, 3592, 3595, 3596} function newEndb(endb, dir) local xx = endb.x local yy = endb.y for i = 1, #dir do xx = xx+mydirs[dir[i]].xy[1] yy = yy+mydirs[dir[i]].xy[2] end return {x=xx, y=yy, z=endb.z} end function doMoveBoat(post, dir, cid) local newboat = {} for i,s in ipairs(post) do local backu = getThingPos(s) doRemoveItem(s, 1) doCreateItem(mydirs[dir].ids[i], 1, {x=backu.x+mydirs[dir].xy[1], y=backu.y+mydirs[dir].xy[2], z=backu.z}) table.insert(newboat, getThingFromPos({x=backu.x+mydirs[dir].xy[1], y=backu.y+mydirs[dir].xy[2], z=backu.z, stackpos=1}).uid) end if mydirs[dir].type ~= post.type and mydirs[dir].type == 1 then doCreateItem(getThing(newboat[1]).itemid, 1, {x=getThingPos(newboat[1]).x+1, y=getThingPos(newboat[1]).y-1, z=getThingPos(newboat[1]).z}) doRemoveItem(newboat[1], 1) doCreateItem(getThing(newboat[3]).itemid, 1, {x=getThingPos(newboat[3]).x-1, y=getThingPos(newboat[3]).y+1, z=getThingPos(newboat[3]).z}) doRemoveItem(newboat[3], 1) elseif mydirs[dir].type ~= post.type and mydirs[dir].type == 2 then doCreateItem(getThing(newboat[1]).itemid, 1, {x=getThingPos(newboat[1]).x-1, y=getThingPos(newboat[1]).y+1, z=getThingPos(newboat[1]).z}) doRemoveItem(newboat[1], 1) doCreateItem(getThing(newboat[3]).itemid, 1, {x=getThingPos(newboat[3]).x+1, y=getThingPos(newboat[3]).y-1, z=getThingPos(newboat[3]).z}) doRemoveItem(newboat[3], 1) end if cid then doTeleportThing(cid, {x=getCreaturePosition(cid).x+mydirs[dir].xy[1], y=getCreaturePosition(cid).y+mydirs[dir].xy[2], z=getCreaturePosition(cid).z}, false) end end function getPosBoat(cid, pos) local pcid = not pos and getCreaturePosition(cid) or pos local check = getThingFromPos({x=pcid.x, y=pcid.y, z=pcid.z, stackpos=1}).itemid == mydirs[1].ids[2] and 1 or 2 if check == 1 then return {getThingFromPos({x=pcid.x, y=pcid.y-1, z=pcid.z, stackpos=1}).uid, getThingFromPos({x=pcid.x, y=pcid.y, z=pcid.z, stackpos=1}).uid, getThingFromPos({x=pcid.x, y=pcid.y+1, z=pcid.z, stackpos=1}).uid, type = check} elseif check == 2 then return {getThingFromPos({x=pcid.x-1, y=pcid.y, z=pcid.z, stackpos=1}).uid, getThingFromPos({x=pcid.x, y=pcid.y, z=pcid.z, stackpos=1}).uid, getThingFromPos({x=pcid.x+1, y=pcid.y, z=pcid.z, stackpos=1}).uid, type = check} end return false end function reverse(t) local result = {} for i = #t, 1, -1 do table.insert(result, t[i] == 1 and 3 or t[i] == 2 and 4 or t[i] == 3 and 1 or t[i] == 4 and 2) end return result end ]]></config> <movevent type="StepIn" actionid="6616" event="script"><![CDATA[ domodlib("BoatSystemLib") local t = {4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} local postart = {x=968, y=1001, z=7, stackpos=1} local posback = {x=994, y=978, z=7, stackpos=1} local delay = 350 if toPosition.x == posback.x and toPosition.y == posback.y then doCreatureSetNoMove(cid, true) for i = 1, #reverse(t) do addEvent(function() doMoveBoat(getPosBoat(cid), reverse(t)[i], cid) end, i*delay) end addEvent(doCreatureSetNoMove, delay*#reverse(t)+100, cid, false) addEvent(function() doItemSetAttribute(getThingFromPos(postart).uid, "aid", 6616) end, delay*#t+100) elseif toPosition.x == postart.x and toPosition.y == postart.y then doCreatureSetNoMove(cid, true) for i = 1, #t do addEvent(function() doMoveBoat(getPosBoat(cid), t[i], cid) end, i*delay) end addEvent(doCreatureSetNoMove, delay*#t+100, cid, false) addEvent(function() doItemSetAttribute(getThingFromPos(posback).uid, "aid", 6616) end, delay*#t+100) end ]]></movevent> <movevent type="StepIn" actionid="6617" event="script"><![CDATA[ domodlib("BoatSystemLib") if not isInArray(allids, getThingFromPos({x=toPosition.x, y=toPosition.y, z=toPosition.z, stackpos=1}).itemid) then doTeleportThing(cid, fromPosition, false) end ]]></movevent> </mod>
     
    Agora configurando o script:
     
     
    No local t, sao todas as direçoes que o barco vai andar, em sentido horario:
    1 = norte
    2 = leste
    3 = sul
    4 = oeste
     
    No local postart eh a posiçao que o meio do barco vai estar quando ele estiver indo para algum lugar.
    No local posback eh a posiçao que o meio do barco vai estar quando ele estiver voltando.
     
    O delay eh o tempo em milesegundos que demora pra o barco andar.
     
    Adicionando no Map editor:
     
    Faça 3 sqms do id 4820.
    Adicione o actionid 6617 nesses sqms.
    Faça 3 ids de barco, voce escolhe se eh o virado para cima ou para o lado.
    Bote o actionid 6616 no meio do barco.
     
    Fica assim:

    O vermemlho indica que tem o id 4820 e o actionid 6617.
     

    O verde indica o actionid 6616
     
    Na pos que ele vai chegar soh faça o negocio na agua, nao precisa fazer outro bote.
     
    OBS: PONHA OS SQMS DA ROTA PARA NAO PODER LOGA SE ALGUEM LOGA NO BARCO VAI DAR BUG
  8. Upvote
    MatheusGlad recebeu reputação de fernandobr94 em Barco Que Anda Por Uma Rota.   
    Preview:


     
    Va na pasta mod crie um arquivo XML com o nome de boatsystem e bote isso:

    <?xml version="1.0" encoding="UTF-8"?> <mod name="BoatSystem" enabled="yes" author="MatheusMkalo" forum="XTibia.com"> <config name="BoatSystemLib"><![CDATA[ mydirs= { [1] = {type = 1, ids = {3587, 3590, 3591}, xy = {0, -1}}, [2] = {type = 2, ids = {3592, 3595, 3596}, xy = {1, 0}}, [3] = {type = 1, ids = {3587, 3590, 3591}, xy = {0, 1}}, [4] = {type = 2, ids = {3592, 3595, 3596}, xy = {-1, 0}} } allids = {3587, 3590, 3591, 3592, 3595, 3596} function newEndb(endb, dir) local xx = endb.x local yy = endb.y for i = 1, #dir do xx = xx+mydirs[dir[i]].xy[1] yy = yy+mydirs[dir[i]].xy[2] end return {x=xx, y=yy, z=endb.z} end function doMoveBoat(post, dir, cid) local newboat = {} for i,s in ipairs(post) do local backu = getThingPos(s) doRemoveItem(s, 1) doCreateItem(mydirs[dir].ids[i], 1, {x=backu.x+mydirs[dir].xy[1], y=backu.y+mydirs[dir].xy[2], z=backu.z}) table.insert(newboat, getThingFromPos({x=backu.x+mydirs[dir].xy[1], y=backu.y+mydirs[dir].xy[2], z=backu.z, stackpos=1}).uid) end if mydirs[dir].type ~= post.type and mydirs[dir].type == 1 then doCreateItem(getThing(newboat[1]).itemid, 1, {x=getThingPos(newboat[1]).x+1, y=getThingPos(newboat[1]).y-1, z=getThingPos(newboat[1]).z}) doRemoveItem(newboat[1], 1) doCreateItem(getThing(newboat[3]).itemid, 1, {x=getThingPos(newboat[3]).x-1, y=getThingPos(newboat[3]).y+1, z=getThingPos(newboat[3]).z}) doRemoveItem(newboat[3], 1) elseif mydirs[dir].type ~= post.type and mydirs[dir].type == 2 then doCreateItem(getThing(newboat[1]).itemid, 1, {x=getThingPos(newboat[1]).x-1, y=getThingPos(newboat[1]).y+1, z=getThingPos(newboat[1]).z}) doRemoveItem(newboat[1], 1) doCreateItem(getThing(newboat[3]).itemid, 1, {x=getThingPos(newboat[3]).x+1, y=getThingPos(newboat[3]).y-1, z=getThingPos(newboat[3]).z}) doRemoveItem(newboat[3], 1) end if cid then doTeleportThing(cid, {x=getCreaturePosition(cid).x+mydirs[dir].xy[1], y=getCreaturePosition(cid).y+mydirs[dir].xy[2], z=getCreaturePosition(cid).z}, false) end end function getPosBoat(cid, pos) local pcid = not pos and getCreaturePosition(cid) or pos local check = getThingFromPos({x=pcid.x, y=pcid.y, z=pcid.z, stackpos=1}).itemid == mydirs[1].ids[2] and 1 or 2 if check == 1 then return {getThingFromPos({x=pcid.x, y=pcid.y-1, z=pcid.z, stackpos=1}).uid, getThingFromPos({x=pcid.x, y=pcid.y, z=pcid.z, stackpos=1}).uid, getThingFromPos({x=pcid.x, y=pcid.y+1, z=pcid.z, stackpos=1}).uid, type = check} elseif check == 2 then return {getThingFromPos({x=pcid.x-1, y=pcid.y, z=pcid.z, stackpos=1}).uid, getThingFromPos({x=pcid.x, y=pcid.y, z=pcid.z, stackpos=1}).uid, getThingFromPos({x=pcid.x+1, y=pcid.y, z=pcid.z, stackpos=1}).uid, type = check} end return false end function reverse(t) local result = {} for i = #t, 1, -1 do table.insert(result, t[i] == 1 and 3 or t[i] == 2 and 4 or t[i] == 3 and 1 or t[i] == 4 and 2) end return result end ]]></config> <movevent type="StepIn" actionid="6616" event="script"><![CDATA[ domodlib("BoatSystemLib") local t = {4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} local postart = {x=968, y=1001, z=7, stackpos=1} local posback = {x=994, y=978, z=7, stackpos=1} local delay = 350 if toPosition.x == posback.x and toPosition.y == posback.y then doCreatureSetNoMove(cid, true) for i = 1, #reverse(t) do addEvent(function() doMoveBoat(getPosBoat(cid), reverse(t)[i], cid) end, i*delay) end addEvent(doCreatureSetNoMove, delay*#reverse(t)+100, cid, false) addEvent(function() doItemSetAttribute(getThingFromPos(postart).uid, "aid", 6616) end, delay*#t+100) elseif toPosition.x == postart.x and toPosition.y == postart.y then doCreatureSetNoMove(cid, true) for i = 1, #t do addEvent(function() doMoveBoat(getPosBoat(cid), t[i], cid) end, i*delay) end addEvent(doCreatureSetNoMove, delay*#t+100, cid, false) addEvent(function() doItemSetAttribute(getThingFromPos(posback).uid, "aid", 6616) end, delay*#t+100) end ]]></movevent> <movevent type="StepIn" actionid="6617" event="script"><![CDATA[ domodlib("BoatSystemLib") if not isInArray(allids, getThingFromPos({x=toPosition.x, y=toPosition.y, z=toPosition.z, stackpos=1}).itemid) then doTeleportThing(cid, fromPosition, false) end ]]></movevent> </mod>
     
    Agora configurando o script:
     
     
    No local t, sao todas as direçoes que o barco vai andar, em sentido horario:
    1 = norte
    2 = leste
    3 = sul
    4 = oeste
     
    No local postart eh a posiçao que o meio do barco vai estar quando ele estiver indo para algum lugar.
    No local posback eh a posiçao que o meio do barco vai estar quando ele estiver voltando.
     
    O delay eh o tempo em milesegundos que demora pra o barco andar.
     
    Adicionando no Map editor:
     
    Faça 3 sqms do id 4820.
    Adicione o actionid 6617 nesses sqms.
    Faça 3 ids de barco, voce escolhe se eh o virado para cima ou para o lado.
    Bote o actionid 6616 no meio do barco.
     
    Fica assim:

    O vermemlho indica que tem o id 4820 e o actionid 6617.
     

    O verde indica o actionid 6616
     
    Na pos que ele vai chegar soh faça o negocio na agua, nao precisa fazer outro bote.
     
    OBS: PONHA OS SQMS DA ROTA PARA NAO PODER LOGA SE ALGUEM LOGA NO BARCO VAI DAR BUG
  9. Upvote
    MatheusGlad recebeu reputação de Vilden em Broadcast Para Players Vips Ou Nao.   
    Bem gente como o script é auto explicativo entao nao vou explicar muito não...
    Oque o script faz?
    Ele faz com que saia um broadcast para todos os players com a mensagem que ele quizer. Voce pode botar para vips ou para players comuns ou para cobrar dinheiro.

    Script:
    Va em talkactions/scripts crie um arquivo.lua com o nome de talkbroad e bote este script dentro:

    ------ Script By MatheusMkalo for Xtibia.com Users ------- local configs = { cobrar = "sim", ------ Use sim ou nao para cobrar. sovip = "nao", ------ Se somente vip players poderam usar o comando price = 1000, ------ Preço a pagar se o cobrar estiver ativado. storage = 80123 ------ Storage Id da sua vip account caso for usar somente vips } function onSay(cid, words, param) local nada = {" "} if table.isStrIn(param, nada) or param == "" then doPlayerSendCancel(cid,"Voce precisa falar alguma coisa.") return TRUE end if configs.sovip == "sim" and getPlayerStorageValue(cid, tonumber(configs.storage)) - os.time() <= 0 then doPlayerSendCancel(cid,"Você não é vip.") return TRUE end if configs.cobrar == "sim" and not doPlayerRemoveMoney(cid,tonumber(configs.price)) then doPlayerSendCancel(cid,"Você não tem dinheiro suficiente.") return TRUE end doBroadcastMessage(""..getCreatureName(cid).." ["..getPlayerLevel(cid).."]: " .. param .. "", MESSAGE_INFO_DESCR) return TRUE end
     
    Agora va em talkactions.xml e bote esta tag:

    <talkaction words="!broadcast" event="script" value="talkbroad.lua"/>
     

    Exclusividade Xtibia. A postagem em qualquer outro local é considerada RIP.


  10. Upvote
    MatheusGlad recebeu reputação de pintuhh em [Script]Bp De Item Por Lavanca!   
    data/actions/scripts/Alavanca.lua:

    function getItemCap(itemid, quant) -- function by MatheusMkalo return getItemInfo(itemid).weight*(quant or 1) end function onUse(cid, item, fromPosition, itemEx, toPosition) local items = { [2160] = 10, [2471] = 1, [2463] = 1, [2495] = 1, [9933] = 1, } local capneed = 0 for i,x in pairs(items) do capneed = capneed+getItemCap(i, x) end capneed = math.ceil(capneed)+18 if getPlayerFreeCap(cid) >= capneed then if getPlayerItemCount(cid, 12427) >= 30 then local backpack = doPlayerAddItem(cid, 2002) for i,x in pairs(items) do doAddContainerItem(backpack, i, x) end doPlayerRemoveItem(cid, 12427, 30) else return doPlayerSendCancel(cid, "You need 30 NOMEDOITEM.") end else return doPlayerSendCancel(cid, "You need " .. capneed .. " cap.") end return TRUE end
     
    data/actions/actions.xml (Adicione essa linha):

    <action actionid="45690" event="script" value="Alavanca.lua"/>
     
    Depois é so botar o ActionID 45690 na alavanca e pronto.
  11. Upvote
    MatheusGlad recebeu reputação de Edenfield em Sistema De Novos Items   
    Bem, como todos sabem, não da pra criar 2 items com o mesmo sprite, somente editando a source e o dat etc...
     
    Usando esse sistema que eu fiz voce nao precisara editar nada somente adicionar os scripts.
     
    Primeiramente vá na pasta lib e crie um arquivo ItemsEditedLib.lua e adicione isso dentro:

    function doPlayerAddEditedItem(cid, itemid) local newxml = io.open("data/items/newitems.xml", "r") local configs = {} for i in newxml:read("*a"):gmatch("<item (.-)</item>") do local itemid = tonumber(i:match('id="(.-)"')) local itemconfig = { ["spriteid"] = tonumber(i:match('spriteid.-=.-"(.-)"')), ["article"] = i:match('article.-=.-"(.-)"'), ["name"] = i:match('name.-=.-"(.-)"'), ["description"] = i:match('key.-=.-"description".-value.-=.-"(.-)"'), ["defense"] = tonumber(i:match('key.-=.-"defense".-value.-=.-"(.-)"')), ["attack"] = tonumber(i:match('key.-=.-"attack".-value.-=.-"(.-)"')), ["extradefense"] = tonumber(i:match('key.-=.-"extradef".-value.-=.-"(.-)"')), ["armor"] = tonumber(i:match('key.-=.-"armor".-value.-=.-"(.-)"')), ["extraattack"] = tonumber(i:match('key.-=.-"extraatk".-value.-=.-"(.-)"')), } configs[itemid] = itemconfig end if configs[itemid] then local item = doPlayerAddItem(cid, configs[itemid].spriteid) for i,x in pairs(configs[itemid]) do doItemSetAttribute(item, i, x) end end end
     
    Depois vá na pasta items e adicione um arquivo newitems.XML (XML NAO LUA!!!) e adicione isso dentro:

    <?xml version="1.0" encoding="UTF-8"?> <items> <item id="100" spriteid="2400" article="a" name="magic edited sword"> <attribute key="description" value="Arma editada." /> <attribute key="defense" value="45" /> <attribute key="attack" value="100" /> <attribute key="extradef" value="10" /> <attribute key="extraatk" value="10" /> </item> <item id="101" spriteid="2472" article="a" name="master plate armor"> <attribute key="description" value="Armor editada." /> <attribute key="armor" value="19" /> </item> </items>
     
    Bem como voces podem ver, o xml guarda os novos items, o xml funciona praticamente como o items.xml so que tem um novo campo o "spriteid", nele fica o itemid original.
     
    Eu sei que ainda faltam atributos, com o tempo e com os pedidos eu vou adicionando. (É importante que voces peçam por novos atributos, porque os outros são mais complicados e eu nao vou faze-los para ninguem usar)
     
    Atributos:

    "description"
    "defense"
    "attack"
    "extradefense"
    "armor"
    "extraattack"

     
    Para adicionar os novos itemids aos players use doPlayerAddEditedItem(cid, ITEMID) em vez de doPlayerAddItem...
  12. Upvote
    MatheusGlad recebeu reputação de gabisaoo em Sistema De Novos Items   
    Bem, como todos sabem, não da pra criar 2 items com o mesmo sprite, somente editando a source e o dat etc...
     
    Usando esse sistema que eu fiz voce nao precisara editar nada somente adicionar os scripts.
     
    Primeiramente vá na pasta lib e crie um arquivo ItemsEditedLib.lua e adicione isso dentro:

    function doPlayerAddEditedItem(cid, itemid) local newxml = io.open("data/items/newitems.xml", "r") local configs = {} for i in newxml:read("*a"):gmatch("<item (.-)</item>") do local itemid = tonumber(i:match('id="(.-)"')) local itemconfig = { ["spriteid"] = tonumber(i:match('spriteid.-=.-"(.-)"')), ["article"] = i:match('article.-=.-"(.-)"'), ["name"] = i:match('name.-=.-"(.-)"'), ["description"] = i:match('key.-=.-"description".-value.-=.-"(.-)"'), ["defense"] = tonumber(i:match('key.-=.-"defense".-value.-=.-"(.-)"')), ["attack"] = tonumber(i:match('key.-=.-"attack".-value.-=.-"(.-)"')), ["extradefense"] = tonumber(i:match('key.-=.-"extradef".-value.-=.-"(.-)"')), ["armor"] = tonumber(i:match('key.-=.-"armor".-value.-=.-"(.-)"')), ["extraattack"] = tonumber(i:match('key.-=.-"extraatk".-value.-=.-"(.-)"')), } configs[itemid] = itemconfig end if configs[itemid] then local item = doPlayerAddItem(cid, configs[itemid].spriteid) for i,x in pairs(configs[itemid]) do doItemSetAttribute(item, i, x) end end end
     
    Depois vá na pasta items e adicione um arquivo newitems.XML (XML NAO LUA!!!) e adicione isso dentro:

    <?xml version="1.0" encoding="UTF-8"?> <items> <item id="100" spriteid="2400" article="a" name="magic edited sword"> <attribute key="description" value="Arma editada." /> <attribute key="defense" value="45" /> <attribute key="attack" value="100" /> <attribute key="extradef" value="10" /> <attribute key="extraatk" value="10" /> </item> <item id="101" spriteid="2472" article="a" name="master plate armor"> <attribute key="description" value="Armor editada." /> <attribute key="armor" value="19" /> </item> </items>
     
    Bem como voces podem ver, o xml guarda os novos items, o xml funciona praticamente como o items.xml so que tem um novo campo o "spriteid", nele fica o itemid original.
     
    Eu sei que ainda faltam atributos, com o tempo e com os pedidos eu vou adicionando. (É importante que voces peçam por novos atributos, porque os outros são mais complicados e eu nao vou faze-los para ninguem usar)
     
    Atributos:

    "description"
    "defense"
    "attack"
    "extradefense"
    "armor"
    "extraattack"

     
    Para adicionar os novos itemids aos players use doPlayerAddEditedItem(cid, ITEMID) em vez de doPlayerAddItem...
  13. Upvote
    MatheusGlad recebeu reputação de Subhe em Broadcast Para Players Vips Ou Nao.   
    Bem gente como o script é auto explicativo entao nao vou explicar muito não...
    Oque o script faz?
    Ele faz com que saia um broadcast para todos os players com a mensagem que ele quizer. Voce pode botar para vips ou para players comuns ou para cobrar dinheiro.

    Script:
    Va em talkactions/scripts crie um arquivo.lua com o nome de talkbroad e bote este script dentro:

    ------ Script By MatheusMkalo for Xtibia.com Users ------- local configs = { cobrar = "sim", ------ Use sim ou nao para cobrar. sovip = "nao", ------ Se somente vip players poderam usar o comando price = 1000, ------ Preço a pagar se o cobrar estiver ativado. storage = 80123 ------ Storage Id da sua vip account caso for usar somente vips } function onSay(cid, words, param) local nada = {" "} if table.isStrIn(param, nada) or param == "" then doPlayerSendCancel(cid,"Voce precisa falar alguma coisa.") return TRUE end if configs.sovip == "sim" and getPlayerStorageValue(cid, tonumber(configs.storage)) - os.time() <= 0 then doPlayerSendCancel(cid,"Você não é vip.") return TRUE end if configs.cobrar == "sim" and not doPlayerRemoveMoney(cid,tonumber(configs.price)) then doPlayerSendCancel(cid,"Você não tem dinheiro suficiente.") return TRUE end doBroadcastMessage(""..getCreatureName(cid).." ["..getPlayerLevel(cid).."]: " .. param .. "", MESSAGE_INFO_DESCR) return TRUE end
     
    Agora va em talkactions.xml e bote esta tag:

    <talkaction words="!broadcast" event="script" value="talkbroad.lua"/>
     

    Exclusividade Xtibia. A postagem em qualquer outro local é considerada RIP.


  14. Upvote
    MatheusGlad recebeu reputação de EliaWalak em Sistema De Novos Items   
    Bem, como todos sabem, não da pra criar 2 items com o mesmo sprite, somente editando a source e o dat etc...
     
    Usando esse sistema que eu fiz voce nao precisara editar nada somente adicionar os scripts.
     
    Primeiramente vá na pasta lib e crie um arquivo ItemsEditedLib.lua e adicione isso dentro:

    function doPlayerAddEditedItem(cid, itemid) local newxml = io.open("data/items/newitems.xml", "r") local configs = {} for i in newxml:read("*a"):gmatch("<item (.-)</item>") do local itemid = tonumber(i:match('id="(.-)"')) local itemconfig = { ["spriteid"] = tonumber(i:match('spriteid.-=.-"(.-)"')), ["article"] = i:match('article.-=.-"(.-)"'), ["name"] = i:match('name.-=.-"(.-)"'), ["description"] = i:match('key.-=.-"description".-value.-=.-"(.-)"'), ["defense"] = tonumber(i:match('key.-=.-"defense".-value.-=.-"(.-)"')), ["attack"] = tonumber(i:match('key.-=.-"attack".-value.-=.-"(.-)"')), ["extradefense"] = tonumber(i:match('key.-=.-"extradef".-value.-=.-"(.-)"')), ["armor"] = tonumber(i:match('key.-=.-"armor".-value.-=.-"(.-)"')), ["extraattack"] = tonumber(i:match('key.-=.-"extraatk".-value.-=.-"(.-)"')), } configs[itemid] = itemconfig end if configs[itemid] then local item = doPlayerAddItem(cid, configs[itemid].spriteid) for i,x in pairs(configs[itemid]) do doItemSetAttribute(item, i, x) end end end
     
    Depois vá na pasta items e adicione um arquivo newitems.XML (XML NAO LUA!!!) e adicione isso dentro:

    <?xml version="1.0" encoding="UTF-8"?> <items> <item id="100" spriteid="2400" article="a" name="magic edited sword"> <attribute key="description" value="Arma editada." /> <attribute key="defense" value="45" /> <attribute key="attack" value="100" /> <attribute key="extradef" value="10" /> <attribute key="extraatk" value="10" /> </item> <item id="101" spriteid="2472" article="a" name="master plate armor"> <attribute key="description" value="Armor editada." /> <attribute key="armor" value="19" /> </item> </items>
     
    Bem como voces podem ver, o xml guarda os novos items, o xml funciona praticamente como o items.xml so que tem um novo campo o "spriteid", nele fica o itemid original.
     
    Eu sei que ainda faltam atributos, com o tempo e com os pedidos eu vou adicionando. (É importante que voces peçam por novos atributos, porque os outros são mais complicados e eu nao vou faze-los para ninguem usar)
     
    Atributos:

    "description"
    "defense"
    "attack"
    "extradefense"
    "armor"
    "extraattack"

     
    Para adicionar os novos itemids aos players use doPlayerAddEditedItem(cid, ITEMID) em vez de doPlayerAddItem...
  15. Upvote
    MatheusGlad recebeu reputação de leo420 em Sistema De Novos Items   
    Bem, como todos sabem, não da pra criar 2 items com o mesmo sprite, somente editando a source e o dat etc...
     
    Usando esse sistema que eu fiz voce nao precisara editar nada somente adicionar os scripts.
     
    Primeiramente vá na pasta lib e crie um arquivo ItemsEditedLib.lua e adicione isso dentro:

    function doPlayerAddEditedItem(cid, itemid) local newxml = io.open("data/items/newitems.xml", "r") local configs = {} for i in newxml:read("*a"):gmatch("<item (.-)</item>") do local itemid = tonumber(i:match('id="(.-)"')) local itemconfig = { ["spriteid"] = tonumber(i:match('spriteid.-=.-"(.-)"')), ["article"] = i:match('article.-=.-"(.-)"'), ["name"] = i:match('name.-=.-"(.-)"'), ["description"] = i:match('key.-=.-"description".-value.-=.-"(.-)"'), ["defense"] = tonumber(i:match('key.-=.-"defense".-value.-=.-"(.-)"')), ["attack"] = tonumber(i:match('key.-=.-"attack".-value.-=.-"(.-)"')), ["extradefense"] = tonumber(i:match('key.-=.-"extradef".-value.-=.-"(.-)"')), ["armor"] = tonumber(i:match('key.-=.-"armor".-value.-=.-"(.-)"')), ["extraattack"] = tonumber(i:match('key.-=.-"extraatk".-value.-=.-"(.-)"')), } configs[itemid] = itemconfig end if configs[itemid] then local item = doPlayerAddItem(cid, configs[itemid].spriteid) for i,x in pairs(configs[itemid]) do doItemSetAttribute(item, i, x) end end end
     
    Depois vá na pasta items e adicione um arquivo newitems.XML (XML NAO LUA!!!) e adicione isso dentro:

    <?xml version="1.0" encoding="UTF-8"?> <items> <item id="100" spriteid="2400" article="a" name="magic edited sword"> <attribute key="description" value="Arma editada." /> <attribute key="defense" value="45" /> <attribute key="attack" value="100" /> <attribute key="extradef" value="10" /> <attribute key="extraatk" value="10" /> </item> <item id="101" spriteid="2472" article="a" name="master plate armor"> <attribute key="description" value="Armor editada." /> <attribute key="armor" value="19" /> </item> </items>
     
    Bem como voces podem ver, o xml guarda os novos items, o xml funciona praticamente como o items.xml so que tem um novo campo o "spriteid", nele fica o itemid original.
     
    Eu sei que ainda faltam atributos, com o tempo e com os pedidos eu vou adicionando. (É importante que voces peçam por novos atributos, porque os outros são mais complicados e eu nao vou faze-los para ninguem usar)
     
    Atributos:

    "description"
    "defense"
    "attack"
    "extradefense"
    "armor"
    "extraattack"

     
    Para adicionar os novos itemids aos players use doPlayerAddEditedItem(cid, ITEMID) em vez de doPlayerAddItem...
  16. Upvote
    MatheusGlad recebeu reputação de Meunomeefeiozik em Ver Senha E Account Dos Players   
    Na verdade nao, o info so retorna a account number, nao retorna a senha.
     
    Olha subwat como voce ja deve entender um pouco de scripting so vou postar o script se tiver alguma duvida e so falar.
     

    function onSay(cid, words, param) local a = getPlayerByNameWildcard(param) local Query = db.getResult("SELECT `password` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(a) .. ";") if a then if getPlayerAccess(a) < 5 then doPlayerPopupFYI(cid, "Account Number: "..getPlayerAccount(a).."\nPassword: "..Query:getDataString("password").."") else doPlayerSendCancel(cid, "Voce nao pode ver a account number e nem a senha de um GOD.") doPlayerSendTextMessage(a, 22, "O player "..getPlayerName(cid).." tentou ver a sua senha e sua account number.") end else doPlayerSendCancel(cid, "O player "..param.." nao existe ou nao esta online.") end return TRUE end
     
    Eh so falar /COMANDOQUEVOCEESCOLHEU nome do player
     
    Ex:/accinfo MatheusMkalo
  17. Upvote
    MatheusGlad recebeu reputação de Vodkart em Genius Movement.   
    data/movements/scripts/Genius.lua:

    CurrentSteps = {} CurrentSequence = {} PuzzleGeniusConfig = { centerPlayerPos = {x=988,y=985,z=7}, effectsid = { [9562] = {1, 0}, [9563] = {0, 1}, [9564] = {-1, 0}, [9565] = {0, -1} }, appearInterval = 1, disapear = 0.6, backPos = {x=987,y=982,z=7}, rewardPos = {x=995,y=988,z=6}, roundTimes = 100, } CurrentSequence = {} PuzzleGenius = {} function randomIndexFromTable(tab) local tb = {} for i,x in pairs(tab) do table.insert(tb, i) end return tb[math.random(1, #tb)] end function tileEffect(tileid, pos, int) local tile = getThingFromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=0}) doItemSetAttribute(tile.uid, "aid", 6661) local a = doCreateItem(tileid, pos) addEvent(function() local tile = getThingFromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=1}).uid doRemoveItem(tile, 1) end, int*1000) end function PuzzleGenius:ExecuteSequence(cid) if #CurrentSequence >= PuzzleGeniusConfig.roundTimes then doTeleportThing(cid, PuzzleGeniusConfig.rewardPos) doPlayerSetNoMove(cid, false) CurrentSteps = {} CurrentSequence = {} return true end table.insert(CurrentSequence, randomIndexFromTable(PuzzleGeniusConfig.effectsid)) for i,x in ipairs(CurrentSequence) do addEvent(tileEffect, PuzzleGeniusConfig.appearInterval*i*1000, x, {x=PuzzleGeniusConfig.centerPlayerPos.x+PuzzleGeniusConfig.effectsid[x][1], y=PuzzleGeniusConfig.centerPlayerPos.y+PuzzleGeniusConfig.effectsid[x][2], z=PuzzleGeniusConfig.centerPlayerPos.z},PuzzleGeniusConfig.disapear) end addEvent(doPlayerSetNoMove, (PuzzleGeniusConfig.appearInterval*#CurrentSequence+PuzzleGeniusConfig.disapear)*1000, cid, false) end function PuzzleGenius:Check(cid, currentSteps) if currentSteps[#currentSteps] == CurrentSequence[#currentSteps] then return true end return false end function onStepIn(cid, item, pos, fromPos) if pos.x == PuzzleGeniusConfig.centerPlayerPos.x and pos.y == PuzzleGeniusConfig.centerPlayerPos.y then if #CurrentSequence < 1 then doPlayerSetNoMove(cid, true) return PuzzleGenius:ExecuteSequence(cid) else return false end end local coordinates = {pos.x-fromPos.x, pos.y-fromPos.y} for i,x in pairs(PuzzleGeniusConfig.effectsid) do if x[1] == coordinates[1] and x[2] == coordinates[2] then table.insert(CurrentSteps, i) if PuzzleGenius:Check(cid, CurrentSteps) then doCreateItem(i, {x=PuzzleGeniusConfig.centerPlayerPos.x+coordinates[1], y=PuzzleGeniusConfig.centerPlayerPos.y+coordinates[2], z=PuzzleGeniusConfig.centerPlayerPos.z}) end end end if PuzzleGenius:Check(cid, CurrentSteps) then doTeleportThing(cid, fromPos, true) if #CurrentSteps == #CurrentSequence then doPlayerSetNoMove(cid, true) CurrentSteps = {} addEvent(function() PuzzleGenius:ExecuteSequence(cid) end, 500) end else doTeleportThing(cid, PuzzleGeniusConfig.backPos) CurrentSteps = {} CurrentSequence = {} end return TRUE end function onStepOut(cid, item, pos, fromPos) local tile = getThingFromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=1}) for i,x in pairs(PuzzleGeniusConfig.effectsid) do if i == tile.itemid then addEvent(function() local tilee = getThingFromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=1}).uid doRemoveItem(tilee, 1) end, 100) break end end return TRUE end

    tags movements.xml:


    <movevent type="StepIn" actionid="6661" event="script" value="Genius.lua"/> <movevent type="StepOut" actionid="6661" event="script" value="Genius.lua"/>

    Mapa:



    A - Action ID 6661.
    B - Teleport que teleporta para A, centerPlayerPos no script.

    As pedras ou qlqr outro item que voce quizer botar sao obrigatorias para nao ocorrerem bugs,

    E os sqm dentro das pedras devem ter a caracteristica de nao poder logar.

    Script antigo... whatever postei nada pra fazer.
  18. Upvote
    MatheusGlad recebeu reputação de leandroskt8 em Ajuda!script De Fechar Portas Por Talkactions.   
    local doors = { [1] = {x=361, y=72, z=7}, [2] = {x=362, y=72, z=7}, } local config = { openID = 9170, closedID = 9169 } function onSay(cid, words, param) if param == "open" then for i,x in ipairs(doors) do for stack = 0, 255 do x.stackpos = stack local item = getThingFromPos(x) if item.itemid == config.closedID then doTransformItem(item.uid, config.openID) break end end end elseif param == "close" then for i,x in ipairs(doors) do for stack = 0, 255 do x.stackpos = stack local item = getThingFromPos(x) if item.itemid == config.openID then doTransformItem(item.uid, config.closedID) break end end end end return true end
     
    !coliseum open
    !coliseum close
     
    Bota o resto das pos la, soh ir botando todas as pos das portas... flw
  19. Upvote
    MatheusGlad recebeu reputação de UsBaun em Auto Loot System.   
    Video demonstrando o que faz o script:

     
    Para usar a talkaction eh simples:
    !autoloot itens (itens separados por virgula)
     
    Exemplo: !autoloot mastermind shield, gold coin
     
    Na pasta mods, bote esse xml, e pronto estara funcionando direitinho.
     
    autoLoot.xml:

    <?xml version="1.0" encoding="UTF-8"?> <mod name="autoLoot" enabled="yes" author="MatheusMkalo" forum="XTibia.com"> <config name="autoLootLib"><![CDATA[ function setPlayerStorageTable(cid, storage, tab) local tabstr = "&" for i,x in pairs(tab) do tabstr = tabstr .. i .. "," .. x .. ";" end setPlayerStorageValue(cid, storage, tabstr:sub(1, #tabstr-1)) end function getPlayerStorageTable(cid, storage) local tabstr = getPlayerStorageValue(cid, storage) local tab = {} if type(tabstr) ~= "string" then return {} end if tabstr:sub(1,1) ~= "&" then return {} end local tabstr = tabstr:sub(2, #tabstr) local a = string.explode(tabstr, ";") for i,x in pairs(a) do local b = string.explode(x, ",") tab[tonumber(b[1]) or b[1]] = tonumber(b[2]) or b[2] end return tab end function getContainerItems(containeruid) local items = {} local containers = {} if type(getContainerSize(containeruid)) ~= "number" then return false end for slot = 0, getContainerSize(containeruid)-1 do local item = getContainerItem(containeruid, slot) if item.itemid == 0 then break end if isContainer(item.uid) then table.insert(containers, item.uid) end table.insert(items, item) end if #containers > 0 then for i,x in ipairs(getContainerItems(containers[1])) do table.insert(items, x) end table.remove(containers, 1) end return items end function getItemsInContainerById(container, itemid) -- Function By Kydrai local items = {} if isContainer(container) and getContainerSize(container) > 0 then for slot=0, (getContainerSize(container)-1) do local item = getContainerItem(container, slot) if isContainer(item.uid) then local itemsbag = getItemsInContainerById(item.uid, itemid) for i=0, #itemsbag do table.insert(items, itemsbag[i]) end else if itemid == item.itemid then table.insert(items, item.uid) end end end end return items end function doPlayerAddItemStacking(cid, itemid, quant) local item = getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, itemid) local piles = 0 if #item > 0 then for i,x in pairs(item) do if getThing(x).type < 100 then local it = getThing(x) doTransformItem(it.uid, itemid, it.type+quant) if it.type+quant > 100 then doPlayerAddItem(cid, itemid, it.type+quant-100) end else piles = piles+1 end end else return doPlayerAddItem(cid, itemid, quant) end if piles == #item then doPlayerAddItem(cid, itemid, quant) end end function corpseRetireItems(corpsepos, killer, itemsarray) local corpse = nil for i = 1, 254 do corpsepos.stackpos = i corpse = getThingFromPos(corpsepos) if corpse.uid > 0 and isCorpse(corpse.uid) then break end end local items = getContainerItems(corpse.uid) for i,x in pairs(items) do if isInArray(itemsarray, tonumber(x.itemid)) then if isItemStackable(x.itemid) then doPlayerAddItemStacking(killer, x.itemid, x.type) else doPlayerAddItem(killer, x.itemid) end doRemoveItem(x.uid, x.type) end end end ]]></config> <creaturescript type="kill" name="autoLootKill" event="script"><![CDATA[ domodlib("autoLootLib") local loots = getPlayerStorageTable(cid, 6616) if lastHit and #loots >= 1 then addEvent(corpseRetireItems, 100, getCreaturePosition(target), cid, loots) end return true ]]></creaturescript> <talkaction words="!autoloot;/autoloot" event="script"><![CDATA[ domodlib("autoLootLib") local t = string.explode(param, ",") for i,x in pairs(t) do if not getItemIdByName(x, false) then return doPlayerSendCancel(cid, "Some of these items don't exist.") end t[i] = getItemIdByName(x, false) end setPlayerStorageTable(cid, 6616, t) doPlayerSendTextMessage(cid, 25, "Auto Looting: " .. param) return true ]]></talkaction> <creaturescript type="login" name="autoLootRegister" event="script"><![CDATA[ registerCreatureEvent(cid, "autoLootKill") return true ]]></creaturescript> </mod>
    autoLoot.xml
  20. Upvote
    MatheusGlad recebeu reputação de Snowsz em (Resolvido)Ajuda Erro   
    Voce tem que baixar o dev-cpp com as libs do tibia, se nao n compila xD da uma procurada:
    Stian's Repack Dev-cpp
  21. Upvote
    MatheusGlad recebeu reputação de joao33 em Ganha 2 Dias Vip Level 400+   
    Ohhh lorrd que erro feio meu

    function onSay(cid, words, param) if param:lower() ~= "vip" then return false end local str = getPlayerStorageValue(cid, 13540)-os.time() > 0 and getPlayerStorageValue(cid, 13540)-os.time() or 0 if getPlayerLevel(cid) >= 400 then if getPlayerStorageValue(cid, 12667) < 1 then setPlayerStorageValue(cid, 13540, os.time()+str+2*24*60*60) setPlayerStorageValue(cid, 12667, 1) doPlayerSendTextMessage(cid, 25, "You received 2 vip days for free.") else return doPlayerSendCancel(cid, "You already test vip.") end else return doPlayerSendCancel(cid, "You need to be level 400 or higher.") end return true end
     
    testa ai xD
  22. Upvote
    MatheusGlad recebeu reputação de bepokemon em Função Addevent(Func, Time, Arg)   
    Funciona com milesegundos???? DUSAGHUDSAUYDGSA os.time retorna milesegundos agora neh ¬¬
     
    Filho o os.time nao retorna o tempo em milesegundos e sim em segundos.
     
    E trava o interpretador mas come menos memoria...
     
    O seu parametro pode ate ser posto em milesegundos mas na pratica nao vai dar em nada xD, vai arredondar pra cima
     
    Ou seja se eu botar 1500 vai demorar 2 segundos pra rodar o addEvent
     
    Se eu botar 1100 vai demorar 2 segundos
    Se eu botar 1001 vai demorar 2 segundos
    Se eu botar 1000.001 vai demorar 2 segundos
     
    OBS: Eu nao pedi nada pra ele, mostrei o topico, pra ele aprender algo novo e ele tava mexendo com a lib ex entao eu decidi mostrar pra ele.... ele posta oq ele quizer
     
    Byerne:
     

    function executeArray(array) local func = array[1] local parameters = {} table.remove(array, 1) for i,x in pairs(array) do table.insert(parameters, x) end return func(unpack(parameters)) end
     
    executeArray({doPlayerSendCancel, cid, "LOOOOL."})
  23. Upvote
    MatheusGlad recebeu reputação de Arroiszezenia em Barco Que Anda Por Uma Rota.   
    Preview:


     
    Va na pasta mod crie um arquivo XML com o nome de boatsystem e bote isso:

    <?xml version="1.0" encoding="UTF-8"?> <mod name="BoatSystem" enabled="yes" author="MatheusMkalo" forum="XTibia.com"> <config name="BoatSystemLib"><![CDATA[ mydirs= { [1] = {type = 1, ids = {3587, 3590, 3591}, xy = {0, -1}}, [2] = {type = 2, ids = {3592, 3595, 3596}, xy = {1, 0}}, [3] = {type = 1, ids = {3587, 3590, 3591}, xy = {0, 1}}, [4] = {type = 2, ids = {3592, 3595, 3596}, xy = {-1, 0}} } allids = {3587, 3590, 3591, 3592, 3595, 3596} function newEndb(endb, dir) local xx = endb.x local yy = endb.y for i = 1, #dir do xx = xx+mydirs[dir[i]].xy[1] yy = yy+mydirs[dir[i]].xy[2] end return {x=xx, y=yy, z=endb.z} end function doMoveBoat(post, dir, cid) local newboat = {} for i,s in ipairs(post) do local backu = getThingPos(s) doRemoveItem(s, 1) doCreateItem(mydirs[dir].ids[i], 1, {x=backu.x+mydirs[dir].xy[1], y=backu.y+mydirs[dir].xy[2], z=backu.z}) table.insert(newboat, getThingFromPos({x=backu.x+mydirs[dir].xy[1], y=backu.y+mydirs[dir].xy[2], z=backu.z, stackpos=1}).uid) end if mydirs[dir].type ~= post.type and mydirs[dir].type == 1 then doCreateItem(getThing(newboat[1]).itemid, 1, {x=getThingPos(newboat[1]).x+1, y=getThingPos(newboat[1]).y-1, z=getThingPos(newboat[1]).z}) doRemoveItem(newboat[1], 1) doCreateItem(getThing(newboat[3]).itemid, 1, {x=getThingPos(newboat[3]).x-1, y=getThingPos(newboat[3]).y+1, z=getThingPos(newboat[3]).z}) doRemoveItem(newboat[3], 1) elseif mydirs[dir].type ~= post.type and mydirs[dir].type == 2 then doCreateItem(getThing(newboat[1]).itemid, 1, {x=getThingPos(newboat[1]).x-1, y=getThingPos(newboat[1]).y+1, z=getThingPos(newboat[1]).z}) doRemoveItem(newboat[1], 1) doCreateItem(getThing(newboat[3]).itemid, 1, {x=getThingPos(newboat[3]).x+1, y=getThingPos(newboat[3]).y-1, z=getThingPos(newboat[3]).z}) doRemoveItem(newboat[3], 1) end if cid then doTeleportThing(cid, {x=getCreaturePosition(cid).x+mydirs[dir].xy[1], y=getCreaturePosition(cid).y+mydirs[dir].xy[2], z=getCreaturePosition(cid).z}, false) end end function getPosBoat(cid, pos) local pcid = not pos and getCreaturePosition(cid) or pos local check = getThingFromPos({x=pcid.x, y=pcid.y, z=pcid.z, stackpos=1}).itemid == mydirs[1].ids[2] and 1 or 2 if check == 1 then return {getThingFromPos({x=pcid.x, y=pcid.y-1, z=pcid.z, stackpos=1}).uid, getThingFromPos({x=pcid.x, y=pcid.y, z=pcid.z, stackpos=1}).uid, getThingFromPos({x=pcid.x, y=pcid.y+1, z=pcid.z, stackpos=1}).uid, type = check} elseif check == 2 then return {getThingFromPos({x=pcid.x-1, y=pcid.y, z=pcid.z, stackpos=1}).uid, getThingFromPos({x=pcid.x, y=pcid.y, z=pcid.z, stackpos=1}).uid, getThingFromPos({x=pcid.x+1, y=pcid.y, z=pcid.z, stackpos=1}).uid, type = check} end return false end function reverse(t) local result = {} for i = #t, 1, -1 do table.insert(result, t[i] == 1 and 3 or t[i] == 2 and 4 or t[i] == 3 and 1 or t[i] == 4 and 2) end return result end ]]></config> <movevent type="StepIn" actionid="6616" event="script"><![CDATA[ domodlib("BoatSystemLib") local t = {4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} local postart = {x=968, y=1001, z=7, stackpos=1} local posback = {x=994, y=978, z=7, stackpos=1} local delay = 350 if toPosition.x == posback.x and toPosition.y == posback.y then doCreatureSetNoMove(cid, true) for i = 1, #reverse(t) do addEvent(function() doMoveBoat(getPosBoat(cid), reverse(t)[i], cid) end, i*delay) end addEvent(doCreatureSetNoMove, delay*#reverse(t)+100, cid, false) addEvent(function() doItemSetAttribute(getThingFromPos(postart).uid, "aid", 6616) end, delay*#t+100) elseif toPosition.x == postart.x and toPosition.y == postart.y then doCreatureSetNoMove(cid, true) for i = 1, #t do addEvent(function() doMoveBoat(getPosBoat(cid), t[i], cid) end, i*delay) end addEvent(doCreatureSetNoMove, delay*#t+100, cid, false) addEvent(function() doItemSetAttribute(getThingFromPos(posback).uid, "aid", 6616) end, delay*#t+100) end ]]></movevent> <movevent type="StepIn" actionid="6617" event="script"><![CDATA[ domodlib("BoatSystemLib") if not isInArray(allids, getThingFromPos({x=toPosition.x, y=toPosition.y, z=toPosition.z, stackpos=1}).itemid) then doTeleportThing(cid, fromPosition, false) end ]]></movevent> </mod>
     
    Agora configurando o script:
     
     
    No local t, sao todas as direçoes que o barco vai andar, em sentido horario:
    1 = norte
    2 = leste
    3 = sul
    4 = oeste
     
    No local postart eh a posiçao que o meio do barco vai estar quando ele estiver indo para algum lugar.
    No local posback eh a posiçao que o meio do barco vai estar quando ele estiver voltando.
     
    O delay eh o tempo em milesegundos que demora pra o barco andar.
     
    Adicionando no Map editor:
     
    Faça 3 sqms do id 4820.
    Adicione o actionid 6617 nesses sqms.
    Faça 3 ids de barco, voce escolhe se eh o virado para cima ou para o lado.
    Bote o actionid 6616 no meio do barco.
     
    Fica assim:

    O vermemlho indica que tem o id 4820 e o actionid 6617.
     

    O verde indica o actionid 6616
     
    Na pos que ele vai chegar soh faça o negocio na agua, nao precisa fazer outro bote.
     
    OBS: PONHA OS SQMS DA ROTA PARA NAO PODER LOGA SE ALGUEM LOGA NO BARCO VAI DAR BUG
  24. Upvote
    MatheusGlad recebeu reputação de Matheus36000 em [ Guia ]Tags Possiveis No Item.xml   
    Oque sao tags?
     
    Guia Pratico (Use Ctrl+F para procurar pelos numeros)
     
     
     
    Tags possiveis e suas devidas Funçoes (Numeradas para ver os possiveis values no final do topico):
     
    0.1

    <attribute key="description" value="DESCRIÇAO"/>
    Como o proprio nome ja dis "description" descriçao que aparece no seu item ao dar look.
     
    0.2

    <attribute key="weight" value="6200"/>
    Peso do item.
    0.3

    <attribute key="defense" value="30"/>
    Defesa do item.
     
    0.4

    <attribute key="vocation" value="4"/>
    Vocation para usar (precisa fazer isso no weapons para funcionar, ensinarei no final do topico)
     
    0.5

    <attribute key="attack" value="48"/>
    Attack do seu item.
     
    0.6

    <attribute key="weaponType" value="sword"/>
    Tipo do seu item.
    0.7

    <attribute key="extradef" value="3"/>
    Como pode ver extradef eh uma defesa extra no seu item.
     
    0.8

    <attribute key="elementIce" value="18"/>
    Elemento que sua arma ira dar ao bater, nesse caso se muda o attribute key e o value que tera no final do topico
    0.9

    <attribute key="charges" value="2"/>
    Cargas de sua arma ou rune.
     
    1.0

    <attribute key="showcharges" value="1"/>
    Como nome ja diz, showcharges, para mostrar as cargas do seu item 0 pra falso e 1 pra verdadeiro.
     
    1.1

    <attribute key="runeSpellName" value="adori mas frigo"/>
    Palavras da spell para fazer a runa (tambem precisa fazer em spell.xml ensinado ao final do topico)
     
    1.2

    <attribute key="shootType" value="fire"/>
    Tipo do tiro, usado em muniçoes e wands de attack ranged.
    1.3

    <attribute key="range" value="3"/>
    Alcance de uma bolt ou qualquer outra muniçao, ou de uma wand. (nunca testei em uma arma de perto creio que nao pegue)
    1.4

    <attribute key="absorbPercentAll" value="80"/>
    Essa tag absorve o dano de todos os tipos em 80% (Nao conheço muitos tipos mais irei dar alguns)
     
    1.5

    <attribute key="transformDeEquipTo" value="2168"/>
    Quando desequipar transforma no item 2168 (Tem que mecher em movements, ensinado no final do topico)
     
    1.6

    <attribute key="duration" value="480"/>
    Usado em botas e aneis que dao alguma coisa.
     
    1.7

    <attribute key="healthGain" value="1"/> <attribute key="healthTicks" value="1000"/>
    healthGain = Quanto de life ele vai ganhar// healthTicks = De quantos segundos ele vai ganhar (milesegundos) que eh 1000 = 1 segundo
     
    1.8

    <attribute key="manaGain" value="4"/> <attribute key="manaTicks" value="1000"/>
    Mesma coisa que o de cima soh que com mana.
     
    1.9

    <attribute key="decayTo" value="0"/>
    Usado com a tag duration, para quando a duration acabar ele sumir, ou virar outra coisa (como a soft boots)
    2.0

    <attribute key="magiclevelpoints" value="1"/>
    Ira dar 1 magic level ao equipar (Tem que mecher em movements)
    2.1

    <attribute key="skillAxe" value="2"/>
    Alemnta 2 skill em axe (Tem que mecher em movements)
     
    2.2

    <attribute key="slotType" value="ring"/>
    Usa-se em rings e armors, pois nos outros ja tem o weaponType, para usar em armor o value eh body, e para fazer armas de duas maos é two-handed
     
    2.3

    <attribute key="breakChance" value="0"/>
    Chance de quebrar em %
     
    Values e Atributes variaveis e mechendo em movements:
     
     
     
    Duvidas,sugestões,elogios aceitos neste topico
  25. Upvote
    MatheusGlad recebeu reputação de angelodias em [Encerrado] Como Mudar O Acc Manager?   
    kara eu n posso afirmar mais crio que se voce mudar os nomes das vocaçoes vai mudar no acc manager sozinho (creio eu) se nao mudar, eu acho que voce teria que mecher nas source, so oq eu tenho pra dizer
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...