Ir para conteúdo

Oneshot

Marquês
  • Total de itens

    1347
  • Registro em

  • Última visita

  • Dias Ganhos

    36

Histórico de Reputação

  1. Upvote
    Oneshot recebeu reputação de Administrador em Pequeno erro ao compilar alguem pode me ajudar?   
    Verifique se você baixou o SDK do projeto The Forgotten Server e também o conjunto de libraries do Boost C++.
     
    TFS SDK Boost C++ (32-bit, 64-bit) Até mais.
  2. Upvote
    Oneshot recebeu reputação de Luga03 em Oneshot's Death Note   
    Faaala, pessoar.
     
    Há um tempo vi em uma comunidade gringa um script super criativo que se baseava no anime Death Note. Através da função onTextEdit(cid, item, newText), o scripter criou um livro que matava jogadores cujo nome fosse escrito.
     
    Mas era um código simples e limitado, você só podia matar um jogador por vez e o livro se tornava inútil depois disso.
     
    Então resolvi criar meu próprio Death Note com alguns bônus.
     
    - Você pode matar um número de jogadores configurável por vez, ou ilimitados se for CM ou mais.
    - Existe um delay entre a escrita do nome e a morte do alvo de 40 segundos. (Igual o anime)
    - Depois de escritos os nomes, o jogador que usou o Death Note, fica impossibilitado de usar denovo por 30 minutos. (Sem exhaust para CMs ou mais)
    - Jogadores com red skull ou black skull não podem ser mortos pelo Death Note.
    - O livro não se inutiliza.
     
    Bom, vamos começar?
     

     
    1 - Vá em seus items.xml e troque os atributos dos seguintes itens:
     

    <item id="1972" article="a" name="death note"> <attribute key="weight" value="1000"> <attribute key="writeable" value="1"> <attribute key="maxTextLen" value="512"> <attribute key="writeOnceItemId" value="1955"> </item>
     

    <item id="1955" article="a" name="death note"> <attribute key="weight" value="1000"> </item>
     
    2 - Vá em creaturescripts/scripts, crie um arquivo chamado deathnote.lua e cole o seguinte script abaixo:
     

    local deathnote = { max = 3, delay = 40, interval = 30 * 60 } local function DeathNote(param) if isCreature(param.target) then local position, damage = getThingPosition(param.target), getCreatureMaxHealth(param.target) return doAreaCombatHealth(0, COMBAT_DEATHDAMAGE, getThingPosition(param.target), 0, -(damage * 10), -(damage * 10), CONST_ME_MORTAREA) end end function onTextEdit(cid, item, newText) if item.itemid == 1972 then newText = string.explode(newText, "\n") if #newText > deathnote.max and getPlayerGroupId(cid) == 1 then doPlayerSendCancel(cid, "Sorry, but you cannot kill more than ".. deathnote.max .." players.") else if os.time() > getPlayerStorageValue(cid, 101011) or getPlayerGroupId(cid) > 3 then for _, name in ipairs(newText) do local target = getPlayerByNameWildcard(name) if target then if getCreatureSkullType(cid) >= 4 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, but ".. name .." cannot die by the power of Death Note.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, name .." will die in ".. deathnote.delay .." seconds.") setPlayerStorageValue(cid, 101011, os.time() + deathnote.interval) addEvent(DeathNote, deathnote.delay * 1000, {target = target}) end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, but ".. name .." isn't in this world.") end end else doPlayerSendCancel(cid, "You are exhausted to use Death Note.") end end return false end return true end
     
    3 - Ainda em creaturescripts/scripts, abra o arquivo login.lua e adicione a seguinte linha:
     

    registerCreatureEvent(cid, "DeathNote")
     
    Antes de:
     

    return true
     
    4 - Abra o arquivo creaturescripts.xml e adicione a seguinte chave.
     

    <event type="textedit" name="DeathNote" event="script" value="deathnote.lua"/>
     

     
    Para usar o Death Note depois de instalado o script, basta dar Use no livro e escrever um nome em cada linha dando Enter depois. Por exemplo:
     
     
    E por aí vai.
  3. Upvote
    Oneshot recebeu reputação de Arisen Trapzer em Forge System   
    ADVANCED FORGE SYSTEM



    O SISTEMA DE CRIAÇÃO DE ITENS PARA SEU SERVIDOR


     

     
    Creio que muitos já conhecem o sistema de forja criado por mim, acontece que o código já estava um pouco obsoleto, então resolvi reescrever ele do 0.
     
    Simplesmente consiste em um sistema de criação de itens avançado que ressuscita um pouco do RPG perdido nos servidores de hoje em dia. O jogador poderá criar itens através de forja, agindo como um verdadeiro ferreiro medieval. Adiciona itens em cima de uma bigorna previamente colocada no mapa e com um martelo cria um item totalmente novo.
     
    CARACTERÍSTICAS DA VERSÃO FINAL:
     
    - Configuração intuitiva e fácil de compreender;
    - Mini-tutorial auxiliando criação de novas receitas;
    - Receitas podem conter até 250 itens diferentes com suas respectivas quantidades;
    - Sistema inteligente que identifica uma receita em qualquer ordem;
    - Código totalmente orientado a objetos;
    - Possibilidade de configurar diferentes requerimentos, diferentes skills, magic level e level
     

     
    Há dois modos de instalar o Advanced Forge System, o primeiro é seguir os passos deste tópico e o segundo e baixar pasta data/ anexada no tópico com os arquivos em seus respectivos diretórios, precisando apenas o registro das chaves nos arquivos XML.
     
    Escolha o modo que mais convém a você.
     

     
     
    Crie um arquivo em data/lib chamado forgesystem.lua e cole o conteúdo abaixo:
     

    --[[ ADVANCED FORGE SYSTEM FINAL Criado por Oneshot É proibido a venda ou a cópia sem os devidos créditos desse script. ]]-- RecipeHandler = { itemtype = 0, items = {}, level = 1, maglevel = 0, skills = {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0} } Forge = { type = nil, position = nil, magicEffect = CONST_ME_MAGIC_GREEN, messages = { class = MESSAGE_STATUS_DEFAULT, success = "You have successfully forged a %s.", needskill = "You don't have enough %s to create a %s.", needlevel = "You need level %s to create a %s.", needmaglevel = "You need magic level %s to create a %s." } } function RecipeHandler:new(itemtype, items, level, maglevel, skills) local obj = { itemtype = (itemtype or 0), items = (items or {}), level = (level or 1), maglevel = (maglevel or 0), skills = (skills or {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0}) } table.insert(Recipes, obj) return setmetatable(obj, {__index = self}) end function RecipeHandler:setItem(itemtype) self.itemtype = (itemtype or 0) end function RecipeHandler:setRecipe(...) self.items = {...} end function RecipeHandler:setRecipeItem(itemid, amount) table.insert(self.items, {itemid, amount}) end function RecipeHandler:setSkill(skillid, value) self.skills[skillid] = value end function RecipeHandler:setLevel(value) self.level = value end function RecipeHandler:setMagLevel(value) self.maglevel = value end function RecipeHandler:check(position) local match = false for n, item in ipairs(self.items) do local thing = getTileItemById(position, item[1]) if thing.uid > 0 and math.max(1, thing.type) >= item[2] then if n == #self.items then match = true end else break end end return match end function RecipeHandler:get(position) if self:check(position) == true then return setmetatable({type = self, position = position}, {__index = Forge}) end return false end function Forge:create(cid) if self.type.itemid == 0 then print("[FORGE SYSTEM - ERROR] ATTEMPT TO CREATE A RECIPE ITEMID 0") return end local status = true if(cid) then if getPlayerLevel(cid) < self.type.level then doPlayerSendTextMessage(cid, self.messages.class, self.messages.needlevel:format(self.type.level, getItemNameById(self.type.itemtype))) return end if getPlayerMagLevel(cid) < self.type.maglevel then doPlayerSendTextMessage(cid, self.messages.class, self.messages.needmaglevel:format(self.type.maglevel, getItemNameById(self.type.itemtype))) return end for skillid, value in pairs(self.type.skills) do if getPlayerSkillLevel(cid, skillid) < value then status = false doPlayerSendTextMessage(cid, self.messages.class, self.messages.needskill:format(SKILL_NAMES[skillid], getItemNameById(self.type.itemtype))) break end end end if status == true then for _, item in ipairs(self.type.items) do local thing = getTileItemById(self.position, item[1]) doRemoveItem(thing.uid, item[2]) end doSendMagicEffect(self.position, self.magicEffect) doPlayerSendTextMessage(cid, self.messages.class, self.messages.success:format(getItemNameById(self.type.itemtype))) doCreateItem(self.type.itemtype, self.position) end end dofile(getDataDir() .."/lib/recipes.lua")
     
    Crie um arquivo em data/lib chamado recipes.lua e adicione o conteúdo abaixo:
     

    ---------------------------------------- -----** TUTORIAL DE CONFIGURAÇÃO **----- ---------------------------------------- --[[ O 'ADVANCED FORGE SYSTEM' é muito fácil e intuitivo de configurar, você só precisa chamar a função RecipeHandler:new(...), sendo que você já configurar os atributos da receita nela ou usar outras funções para isso. Por exemplo, quero criar uma Magic Sword que precise de 100 Gold Nuggets. RecipeHandler:new(2400, {{2157, 100}}) Ou então Magic_Sword = RecipeHandler:new() Magic_Sword:setItem(2400) Magic_Sword:setRecipe({2157, 100}) Funções do Sistema: RecipeHandler:new(itemtype, items, level, maglevel, skills) --> Cria uma nova instância de forja. RecipeHandler:setItem(itemtype) --> Atribui um certo itemid como resultado da receita. RecipeHandler:setRecipe(recipe) --> Atribui uma receita. RecipeHandler:setRecipeItem(itemid, amount) --> Adiciona um itemid e sua quantidade a receita. RecipeHandler:setSkill(skillid, value) --> Atribui um valor necessário de uma certa skill para poder criar a receita. RecipeHandler:setLevel(value) --> Atribui o level necessário para criar uma receita. RecipeHandler:setMagLevel(value) --> Atribui o magic level necessário para criar uma receita. ]]-- --[[ Este é um exemplo de receita usando algumas funções. É uma Magic Sword (ITEMID: 2400) que precisa de 100 Gold Nuggets (ITEMID: 2157), além disso, o personagem que tentar forjar, precisa ter Level 100 e Sword Fighting 50. ]]-- Recipes = {} magicsword = RecipeHandler:new() magicsword:setItem(2400) magicsword:setRecipeItem(2157, 100) magicsword:setLevel(100) magicsword:setSkill(2, 50)
     
    Agora em data/actions/scripts, crie um arquivo chamado iron_hammer.lua e adicione o conteúdo abaixo:
     

    function onUse(cid, item, fromPosition, itemEx, toPosition) local recipe = nil for _, v in ipairs(Recipes) do recipe = v:get(toPosition) if(recipe ~= false) then break end end if(recipe) then recipe:create(cid) else doPlayerSendCancel(cid, "This is not a valid recipe.") end return true end
     
    E por fim em actions.xml, adicione a seguinte linha:
     

    <action itemid="4846" event="script" value="iron_hammer.lua"/>
     
    OPCIONAL - TALKACTION
     
    A talkaction abaixo mostra ao jogadoras receitas configuradas no servidor que ele pode fazer.
     
    Em data/talkactions/scripts, crie um arquivo chamado recipes.lua e adicione o conteúdo abaixo:
     

    function onSay(cid, words, param, channel) local ret = {} local msg = " ADVANCED FORGE SYSTEM\n" for _, recipe in ipairs(Recipes) do local skills = true for skillid, value in pairs(recipe.skills) do if getPlayerSkillLevel(cid, skillid) < value then skills = false break end end if skills == true then if getPlayerLevel(cid) >= recipe.level and getPlayerMagLevel(cid) >= recipe.maglevel then table.insert(ret, {recipe, true}) else table.insert(ret, {recipe, false}) end else table.insert(ret, {recipe, false}) end end for _, recipe in ipairs(ret) do msg = msg .."\nRecipe for ".. getItemNameById(recipe[1].itemtype) ..":\n\n" if recipe[2] == true then for _, item in ipairs(recipe[1].items) do msg = msg .."* ".. getItemNameById(item[1]) .." [".. math.min(item[2], math.max(0, getPlayerItemCount(cid, item[1]))) .."/".. item[2] .."]\n" end else msg = msg .."[LOCKED]\n" end end doShowTextDialog(cid, 2555, msg) return true end
     
    Em data/talkactions/talkactions.xml, adicione a linha:
     

    <talkaction words="/recipes" event="script" value="recipes.lua"/>
     

     
    Siga as instruções para configuração de novas receitas.
     
    Em breve vídeo de funcionamento
    Advanced Forge System.rar
  4. Upvote
    Oneshot recebeu reputação de RigBy em Spread Loot   
    Spread Loot
    Este é um pedido feito no tópico A Fábrica

    Boa noite, galera.
     
    Este é o primeiro pedido atendido no meu tópico A Fábrica, foi um pedido feito pelo usuário OriGM.
     
    Consiste em um sistema de "espalhar" o loot do monstro em uma área delimitada de 1 sqm, torna o jogo bem real, afinal muitos MMORPGs, como Mu Online, Ragnarok, entre outros, "espalham" seu loot.
     
    Não tive como fazer diferentes testes, mas acho que funciona muito bem e não tem bugs severos, como criar itens em tiles bloqueados.
     
    A instalação é fácil como qualquer creaturescript.
     
    spreadloot.lua
    local function doSpreadLoot(fromPosition, toPosition, container) for slot = (getContainerSize(container.uid) - 1), 0, -1 do local item = getContainerItem(container.uid, slot) if not isContainer(item.uid) then local position = { x = math.random(fromPosition.x, toPosition.x), y = math.random(fromPosition.y, toPosition.y), z = fromPosition.z, } local itemEx = doCreateItemEx(item.itemid, item.type) if doTileAddItemEx(position, itemEx) then doRemoveItem(item.uid) end else doSpreadLoot(fromPosition, toPosition, item) doRemoveItem(item.uid) end end return true end function onKill(cid, target) if isMonster(target) then local position = getCreaturePosition(target) local name = getCreatureName(target) local fromPosition = {x = position.x - 1, y = position.y - 1, z = position.z} local toPosition = {x = position.x + 1, y = position.y + 1, z = position.z} addEvent(function() local container = getTileItemById(position, getMonsterInfo(name).lookCorpse) if container.uid > 0 then doSpreadLoot(fromPosition, toPosition, container) end end, 100) end return true end login.lua
    registerCreatureEvent(cid, "SpreadLoot") creaturescripts.xml
    <event type="kill" name="SpreadLoot" event="script" value="lootsystem.lua"/> Bom, isso é tudo, minha galera.
     
    Att,
    Oneshot Garou
  5. Upvote
    Oneshot recebeu reputação de Yan Oliveira em Me desejem boa sorte   
    Não, você não vai ter tempo para "upar" Xerife Wood nenhum.
     
    Porque você vai trabalhar muito para sustentar a criança e sua namorada. E talvez em um sub-emprego porque nem tempo de estudar teve, com 17 anos. Então toma vergonha na cara e usa camisinha da próxima vez que transar.
     
    Perdão a grosseria, mas é a realidade, não vou conseguir te dar parabéns, mas posso te dar boa sorte, pois é o que vai precisar.
  6. Upvote
    Oneshot recebeu reputação de gabriel28 em Mega War's Spirit Gems   
    Nome: Mega War's Spirit Gems
    Tipo: Action
    Autor: Oneshot
     

     
    Grande Éks.
     
    Uma coisa que eu adoro fazer quando estou sem nada para fazer õ_o É reproduzir sistemas de servidores/projetos famosos para testar atÉ onde posso chegar com a programação Lua.
     
    Notei que muita gente cobiça pelo sistema de Spirit Gems do servidor Mega War, então eu resolvi criar uma rÉplica não tão fiel desse sistema com base no que há disponível no site deles. Lá diz que são itens que adicionam certos atributos por tempo.
     
    Como eu achei muito simples, eu adicionei algumas frescurinhas, um efeito mágico sendo enviado enquanto os atributos que o item dá durarem.
     
    O sistema está bem fácil de configurar e intuitivo e isso É o que importa. Vamos lá.
     

     
    Abra seu arquivo items.xml e procure por isto:
     

    <item id="2153" article="a" name="violet gem"> <attribute key="weight" value="30"> </item> <item id="2154" article="a" name="yellow gem"> <attribute key="weight" value="30"> </item>
     
    Substitua por isso:
     

    <item id="2153" article="a" name="knight spirit gem"> <attribute key="description" value="Free the strongest medieval warrior's spirit that is inside you. (Melee +12%, Speed +40)"> <attribute key="weight" value="30"> </item> <item id="2154" article="a" name="paladin spirit gem"> <attribute key="description" value="Free the strongest medieval archer's spirit that is inside you. (Distance +12%, Speed +40)"> <attribute key="weight" value="30"> </item>
     
    Mais uma vez, procure por isso:
     

    <item id="2156" article="a" name="red gem"> <attribute key="weight" value="30"> </item> <item id="2157" article="a" name="gold nugget" plural="gold nuggets"> <attribute key="weight" value="10"> </item> <item id="2158" article="a" name="blue gem"> <attribute key="weight" value="100"> </item>
     
    Substitua por isso:
     

    <item id="2156" article="a" name="sorcerer spirit gem"> <attribute key="description" value="Free the strongest medieval mage's spirit that is inside you. (Magic +12%, Speed +40)"> <attribute key="weight" value="30"> </item> <item id="2157" article="a" name="gold nugget" plural="gold nuggets"> <attribute key="weight" value="10"> </item> <item id="2158" article="a" name="druid spirit gem"> <attribute key="description" value="Free the strongest medieval mage's spirit that is inside you. (Magic +12%, Speed +40)"> <attribute key="weight" value="100"> </item>
     
    Agora, crie um arquivo chamado gems.lua na pasta data/actions/scripts e adicione isso:
     

    local GemsConfig = { [2153] = { vocations = {4, 8}, effect = CONST_ME_EXPLOSIONAREA, conditions = { [CONDITION_ATTRIBUTES] = { [CONDITION_PARAM_TICKS] = 3 * 60 * 60 * 1000, [CONDITION_PARAM_SKILL_MELEEPERCENT] = 112, [CONDITION_PARAM_BUFF] = true, [CONDITION_PARAM_SUBID] = 200 }, [CONDITION_HASTE] = { [CONDITION_PARAM_TICKS] = 3 * 60 * 60 * 1000, [CONDITION_PARAM_SPEED] = 40 } } }, [2154] = { vocations = {3, 7}, effect = CONST_ME_HOLYDAMAGE, conditions = { [CONDITION_ATTRIBUTES] = { [CONDITION_PARAM_TICKS] = 3 * 60 * 60 * 1000, [CONDITION_PARAM_SKILL_DISTANCEPERCENT] = 112, [CONDITION_PARAM_BUFF] = true, [CONDITION_PARAM_SUBID] = 200 }, [CONDITION_HASTE] = { [CONDITION_PARAM_TICKS] = 3 * 60 * 60 * 1000, [CONDITION_PARAM_SPEED] = 40 } } }, [2156] = { vocations = {1, 5}, effect = CONST_ME_MORTAREA, conditions = { [CONDITION_ATTRIBUTES] = { [CONDITION_PARAM_TICKS] = 3 * 60 * 60 * 1000, [CONDITION_PARAM_STAT_MAGICLEVELPERCENT] = 112, [CONDITION_PARAM_BUFF] = true, [CONDITION_PARAM_SUBID] = 200 }, [CONDITION_HASTE] = { [CONDITION_PARAM_TICKS] = 3 * 60 * 60 * 1000, [CONDITION_PARAM_SPEED] = 40 } } }, [2158] = { vocations = {2, 6}, effect = CONST_ME_SMALLPLANTS, conditions = { [CONDITION_ATTRIBUTES] = { [CONDITION_PARAM_TICKS] = 3 * 60 * 60 * 1000, [CONDITION_PARAM_STAT_MAGICLEVELPERCENT] = 112, [CONDITION_PARAM_BUFF] = true, [CONDITION_PARAM_SUBID] = 200 }, [CONDITION_HASTE] = { [CONDITION_PARAM_TICKS] = 3 * 60 * 60 * 1000, [CONDITION_PARAM_SPEED] = 40 } } } } local Conditions = {} for itemid, info in pairs(GemsConfig) do Conditions[itemid] = {} for condition, parameters in pairs(info.conditions) do local new = createConditionObject(condition) for parameter, value in pairs(parameters) do setConditionParam(new, parameter, value) end table.insert(Conditions[itemid], new) end end local function doShowGemAura(cid, type) local position = getThingPosition(cid) doSendMagicEffect(position, type) if isCreature(cid) then if getCreatureCondition(cid, CONDITION_ATTRIBUTES, 200) then addEvent(doShowGemAura, 1 * 1000, cid, type) end end return true end function onUse(cid, item, fromPosition, itemEx, toPosition) if not GemsConfig[item.itemid] then return false end if not isInArray(GemsConfig[item.itemid].vocations, getPlayerVocation(cid)) then return doPlayerSendCancel(cid, "You cannot use this spirit gem.") end if getCreatureCondition(cid, CONDITION_ATTRIBUTES, 200) then return false end for _, condition in pairs(Conditions[item.itemid]) do doAddCondition(cid, condition) end doCreatureSay(cid, "AAAAH! I FEEL THE POWER!", TALKTYPE_ORANGE_1) doSendMagicEffect(toPosition, GemsConfig[item.itemid].effect) addEvent(doShowGemAura, 1 * 1000, cid, GemsConfig[item.itemid].effect) doRemoveItem(item.uid, 1) return true end
     
    Abra seu arquivo actions.xml e adicione isso:
     

    <action itemid="2153;2154;2156;2158" event="script" value="gems.lua"/>
     
    Caso você queria adicionar a restrição do utito tempo enquanto o efeito da spirit gem durar, abra o arquivo do utito tempo, apague tudo e coloque isso:
     
    Ele normalmente está em data/spells/scripts/support.
     

    local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false) local condition = createConditionObject(CONDITION_ATTRIBUTES) setConditionParam(condition, CONDITION_PARAM_TICKS, 10000) setConditionParam(condition, CONDITION_PARAM_SKILL_MELEEPERCENT, 135) setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELDPERCENT, -100) setConditionParam(condition, CONDITION_PARAM_BUFF, true) setCombatCondition(combat, condition) function onCastSpell(cid, var) if getCreatureCondition(cid, CONDITION_ATTRIBUTES, 200) then return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) end return doCombat(cid, combat, var) end
     

     
    Não sei se está 100% fiel ao sistema do Mega War, uma vez que não pagarei para provar isso.
     
    Um abração.
  7. Upvote
    Oneshot recebeu reputação de Skulls em Outfits   
    OUTFITS


    Atributos e Configurações




    Olá, pessoal.

    Muitas pessoas não sabem, mas você pode adicionar vários bônus às outfits diretamente pelo outfits.xml, sem precisar de nenhum creaturescript que eventualmente possa dar lag em um servidor com muitos jogadores.

    Com este tutorial, você aprenderá a configurar vários tipos de bônus e até especificar se são necessários addons para ativar esses bônus.



    Para começar, vou colar abaixo o conteúdo de um outfits.xml do The Forgotten Server trunk.r3884 (0.4.0), vamos trabalhar em cima dele:




    <?xml version="1.0"?>
    <outfits>
    <outfit id="1">
    <list gender="0" lookType="136" name="Citizen"/>
    <list gender="1" lookType="128" name="Citizen"/>
    </outfit>

    <outfit id="2">
    <list gender="0" lookType="137" name="Hunter"/>
    <list gender="1" lookType="129" name="Hunter"/>
    </outfit>

    <outfit id="3">
    <list gender="0" lookType="138" name="Mage"/>
    <list gender="1" lookType="130" name="Mage"/>
    </outfit>

    <outfit id="4">
    <list gender="0" lookType="139" name="Knight"/>
    <list gender="1" lookType="131" name="Knight"/>
    </outfit>

    <outfit id="5" premium="yes">
    <list gender="0" lookType="140" name="Noblewoman"/>
    <list gender="1" lookType="132" name="Nobleman"/>
    </outfit>

    <outfit id="6" premium="yes">
    <list gender="0" lookType="141" name="Summoner"/>
    <list gender="1" lookType="133" name="Summoner"/>
    </outfit>

    <outfit id="7" premium="yes">
    <list gender="0" lookType="142" name="Warrior"/>
    <list gender="1" lookType="134" name="Warrior"/>
    </outfit>

    <outfit id="8" premium="yes">
    <list gender="0" lookType="147" name="Barbarian"/>
    <list gender="1" lookType="143" name="Barbarian"/>
    </outfit>

    <outfit id="9" premium="yes">
    <list gender="0" lookType="148" name="Druid"/>
    <list gender="1" lookType="144" name="Druid"/>
    </outfit>

    <outfit id="10" premium="yes">
    <list gender="0" lookType="149" name="Wizard"/>
    <list gender="1" lookType="145" name="Wizard"/>
    </outfit>

    <outfit id="11" premium="yes">
    <list gender="0" lookType="150" name="Oriental"/>
    <list gender="1" lookType="146" name="Oriental"/>
    </outfit>

    <outfit id="12" premium="yes" default="0">
    <list gender="0" lookType="155" name="Pirate"/>
    <list gender="1" lookType="151" name="Pirate"/>
    </outfit>

    <outfit id="13" premium="yes" default="0">
    <list gender="0" lookType="156" name="Assassin"/>
    <list gender="1" lookType="152" name="Assassin"/>
    </outfit>

    <outfit id="14" premium="yes" default="0">
    <list gender="0" lookType="157" name="Beggar"/>
    <list gender="1" lookType="153" name="Beggar"/>
    </outfit>

    <outfit id="15" premium="yes" default="0">
    <list gender="0" lookType="158" name="Shaman"/>
    <list gender="1" lookType="154" name="Shaman"/>
    </outfit>

    <outfit id="16" premium="yes" default="0">
    <list gender="0" lookType="252" name="Norsewoman"/>
    <list gender="1" lookType="251" name="Norseman"/>
    </outfit>

    <outfit id="17" premium="yes" default="0">
    <list gender="0" lookType="269" name="Nightmare"/>
    <list gender="1" lookType="268" name="Nightmare"/>
    </outfit>

    <outfit id="18" premium="yes" default="0">
    <list gender="0" lookType="270" name="Jester"/>
    <list gender="1" lookType="273" name="Jester"/>
    </outfit>

    <outfit id="19" premium="yes" default="0">
    <list gender="0" lookType="279" name="Brotherhood"/>
    <list gender="1" lookType="278" name="Brotherhood"/>
    </outfit>

    <outfit id="20" premium="yes" default="0">
    <list gender="0" lookType="288" name="Demonhunter"/>
    <list gender="1" lookType="289" name="Demonhunter"/>
    </outfit>

    <outfit id="21" premium="yes" default="0">
    <list gender="0" lookType="324" name="Yalaharian"/>
    <list gender="1" lookType="325" name="Yalaharian"/>
    </outfit>

    <outfit id="22" default="0">
    <list gender="0" lookType="336" name="Warmaster"/>
    <list gender="1" lookType="335" name="Warmaster"/>
    </outfit>

    <outfit id="23" premium="yes" default="0">
    <list gender="0" lookType="366" name="Wayfarer"/>
    <list gender="1" lookType="367" name="Wayfarer"/>
    </outfit>

    <outfit id="24" premium="yes" default="0">
    <list gender="0" lookType="329" name="Wedding"/>
    <list gender="1" lookType="328" name="Wedding"/>
    </outfit>
    </outfits>
    [/code]

    [font=verdana,geneva,sans-serif]Existem diferentes tipos de atributos que você pode colocar na sua outfit, por exemplo, você pode colocar para quando um jogador estiver usando[b] X[/b] outfit, ele receba uma certa chance de refletir danos de um certo elemento. Vamos aprender abaixo a configuração de atributos do jogador.[/font]

    [font=verdana,geneva,sans-serif][hr][/font]

    [font=verdana,geneva,sans-serif]Para configurar atributos é muito simples, destacarei a outfit [b]Citizen[/b] para esse exemplo:[/font]

    <outfit id="1"> <list gender="0" lookType="136" name="Citizen"/> <list gender="1" lookType="128" name="Citizen"/> </outfit>

    Suponhamos que eu queira que quando um jogador estiver usando a outfit Citizen, ele receba speed +10 e recupere 30 de HP a cada 5 segundos, basta adicionar isso:


    <outfit id="1"> <list gender="0" lookType="136" name="Citizen" healthGain="30" healthTicks="5" speed="10" /> <list gender="1" lookType="128" name="Citizen" healthGain="30" healthTicks="5" speed="10" /> </outfit>

    Você pode diferenciar os tipos de bônus primários pelo sexo do jogador. Os bônus primários disponíveis são estes abaixo:


    manaShield invisible healthGain healthTicks manaGain manaTicks speed

    Agora existem bônus secundários que é necessária uma pequena edição na estrutura da configuração da outfit, vejamos abaixo:


    <outfit id="1"> <list gender="0" lookType="136" name="Citizen"/> <list gender="1" lookType="128" name="Citizen"/> </outfit>

    Estes bônus secundários variam desde pontos fixos em skills até chance de refletir algo ou absorver. Só que para que eles funcionem corretamente, você precisa "abrir" a configuração da outfit.

    Por exemplo, a outfit Citizen nos dará +50 de HPmáx e +1 em todas as skills de combate corporal. Vejamos:


    <outfit id="1"> <list gender="0" lookType="136" name="Citizen"> <stats maxHealth="50"/> <skills melee="1"/> </list> <list gender="1" lookType="128" name="Citizen"> <stats maxHealth="50"/> <skills melee="1"/> </list> </outfit>

    Veja que literalmente eu abri a outfit Citizen em sub-listas declarando atributos diferentes para elas, segue abaixo uma pequena lista de cada atributo e em que sub-lista ele deve ser declarado:

    stats

    maxHealth maxMana soul level magLevel || magicLevel maxHealthPercent maxManaPercent soulPercent levelPercent magLevelPercent || magicLevelPercent

    skills

    fist club sword axe distance || dist shielding || shield fishing || fish melee weapon fistPercent clubPercent swordPercent axePercent distancePercent || distPercent shieldingPercent || shieldPercent fishingPercent || fishPercent meleePercent weaponPercent || weaponsPercent

    Lembra que no começo desse tutorial, eu disse que era possível configurar chance de reflexão e absorção para as outfits? Pois é, é possível sim. Vamos pegar um exemplo diferente agora, a outfit Wizard.


    <outfit id="10" premium="yes"> <list gender="0" lookType="149" name="Wizard"/> <list gender="1" lookType="145" name="Wizard"/> </outfit>

    Vamos dizer que a outfit Wizard com addons completos dará a chance de 10% de refletir 25% do dano feito por elementos (Fire, Earth, Ice, Energy). Para fazer isso, é o mesmo esquema de stats e skills, só que o nome da sub-lista deve ser reflect ou absorb. Dependendo do que você quer que a outfit faça, refletir ou absorver.


    <outfit id="10" premium="yes"> <list gender="0" lookType="149" name="Wizard"> <reflect percentElements="25" chanceElements="10"/> </list> <list gender="1" lookType="145" name="Wizard"> <reflect percentElements="25" chanceElements="10"/> </list> </outfit>

    Veja abaixo a lista dos possíveis atributos para reflect e absorb:


    percentAll percentElements percentMagic percentEnergy percentFire percentPoison || percentEarth percentIce percentHoly percentDeath percentLifeDrain percentManaDrain percentDrown percentPhysical percentHealing percentUndefined chanceAll chanceElements chanceMagic chanceEnergy chanceFire chancePoison || chanceEarth chanceIce chanceHoly chanceDeath chanceLifeDrain chanceManaDrain chanceDrown chancePhysical chanceHealing chanceUndefined

    Por último, você pode definir quando esses bônus são dados, seja quando o jogador está utilizando o primeiro addon, o segundo, qualquer um dos dois ou ambos. O atributo para isso é requirement.


    <outfit id="10" premium="yes"> <list gender="0" lookType="149" name="Wizard" requirement="any"> <reflect percentElements="25" chanceElements="10"/> </list> <list gender="1" lookType="145" name="Wizard" requirement="any"> <reflect percentElements="25" chanceElements="10"/> </list> </outfit>


    first second any both



    Existem alguns atributos que manipulam se o jogador pode usar a outfit, o mais conhecido deles é o premium que só permite o uso da outfit a jogadores premium.

    Mas muitos não conheçam os atributos quest, storageId e storageValue que torna possível dar outfits em quests, igual acontece no Tibia.

    Para isso, pegaremos qualquer outfit.


    <outfit id="20" premium="yes" default="0"> <list gender="0" lookType="288" name="Demonhunter"/> <list gender="1" lookType="289" name="Demonhunter"/> </outfit>

    Quando você usa o atributo quest com o valor igual a uma storage do servidor, a outfit só poderá ser usada se a storage tiver valor igual a 1. Por exemplo:


    <outfit id="20" premium="yes" quest="2005" default="0"> <list gender="0" lookType="288" name="Demonhunter"/> <list gender="1" lookType="289" name="Demonhunter"/> </outfit>

    Se a storage 2005 tiver valor igual a 1, então eu poderei usar a outfit Demonhunter. Mas e se eu estou trabalhando com uma grande quest que o valor final da storage é 3 e não 1? Por isso que existem os atributos storageId e storageValue.


    <outfit id="20" premium="yes" storageId="2005" storageValue="3" default="0"> <list gender="0" lookType="288" name="Demonhunter"/> <list gender="1" lookType="289" name="Demonhunter"/> </outfit>



    Bom, isso é tudo.

    Qualquer dúvida não deixe de postar no tópico.

    Abração \o/
  8. Upvote
    Oneshot recebeu reputação de raikilles em Forge System   
    ADVANCED FORGE SYSTEM



    O SISTEMA DE CRIAÇÃO DE ITENS PARA SEU SERVIDOR


     

     
    Creio que muitos já conhecem o sistema de forja criado por mim, acontece que o código já estava um pouco obsoleto, então resolvi reescrever ele do 0.
     
    Simplesmente consiste em um sistema de criação de itens avançado que ressuscita um pouco do RPG perdido nos servidores de hoje em dia. O jogador poderá criar itens através de forja, agindo como um verdadeiro ferreiro medieval. Adiciona itens em cima de uma bigorna previamente colocada no mapa e com um martelo cria um item totalmente novo.
     
    CARACTERÍSTICAS DA VERSÃO FINAL:
     
    - Configuração intuitiva e fácil de compreender;
    - Mini-tutorial auxiliando criação de novas receitas;
    - Receitas podem conter até 250 itens diferentes com suas respectivas quantidades;
    - Sistema inteligente que identifica uma receita em qualquer ordem;
    - Código totalmente orientado a objetos;
    - Possibilidade de configurar diferentes requerimentos, diferentes skills, magic level e level
     

     
    Há dois modos de instalar o Advanced Forge System, o primeiro é seguir os passos deste tópico e o segundo e baixar pasta data/ anexada no tópico com os arquivos em seus respectivos diretórios, precisando apenas o registro das chaves nos arquivos XML.
     
    Escolha o modo que mais convém a você.
     

     
     
    Crie um arquivo em data/lib chamado forgesystem.lua e cole o conteúdo abaixo:
     

    --[[ ADVANCED FORGE SYSTEM FINAL Criado por Oneshot É proibido a venda ou a cópia sem os devidos créditos desse script. ]]-- RecipeHandler = { itemtype = 0, items = {}, level = 1, maglevel = 0, skills = {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0} } Forge = { type = nil, position = nil, magicEffect = CONST_ME_MAGIC_GREEN, messages = { class = MESSAGE_STATUS_DEFAULT, success = "You have successfully forged a %s.", needskill = "You don't have enough %s to create a %s.", needlevel = "You need level %s to create a %s.", needmaglevel = "You need magic level %s to create a %s." } } function RecipeHandler:new(itemtype, items, level, maglevel, skills) local obj = { itemtype = (itemtype or 0), items = (items or {}), level = (level or 1), maglevel = (maglevel or 0), skills = (skills or {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0}) } table.insert(Recipes, obj) return setmetatable(obj, {__index = self}) end function RecipeHandler:setItem(itemtype) self.itemtype = (itemtype or 0) end function RecipeHandler:setRecipe(...) self.items = {...} end function RecipeHandler:setRecipeItem(itemid, amount) table.insert(self.items, {itemid, amount}) end function RecipeHandler:setSkill(skillid, value) self.skills[skillid] = value end function RecipeHandler:setLevel(value) self.level = value end function RecipeHandler:setMagLevel(value) self.maglevel = value end function RecipeHandler:check(position) local match = false for n, item in ipairs(self.items) do local thing = getTileItemById(position, item[1]) if thing.uid > 0 and math.max(1, thing.type) >= item[2] then if n == #self.items then match = true end else break end end return match end function RecipeHandler:get(position) if self:check(position) == true then return setmetatable({type = self, position = position}, {__index = Forge}) end return false end function Forge:create(cid) if self.type.itemid == 0 then print("[FORGE SYSTEM - ERROR] ATTEMPT TO CREATE A RECIPE ITEMID 0") return end local status = true if(cid) then if getPlayerLevel(cid) < self.type.level then doPlayerSendTextMessage(cid, self.messages.class, self.messages.needlevel:format(self.type.level, getItemNameById(self.type.itemtype))) return end if getPlayerMagLevel(cid) < self.type.maglevel then doPlayerSendTextMessage(cid, self.messages.class, self.messages.needmaglevel:format(self.type.maglevel, getItemNameById(self.type.itemtype))) return end for skillid, value in pairs(self.type.skills) do if getPlayerSkillLevel(cid, skillid) < value then status = false doPlayerSendTextMessage(cid, self.messages.class, self.messages.needskill:format(SKILL_NAMES[skillid], getItemNameById(self.type.itemtype))) break end end end if status == true then for _, item in ipairs(self.type.items) do local thing = getTileItemById(self.position, item[1]) doRemoveItem(thing.uid, item[2]) end doSendMagicEffect(self.position, self.magicEffect) doPlayerSendTextMessage(cid, self.messages.class, self.messages.success:format(getItemNameById(self.type.itemtype))) doCreateItem(self.type.itemtype, self.position) end end dofile(getDataDir() .."/lib/recipes.lua")
     
    Crie um arquivo em data/lib chamado recipes.lua e adicione o conteúdo abaixo:
     

    ---------------------------------------- -----** TUTORIAL DE CONFIGURAÇÃO **----- ---------------------------------------- --[[ O 'ADVANCED FORGE SYSTEM' é muito fácil e intuitivo de configurar, você só precisa chamar a função RecipeHandler:new(...), sendo que você já configurar os atributos da receita nela ou usar outras funções para isso. Por exemplo, quero criar uma Magic Sword que precise de 100 Gold Nuggets. RecipeHandler:new(2400, {{2157, 100}}) Ou então Magic_Sword = RecipeHandler:new() Magic_Sword:setItem(2400) Magic_Sword:setRecipe({2157, 100}) Funções do Sistema: RecipeHandler:new(itemtype, items, level, maglevel, skills) --> Cria uma nova instância de forja. RecipeHandler:setItem(itemtype) --> Atribui um certo itemid como resultado da receita. RecipeHandler:setRecipe(recipe) --> Atribui uma receita. RecipeHandler:setRecipeItem(itemid, amount) --> Adiciona um itemid e sua quantidade a receita. RecipeHandler:setSkill(skillid, value) --> Atribui um valor necessário de uma certa skill para poder criar a receita. RecipeHandler:setLevel(value) --> Atribui o level necessário para criar uma receita. RecipeHandler:setMagLevel(value) --> Atribui o magic level necessário para criar uma receita. ]]-- --[[ Este é um exemplo de receita usando algumas funções. É uma Magic Sword (ITEMID: 2400) que precisa de 100 Gold Nuggets (ITEMID: 2157), além disso, o personagem que tentar forjar, precisa ter Level 100 e Sword Fighting 50. ]]-- Recipes = {} magicsword = RecipeHandler:new() magicsword:setItem(2400) magicsword:setRecipeItem(2157, 100) magicsword:setLevel(100) magicsword:setSkill(2, 50)
     
    Agora em data/actions/scripts, crie um arquivo chamado iron_hammer.lua e adicione o conteúdo abaixo:
     

    function onUse(cid, item, fromPosition, itemEx, toPosition) local recipe = nil for _, v in ipairs(Recipes) do recipe = v:get(toPosition) if(recipe ~= false) then break end end if(recipe) then recipe:create(cid) else doPlayerSendCancel(cid, "This is not a valid recipe.") end return true end
     
    E por fim em actions.xml, adicione a seguinte linha:
     

    <action itemid="4846" event="script" value="iron_hammer.lua"/>
     
    OPCIONAL - TALKACTION
     
    A talkaction abaixo mostra ao jogadoras receitas configuradas no servidor que ele pode fazer.
     
    Em data/talkactions/scripts, crie um arquivo chamado recipes.lua e adicione o conteúdo abaixo:
     

    function onSay(cid, words, param, channel) local ret = {} local msg = " ADVANCED FORGE SYSTEM\n" for _, recipe in ipairs(Recipes) do local skills = true for skillid, value in pairs(recipe.skills) do if getPlayerSkillLevel(cid, skillid) < value then skills = false break end end if skills == true then if getPlayerLevel(cid) >= recipe.level and getPlayerMagLevel(cid) >= recipe.maglevel then table.insert(ret, {recipe, true}) else table.insert(ret, {recipe, false}) end else table.insert(ret, {recipe, false}) end end for _, recipe in ipairs(ret) do msg = msg .."\nRecipe for ".. getItemNameById(recipe[1].itemtype) ..":\n\n" if recipe[2] == true then for _, item in ipairs(recipe[1].items) do msg = msg .."* ".. getItemNameById(item[1]) .." [".. math.min(item[2], math.max(0, getPlayerItemCount(cid, item[1]))) .."/".. item[2] .."]\n" end else msg = msg .."[LOCKED]\n" end end doShowTextDialog(cid, 2555, msg) return true end
     
    Em data/talkactions/talkactions.xml, adicione a linha:
     

    <talkaction words="/recipes" event="script" value="recipes.lua"/>
     

     
    Siga as instruções para configuração de novas receitas.
     
    Em breve vídeo de funcionamento
    Advanced Forge System.rar
  9. Upvote
    Oneshot recebeu reputação de Furabio em Perfect Upgrade System   
    Nome: Perfect Upgrade System
    Tipo: Biblioteca, Action, Sistema
    Autor: Oneshot
     

     
    Essa é a versão final do Perfect Refine System ou Perfect Upgrade System criado por mim.
     
    É um sistema construído em cima de funções em POO (orientação a objetos), o que o torna muito versátil, possibilitando a outros programadores/scripters criarem seus próprios sistemas com base na biblioteca.
     
    A função do sistema é simples. Não passa de um sistema de refino, presente em todos os servidores, onde você usa um item em um equipamento e este fica mais forte e ganha um nome caracterizando o nível de força - bem clichê - mas muito interessante.
     
    Meu sistema é um pouco diferente dos outros, pois possui algumas características exclusivas, listadas abaixo:
    O nível máximo configurável é praticamente ilimitado
    O sistema funciona com armas de combate corpo-a-corpo, bows e crossbows.
    O refino pode falhar, não acontecendo nada, regredindo o nível ou resetando ele.
    Há um sistema nativo de broadcasts, que são enviados quando um jogador consegue refinar um equipamento até um certo nível ou maior.
    As chances são configuradas manualmente e sua randomização é muito precisa.


     
    Há dois modos de instalar o sistema em seu servidor, o primeiro é baixar a pasta com os scripts necessários e apenas copiar as chaves nos arquivos XMLs ou então seguir o curto tutorial de instalação.
     
     
    Crie um arquivo chamado upgradesystem.lua na pasta data/lib e copie o conteúdo abaixo:
     

    --[[ PERFECT UPGRADE SYSTEM 2.0 Criado por Oneshot É proibido a venda ou a cópia sem os devidos créditos desse script. ]]-- UpgradeHandler = { levels = { [1] = {100, false, false}, [2] = {90, false, false}, [3] = {75, false, false}, [4] = {60, true, false}, [5] = {45, true, false}, [6] = {30, true, false}, [7] = {25, true, false}, [8] = {20, true, true}, [9] = {15, true, true}, [10] = {10, true, true}, [11] = {10, true, true}, [12] = {5, true, true} }, broadcast = 7, attributes = { ["attack"] = 2, ["defense"] = 1, ["armor"] = 1 }, message = { console = "Trying to refine %s to level +%s with %s%% success rate.", success = "You have upgraded %s to level +%s", fail = "You have failed in upgrade of %s to level +%s", downgrade = "The upgrade level of %s has downgraded to +%s", erase = "The upgrade level of %s has been erased.", maxlevel = "The targeted %s is already on max upgrade level.", notupgradeable = "This item is not upgradeable.", broadcast = "The player %s was successful in upgrading %s to level +%s.\nCongratulations!!", invalidtool = "This is not a valid upgrade tool.", toolrange = "This upgrade tool can only be used in items with level between +%s and +%s" }, tools = { [8306] = {range = {0, 10}, info = {chance = 0, removeable = true}}, }, isEquipment = function(self) local weaponType = self:getItemWeaponType() return ((weaponType > 0 and weaponType < 7) or self.item.armor ~= 0) end, setItemName = function(self, name) return doItemSetAttribute(self.item.uid, "name", name) end, chance = function(self) local chances = {} chances.upgrade = (self.levels[self.item.level + 1][1] or 100) chances.downgrade = (self.item.level * 5) chances.erase = (self.item.level * 3) return chances end } function UpgradeHandler:new(item) local obj, ret = {} obj.item = {} obj.item.level = 0 obj.item.uid = item.uid for key, value in pairs(getItemInfo(item.itemid)) do obj.item[key] = value end ret = setmetatable(obj, {__index = function(self, index) if _G[index] then return (setmetatable({callback = _G[index]}, {__call = function(self, ...) return self.callback(item.uid, ...) end})) else return UpgradeHandler[index] end end}) if ret:isEquipment() then ret:update() return ret end return false end function UpgradeHandler:update() self.item.level = (tonumber(self:getItemName():match("%+(%d+)")) or 0) end function UpgradeHandler:refine(uid, item) if not self.item then doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_BLUE, self.message.notupgradeable) return "miss" end local tool = self.tools[item.itemid] if(tool == nil) then doPlayerSendTextMessage(uid, MESSAGE_EVENT_DEFAULT, self.message.invalidtool) return "miss" end if(self.item.level > #self.levels) then doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_RED, self.message.maxlevel:format(self.item.name)) return "miss" end if(self.item.level < tool.range[1] or self.item.level >= tool.range[2]) then doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_RED, self.message.toolrange:format(unpack(tool.range))) return "miss" end local chance = (self:chance().upgrade + tool.info.chance) doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_BLUE, self.message.console:format(self.item.name, (self.item.level + 1), math.min(100, chance))) if(tool.info.removeable == true) then doRemoveItem(item.uid, 1) end if chance * 100 > math.random(1, 10000) then doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_ORANGE, self.message.success:format(self.item.name, (self.item.level + 1))) if (self.item.level + 1) >= self.broadcast then doBroadcastMessage(self.message.broadcast:format(getCreatureName(uid), self.item.name, (self.item.level + 1))) end self:setItemName((self.item.level > 0 and self:getItemName():gsub("%+(%d+)", "+".. (self.item.level + 1)) or (self:getItemName() .." +1"))) for key, value in pairs(self.attributes) do if getItemAttribute(self.item.uid, key) ~= nil or self.item[key] ~= 0 then doItemSetAttribute(self.item.uid, key, (self.item.level > 0 and getItemAttribute(self.item.uid, key) or self.item[key]) + value) end end return "success" else if(self.levels[self.item.level][3] == true and (self:chance().erase * 100) > math.random(1, 10000)) then doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_RED, self.message.erase:format(self.item.name)) self:setItemName(self.item.name) for key, value in pairs(self.attributes) do if self.item[key] > 0 then doItemSetAttribute(self.item.uid, key, self.item[key]) end end elseif(self.levels[self.item.level][2] == true and (self:chance().downgrade * 100) > math.random(1, 10000)) then doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_RED, self.message.downgrade:format(self.item.name, (self.item.level - 1))) self:setItemName((self.item.level == 1 and self.item.name or self:getItemName():gsub("%+(%d+)", "+".. (self.item.level - 1)))) for key, value in pairs(self.attributes) do if getItemAttribute(self.item.uid, key) ~= nil or self.item[key] ~= 0 then doItemSetAttribute(self.item.uid, key, (self.item[key] + value * (self.item.level - 1))) end end else doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_RED, self.message.fail:format(self.item.name, (self.item.level + 1))) end return "fail" end end
     
    Crie um arquivo chamado upgrade.lua em data/actions/scripts e cole o conteúdo abaixo:
     

    function onUse(cid, item, fromPosition, itemEx, toPosition) if isCreature(itemEx.uid) then return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) end local obj = UpgradeHandler:new(itemEx) if(obj == false) then return doPlayerSendCancel(cid, UpgradeHandler.message.notupgradeable) end local status = obj:refine(cid, item) if status == "success" then --doSendAnimatedText(toPosition, "Success!", COLOR_GREEN) doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN) elseif status == "fail" then --doSendAnimatedText(toPosition, "Fail!", COLOR_RED) doSendMagicEffect(toPosition, CONST_ME_POFF) else doSendMagicEffect(toPosition, CONST_ME_POFF) end return true end
     
    No arquivo actions.xml, cole a seguinte linha:
     

    <action itemid="8306" event="script" value="upgrade.lua"/>
     
    Para adicionar mais níveis de refino no sistema, edite a seguinte tabela:
     

    levels = { [1] = {100, false, false}, [2] = {90, false, false}, [3] = {75, false, false}, [4] = {60, true, false}, [5] = {45, true, false}, [6] = {30, true, false}, [7] = {25, true, false}, [8] = {20, true, true}, [9] = {15, true, true}, [10] = {10, true, true} },
     
    Por padrão, ela já está configurado como na maioria dos MMORPGs, 10 níveis de refino, com chances de sucesso, regressão e "quebra".
     
    Mas se você quiser, por exemplo, adicionar mais dois níveis, siga o modelo, sempre colocando uma vírgula no final com exceção da última linha da tabela:
     

    levels = { [1] = {100, false, false}, [2] = {90, false, false}, [3] = {75, false, false}, [4] = {60, true, false}, [5] = {45, true, false}, [6] = {30, true, false}, [7] = {25, true, false}, [8] = {20, true, true}, [9] = {15, true, true}, [10] = {10, true, true}, [11] = {10, true, true}, [12] = {5, true, true} },
     
    O primeiro valor é chance de sucesso, o segundo se o item pode regredir na tentativa e o terceiro é se o item para "quebrar" (perder todo o nível de refino).
     
    Para criar novas ferramentas (itens) de refinar, configure a tabela abaixo:
     

    tools = { [8306] = {range = {0, 10}, info = {chance = 0, removeable = true}}, },
     
    Seguindo o mesmo esquema da tabela anterior, vírgulas em todas as linhas com exceção da última, seguindo o modelo abaixo.
     
    Por exemplo, uma ferramenta de ID 8303 que refine do level +6 ao +10, que dê 10% de chance bônus e que seja finita, eu faço assim:
     

    tools = { [8306] = {range = {0, 10}, info = {chance = 0, removeable = true}}, [8310] = {range = {6, 10}, info = {chance = 10, removeable = true}} },
     

     
    Em breve vídeo de demonstração com sistema em funcionamento.
    Perfect Upgrade System.rar
  10. Upvote
    Oneshot recebeu reputação de RigBy em Outfits   
    OUTFITS


    Atributos e Configurações




    Olá, pessoal.

    Muitas pessoas não sabem, mas você pode adicionar vários bônus às outfits diretamente pelo outfits.xml, sem precisar de nenhum creaturescript que eventualmente possa dar lag em um servidor com muitos jogadores.

    Com este tutorial, você aprenderá a configurar vários tipos de bônus e até especificar se são necessários addons para ativar esses bônus.



    Para começar, vou colar abaixo o conteúdo de um outfits.xml do The Forgotten Server trunk.r3884 (0.4.0), vamos trabalhar em cima dele:




    <?xml version="1.0"?>
    <outfits>
    <outfit id="1">
    <list gender="0" lookType="136" name="Citizen"/>
    <list gender="1" lookType="128" name="Citizen"/>
    </outfit>

    <outfit id="2">
    <list gender="0" lookType="137" name="Hunter"/>
    <list gender="1" lookType="129" name="Hunter"/>
    </outfit>

    <outfit id="3">
    <list gender="0" lookType="138" name="Mage"/>
    <list gender="1" lookType="130" name="Mage"/>
    </outfit>

    <outfit id="4">
    <list gender="0" lookType="139" name="Knight"/>
    <list gender="1" lookType="131" name="Knight"/>
    </outfit>

    <outfit id="5" premium="yes">
    <list gender="0" lookType="140" name="Noblewoman"/>
    <list gender="1" lookType="132" name="Nobleman"/>
    </outfit>

    <outfit id="6" premium="yes">
    <list gender="0" lookType="141" name="Summoner"/>
    <list gender="1" lookType="133" name="Summoner"/>
    </outfit>

    <outfit id="7" premium="yes">
    <list gender="0" lookType="142" name="Warrior"/>
    <list gender="1" lookType="134" name="Warrior"/>
    </outfit>

    <outfit id="8" premium="yes">
    <list gender="0" lookType="147" name="Barbarian"/>
    <list gender="1" lookType="143" name="Barbarian"/>
    </outfit>

    <outfit id="9" premium="yes">
    <list gender="0" lookType="148" name="Druid"/>
    <list gender="1" lookType="144" name="Druid"/>
    </outfit>

    <outfit id="10" premium="yes">
    <list gender="0" lookType="149" name="Wizard"/>
    <list gender="1" lookType="145" name="Wizard"/>
    </outfit>

    <outfit id="11" premium="yes">
    <list gender="0" lookType="150" name="Oriental"/>
    <list gender="1" lookType="146" name="Oriental"/>
    </outfit>

    <outfit id="12" premium="yes" default="0">
    <list gender="0" lookType="155" name="Pirate"/>
    <list gender="1" lookType="151" name="Pirate"/>
    </outfit>

    <outfit id="13" premium="yes" default="0">
    <list gender="0" lookType="156" name="Assassin"/>
    <list gender="1" lookType="152" name="Assassin"/>
    </outfit>

    <outfit id="14" premium="yes" default="0">
    <list gender="0" lookType="157" name="Beggar"/>
    <list gender="1" lookType="153" name="Beggar"/>
    </outfit>

    <outfit id="15" premium="yes" default="0">
    <list gender="0" lookType="158" name="Shaman"/>
    <list gender="1" lookType="154" name="Shaman"/>
    </outfit>

    <outfit id="16" premium="yes" default="0">
    <list gender="0" lookType="252" name="Norsewoman"/>
    <list gender="1" lookType="251" name="Norseman"/>
    </outfit>

    <outfit id="17" premium="yes" default="0">
    <list gender="0" lookType="269" name="Nightmare"/>
    <list gender="1" lookType="268" name="Nightmare"/>
    </outfit>

    <outfit id="18" premium="yes" default="0">
    <list gender="0" lookType="270" name="Jester"/>
    <list gender="1" lookType="273" name="Jester"/>
    </outfit>

    <outfit id="19" premium="yes" default="0">
    <list gender="0" lookType="279" name="Brotherhood"/>
    <list gender="1" lookType="278" name="Brotherhood"/>
    </outfit>

    <outfit id="20" premium="yes" default="0">
    <list gender="0" lookType="288" name="Demonhunter"/>
    <list gender="1" lookType="289" name="Demonhunter"/>
    </outfit>

    <outfit id="21" premium="yes" default="0">
    <list gender="0" lookType="324" name="Yalaharian"/>
    <list gender="1" lookType="325" name="Yalaharian"/>
    </outfit>

    <outfit id="22" default="0">
    <list gender="0" lookType="336" name="Warmaster"/>
    <list gender="1" lookType="335" name="Warmaster"/>
    </outfit>

    <outfit id="23" premium="yes" default="0">
    <list gender="0" lookType="366" name="Wayfarer"/>
    <list gender="1" lookType="367" name="Wayfarer"/>
    </outfit>

    <outfit id="24" premium="yes" default="0">
    <list gender="0" lookType="329" name="Wedding"/>
    <list gender="1" lookType="328" name="Wedding"/>
    </outfit>
    </outfits>
    [/code]

    [font=verdana,geneva,sans-serif]Existem diferentes tipos de atributos que você pode colocar na sua outfit, por exemplo, você pode colocar para quando um jogador estiver usando[b] X[/b] outfit, ele receba uma certa chance de refletir danos de um certo elemento. Vamos aprender abaixo a configuração de atributos do jogador.[/font]

    [font=verdana,geneva,sans-serif][hr][/font]

    [font=verdana,geneva,sans-serif]Para configurar atributos é muito simples, destacarei a outfit [b]Citizen[/b] para esse exemplo:[/font]

    <outfit id="1"> <list gender="0" lookType="136" name="Citizen"/> <list gender="1" lookType="128" name="Citizen"/> </outfit>

    Suponhamos que eu queira que quando um jogador estiver usando a outfit Citizen, ele receba speed +10 e recupere 30 de HP a cada 5 segundos, basta adicionar isso:


    <outfit id="1"> <list gender="0" lookType="136" name="Citizen" healthGain="30" healthTicks="5" speed="10" /> <list gender="1" lookType="128" name="Citizen" healthGain="30" healthTicks="5" speed="10" /> </outfit>

    Você pode diferenciar os tipos de bônus primários pelo sexo do jogador. Os bônus primários disponíveis são estes abaixo:


    manaShield invisible healthGain healthTicks manaGain manaTicks speed

    Agora existem bônus secundários que é necessária uma pequena edição na estrutura da configuração da outfit, vejamos abaixo:


    <outfit id="1"> <list gender="0" lookType="136" name="Citizen"/> <list gender="1" lookType="128" name="Citizen"/> </outfit>

    Estes bônus secundários variam desde pontos fixos em skills até chance de refletir algo ou absorver. Só que para que eles funcionem corretamente, você precisa "abrir" a configuração da outfit.

    Por exemplo, a outfit Citizen nos dará +50 de HPmáx e +1 em todas as skills de combate corporal. Vejamos:


    <outfit id="1"> <list gender="0" lookType="136" name="Citizen"> <stats maxHealth="50"/> <skills melee="1"/> </list> <list gender="1" lookType="128" name="Citizen"> <stats maxHealth="50"/> <skills melee="1"/> </list> </outfit>

    Veja que literalmente eu abri a outfit Citizen em sub-listas declarando atributos diferentes para elas, segue abaixo uma pequena lista de cada atributo e em que sub-lista ele deve ser declarado:

    stats

    maxHealth maxMana soul level magLevel || magicLevel maxHealthPercent maxManaPercent soulPercent levelPercent magLevelPercent || magicLevelPercent

    skills

    fist club sword axe distance || dist shielding || shield fishing || fish melee weapon fistPercent clubPercent swordPercent axePercent distancePercent || distPercent shieldingPercent || shieldPercent fishingPercent || fishPercent meleePercent weaponPercent || weaponsPercent

    Lembra que no começo desse tutorial, eu disse que era possível configurar chance de reflexão e absorção para as outfits? Pois é, é possível sim. Vamos pegar um exemplo diferente agora, a outfit Wizard.


    <outfit id="10" premium="yes"> <list gender="0" lookType="149" name="Wizard"/> <list gender="1" lookType="145" name="Wizard"/> </outfit>

    Vamos dizer que a outfit Wizard com addons completos dará a chance de 10% de refletir 25% do dano feito por elementos (Fire, Earth, Ice, Energy). Para fazer isso, é o mesmo esquema de stats e skills, só que o nome da sub-lista deve ser reflect ou absorb. Dependendo do que você quer que a outfit faça, refletir ou absorver.


    <outfit id="10" premium="yes"> <list gender="0" lookType="149" name="Wizard"> <reflect percentElements="25" chanceElements="10"/> </list> <list gender="1" lookType="145" name="Wizard"> <reflect percentElements="25" chanceElements="10"/> </list> </outfit>

    Veja abaixo a lista dos possíveis atributos para reflect e absorb:


    percentAll percentElements percentMagic percentEnergy percentFire percentPoison || percentEarth percentIce percentHoly percentDeath percentLifeDrain percentManaDrain percentDrown percentPhysical percentHealing percentUndefined chanceAll chanceElements chanceMagic chanceEnergy chanceFire chancePoison || chanceEarth chanceIce chanceHoly chanceDeath chanceLifeDrain chanceManaDrain chanceDrown chancePhysical chanceHealing chanceUndefined

    Por último, você pode definir quando esses bônus são dados, seja quando o jogador está utilizando o primeiro addon, o segundo, qualquer um dos dois ou ambos. O atributo para isso é requirement.


    <outfit id="10" premium="yes"> <list gender="0" lookType="149" name="Wizard" requirement="any"> <reflect percentElements="25" chanceElements="10"/> </list> <list gender="1" lookType="145" name="Wizard" requirement="any"> <reflect percentElements="25" chanceElements="10"/> </list> </outfit>


    first second any both



    Existem alguns atributos que manipulam se o jogador pode usar a outfit, o mais conhecido deles é o premium que só permite o uso da outfit a jogadores premium.

    Mas muitos não conheçam os atributos quest, storageId e storageValue que torna possível dar outfits em quests, igual acontece no Tibia.

    Para isso, pegaremos qualquer outfit.


    <outfit id="20" premium="yes" default="0"> <list gender="0" lookType="288" name="Demonhunter"/> <list gender="1" lookType="289" name="Demonhunter"/> </outfit>

    Quando você usa o atributo quest com o valor igual a uma storage do servidor, a outfit só poderá ser usada se a storage tiver valor igual a 1. Por exemplo:


    <outfit id="20" premium="yes" quest="2005" default="0"> <list gender="0" lookType="288" name="Demonhunter"/> <list gender="1" lookType="289" name="Demonhunter"/> </outfit>

    Se a storage 2005 tiver valor igual a 1, então eu poderei usar a outfit Demonhunter. Mas e se eu estou trabalhando com uma grande quest que o valor final da storage é 3 e não 1? Por isso que existem os atributos storageId e storageValue.


    <outfit id="20" premium="yes" storageId="2005" storageValue="3" default="0"> <list gender="0" lookType="288" name="Demonhunter"/> <list gender="1" lookType="289" name="Demonhunter"/> </outfit>



    Bom, isso é tudo.

    Qualquer dúvida não deixe de postar no tópico.

    Abração \o/
  11. Upvote
    Oneshot recebeu reputação de Hamsterbob em Forge System   
    ADVANCED FORGE SYSTEM



    O SISTEMA DE CRIAÇÃO DE ITENS PARA SEU SERVIDOR


     

     
    Creio que muitos já conhecem o sistema de forja criado por mim, acontece que o código já estava um pouco obsoleto, então resolvi reescrever ele do 0.
     
    Simplesmente consiste em um sistema de criação de itens avançado que ressuscita um pouco do RPG perdido nos servidores de hoje em dia. O jogador poderá criar itens através de forja, agindo como um verdadeiro ferreiro medieval. Adiciona itens em cima de uma bigorna previamente colocada no mapa e com um martelo cria um item totalmente novo.
     
    CARACTERÍSTICAS DA VERSÃO FINAL:
     
    - Configuração intuitiva e fácil de compreender;
    - Mini-tutorial auxiliando criação de novas receitas;
    - Receitas podem conter até 250 itens diferentes com suas respectivas quantidades;
    - Sistema inteligente que identifica uma receita em qualquer ordem;
    - Código totalmente orientado a objetos;
    - Possibilidade de configurar diferentes requerimentos, diferentes skills, magic level e level
     

     
    Há dois modos de instalar o Advanced Forge System, o primeiro é seguir os passos deste tópico e o segundo e baixar pasta data/ anexada no tópico com os arquivos em seus respectivos diretórios, precisando apenas o registro das chaves nos arquivos XML.
     
    Escolha o modo que mais convém a você.
     

     
     
    Crie um arquivo em data/lib chamado forgesystem.lua e cole o conteúdo abaixo:
     

    --[[ ADVANCED FORGE SYSTEM FINAL Criado por Oneshot É proibido a venda ou a cópia sem os devidos créditos desse script. ]]-- RecipeHandler = { itemtype = 0, items = {}, level = 1, maglevel = 0, skills = {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0} } Forge = { type = nil, position = nil, magicEffect = CONST_ME_MAGIC_GREEN, messages = { class = MESSAGE_STATUS_DEFAULT, success = "You have successfully forged a %s.", needskill = "You don't have enough %s to create a %s.", needlevel = "You need level %s to create a %s.", needmaglevel = "You need magic level %s to create a %s." } } function RecipeHandler:new(itemtype, items, level, maglevel, skills) local obj = { itemtype = (itemtype or 0), items = (items or {}), level = (level or 1), maglevel = (maglevel or 0), skills = (skills or {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0}) } table.insert(Recipes, obj) return setmetatable(obj, {__index = self}) end function RecipeHandler:setItem(itemtype) self.itemtype = (itemtype or 0) end function RecipeHandler:setRecipe(...) self.items = {...} end function RecipeHandler:setRecipeItem(itemid, amount) table.insert(self.items, {itemid, amount}) end function RecipeHandler:setSkill(skillid, value) self.skills[skillid] = value end function RecipeHandler:setLevel(value) self.level = value end function RecipeHandler:setMagLevel(value) self.maglevel = value end function RecipeHandler:check(position) local match = false for n, item in ipairs(self.items) do local thing = getTileItemById(position, item[1]) if thing.uid > 0 and math.max(1, thing.type) >= item[2] then if n == #self.items then match = true end else break end end return match end function RecipeHandler:get(position) if self:check(position) == true then return setmetatable({type = self, position = position}, {__index = Forge}) end return false end function Forge:create(cid) if self.type.itemid == 0 then print("[FORGE SYSTEM - ERROR] ATTEMPT TO CREATE A RECIPE ITEMID 0") return end local status = true if(cid) then if getPlayerLevel(cid) < self.type.level then doPlayerSendTextMessage(cid, self.messages.class, self.messages.needlevel:format(self.type.level, getItemNameById(self.type.itemtype))) return end if getPlayerMagLevel(cid) < self.type.maglevel then doPlayerSendTextMessage(cid, self.messages.class, self.messages.needmaglevel:format(self.type.maglevel, getItemNameById(self.type.itemtype))) return end for skillid, value in pairs(self.type.skills) do if getPlayerSkillLevel(cid, skillid) < value then status = false doPlayerSendTextMessage(cid, self.messages.class, self.messages.needskill:format(SKILL_NAMES[skillid], getItemNameById(self.type.itemtype))) break end end end if status == true then for _, item in ipairs(self.type.items) do local thing = getTileItemById(self.position, item[1]) doRemoveItem(thing.uid, item[2]) end doSendMagicEffect(self.position, self.magicEffect) doPlayerSendTextMessage(cid, self.messages.class, self.messages.success:format(getItemNameById(self.type.itemtype))) doCreateItem(self.type.itemtype, self.position) end end dofile(getDataDir() .."/lib/recipes.lua")
     
    Crie um arquivo em data/lib chamado recipes.lua e adicione o conteúdo abaixo:
     

    ---------------------------------------- -----** TUTORIAL DE CONFIGURAÇÃO **----- ---------------------------------------- --[[ O 'ADVANCED FORGE SYSTEM' é muito fácil e intuitivo de configurar, você só precisa chamar a função RecipeHandler:new(...), sendo que você já configurar os atributos da receita nela ou usar outras funções para isso. Por exemplo, quero criar uma Magic Sword que precise de 100 Gold Nuggets. RecipeHandler:new(2400, {{2157, 100}}) Ou então Magic_Sword = RecipeHandler:new() Magic_Sword:setItem(2400) Magic_Sword:setRecipe({2157, 100}) Funções do Sistema: RecipeHandler:new(itemtype, items, level, maglevel, skills) --> Cria uma nova instância de forja. RecipeHandler:setItem(itemtype) --> Atribui um certo itemid como resultado da receita. RecipeHandler:setRecipe(recipe) --> Atribui uma receita. RecipeHandler:setRecipeItem(itemid, amount) --> Adiciona um itemid e sua quantidade a receita. RecipeHandler:setSkill(skillid, value) --> Atribui um valor necessário de uma certa skill para poder criar a receita. RecipeHandler:setLevel(value) --> Atribui o level necessário para criar uma receita. RecipeHandler:setMagLevel(value) --> Atribui o magic level necessário para criar uma receita. ]]-- --[[ Este é um exemplo de receita usando algumas funções. É uma Magic Sword (ITEMID: 2400) que precisa de 100 Gold Nuggets (ITEMID: 2157), além disso, o personagem que tentar forjar, precisa ter Level 100 e Sword Fighting 50. ]]-- Recipes = {} magicsword = RecipeHandler:new() magicsword:setItem(2400) magicsword:setRecipeItem(2157, 100) magicsword:setLevel(100) magicsword:setSkill(2, 50)
     
    Agora em data/actions/scripts, crie um arquivo chamado iron_hammer.lua e adicione o conteúdo abaixo:
     

    function onUse(cid, item, fromPosition, itemEx, toPosition) local recipe = nil for _, v in ipairs(Recipes) do recipe = v:get(toPosition) if(recipe ~= false) then break end end if(recipe) then recipe:create(cid) else doPlayerSendCancel(cid, "This is not a valid recipe.") end return true end
     
    E por fim em actions.xml, adicione a seguinte linha:
     

    <action itemid="4846" event="script" value="iron_hammer.lua"/>
     
    OPCIONAL - TALKACTION
     
    A talkaction abaixo mostra ao jogadoras receitas configuradas no servidor que ele pode fazer.
     
    Em data/talkactions/scripts, crie um arquivo chamado recipes.lua e adicione o conteúdo abaixo:
     

    function onSay(cid, words, param, channel) local ret = {} local msg = " ADVANCED FORGE SYSTEM\n" for _, recipe in ipairs(Recipes) do local skills = true for skillid, value in pairs(recipe.skills) do if getPlayerSkillLevel(cid, skillid) < value then skills = false break end end if skills == true then if getPlayerLevel(cid) >= recipe.level and getPlayerMagLevel(cid) >= recipe.maglevel then table.insert(ret, {recipe, true}) else table.insert(ret, {recipe, false}) end else table.insert(ret, {recipe, false}) end end for _, recipe in ipairs(ret) do msg = msg .."\nRecipe for ".. getItemNameById(recipe[1].itemtype) ..":\n\n" if recipe[2] == true then for _, item in ipairs(recipe[1].items) do msg = msg .."* ".. getItemNameById(item[1]) .." [".. math.min(item[2], math.max(0, getPlayerItemCount(cid, item[1]))) .."/".. item[2] .."]\n" end else msg = msg .."[LOCKED]\n" end end doShowTextDialog(cid, 2555, msg) return true end
     
    Em data/talkactions/talkactions.xml, adicione a linha:
     

    <talkaction words="/recipes" event="script" value="recipes.lua"/>
     

     
    Siga as instruções para configuração de novas receitas.
     
    Em breve vídeo de funcionamento
    Advanced Forge System.rar
  12. Upvote
    Oneshot recebeu reputação de duasrodas em xTibia, o RETORNO!   
    Faço das palavras do Tonynh as minhas.
     
    Agradeço aos responsáveis pela volta do XTibia.com, é a única comunidade que possui todos meus conteúdos, outras têm apenas uma fração ínfima.
     
    Abraço.
  13. Upvote
    Oneshot recebeu reputação de Administrador em xTibia, o RETORNO!   
    Faço das palavras do Tonynh as minhas.
     
    Agradeço aos responsáveis pela volta do XTibia.com, é a única comunidade que possui todos meus conteúdos, outras têm apenas uma fração ínfima.
     
    Abraço.
  14. Upvote
    Oneshot deu reputação a Slicer em Meu usuario bugo!   
    'meus conteudo...' eh pra rir neh? uahauhauha vo nem comenta... continue no seu ban pelo amor de deus!!!
  15. Upvote
    Oneshot recebeu reputação de DuuhCarvalho em Item que Da Level ao Player   
    Legal ver o interesse das pessoas por scripting. Vamos seguir com algumas dicas.
     
    Não separe os parâmetros de função com espaço como você fez na linha 2.
    if getPlayerLevel (cid) >= 50 then O correto é:
    if getPlayerLevel(cid) >= 50 then Embora a maioria das pessoas não ligue para isso, os scripts precisam de indentação, pois organiza suas linhas de código, e a leitura não fica pesada, mas sim agradável aos olhos dos programadores. Procure sobre indentação e tente praticar nos próximos scripts.
    function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerLevel(cid) >= 50 then doPlayerAddLevel(cid) doRemoveItem(item.uid, 1) else doPlayerSendCancel(cid, "You need level 50 to use this item.") end return true end Agora para limitar o uso, durante um período de tempo, existe uma função chamada os.time() que armazena o tempo decorrido em segundos desde 01/01/1970. Para exemplificar, eu dei um print os.time() que retornou isso:
    1398690049 Ok, aí você me pergunta, como eu vou fazer para limitar o uso de um item, usando essa função?
     
    Armazene o valor dela acrescido de X segundos em uma storage e depois compare ela com ela mesmo e... não pera...
     
    É isso mesmo.
     
    Seu script ficaria assim:
    function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerLevel(cid) >= 50 and os.time() > getCreatureStorage(cid, 33665) then doPlayerAddLevel(cid) doRemoveItem(item.uid, 1) doCreatureSetStorage(cid, 33665, (os.time() + 60)) else doPlayerSendCancel(cid, "You need level 50 to use this item or need to wait a minute.") end return true end Veja o que eu fiz, no momento que o jogador usou o item, peguei o tempo em segundos daquele momento, somei mais 60 segundos e armazenei em uma storage.
     
    Na linha 2, faço uma comparação, se o tempo em segundos do momento de uma nova tentativa de uso já passou o tempo armazenado na storage, se já passou, é porque já passou um minuto e por aí vai.
     
    Acho que dá pra entender desse jeito, só acho.
     
    Abraço.
  16. Upvote
    Oneshot recebeu reputação de Wend ll em Item que Da Level ao Player   
    Seu erro foi aqui:
    if getPlayerLevel(cid) >= 50 then os.time() > getCreatureStorage(cid, 33665) then Só tem um then no final do if, AnaFeeh.
     
    O resto devem ser conectores and ou or.
     
    Ficando:
    if getPlayerLevel(cid) >= 50 and os.time() > getCreatureStorage(cid, 33665) then
  17. Upvote
    Oneshot recebeu reputação de JeanCristian em Spell Arrow Storm, Alguem consegue?   
    Arrumei o erro, era umas "," faltando, vê aí se funciona.
  18. Upvote
    Oneshot recebeu reputação de JeanCristian em Spell Arrow Storm, Alguem consegue?   
    Vê se isso aí dá certo, fiz de cabeça e não tenho como testar no trabalho
    local arrow_storm = { [2544] = { [0] = COMBAT_PHYSICALDAMAGE, -- Tipo de dano [1] = CONST_ME_HITAREA, -- Efeito de área [2] = CONST_ANI_ARROW, -- Efeito do tiro da flecha [3] = 2, -- Área de alcance dos danos [4] = {-1.3, -1.5, -30, -45, 5, 5, 2, 3}, -- Fórmula }, } local storage = {78881, 78882} function onCastSpell(cid, var) local arrow = getPlayerSlotItem(cid, CONST_SLOT_AMMO) if not arrow then doPlayerSendCancel(cid, "You need to equip an arrow type in ammo slot.") return false end if not arrow_storm[arrow.itemid] then doPlayerSendCancel(cid, "Sorry, you can't use Arrow Storm with this arrow.") return false end local tmp = arrow_storm[arrow.itemid] local isShooting = true doCreatureSetStorage(cid, storage[1], os.time() + 2) while isShooting do local fromPosition = getCreaturePosition(cid) local toPosition = fromPosition toPosition.y = toPosition.y - 8 addEvent(doSendDistanceShoot, 55, fromPosition, toPosition, tmp[2]) if os.time() > getCreatureStorage(cid, storage[1]) then isShooting = false end end if isShooting == false then local fallingArrows = true doCreatureSetStorage(cid, storage[2], os.time() + 2) while fallingArrows do local playerPosition = getCreaturePosition(cid) local toPosition = {x = math.random(playerPosition.x - tmp[3], playerPosition.x + tmp[3]), y = math.random(playerPosition.y - tmp[3], playerPosition.y + tmp[3]), z = playerPosition.z} local fromPosition = toPosition fromPosition.y = fromPosition.y - 8 local level = getPlayerLevel(cid) local skill = getPlayerSkillLevel(cid, SKILL_DISTANCE) local min = (level / tmp[4][5] + skill * tmp[4][7]) * tmp[4][1] + tmp[4][3] local max = (level / tmp[4][6] + skill * tmp[4][8]) * tmp[4][2] + tmp[4][4] doSendDistanceShoot(fromPosition, toPosition, tmp[2] addEvent(doAreaCombatHealth, 55, cid, tmp[0], toPosition, 0, min, max, tmp[1]) if os.time() > getCreatureStorage(cid, storage[2]) then fallingArrows = false end end end return true end
  19. Upvote
    Oneshot recebeu reputação de DuuhCarvalho em [Arquivado]Quem tem interesse em aprender a scriptar?   
    Tenho interesses em ensinar do básico ao avançado de programação Lua, e sua utilização no Open Tibia, então se precisarem de mais um professor, o coordenador Omega possui meu contato.
     
    Abraço.
  20. Upvote
    Oneshot recebeu reputação de DuuhCarvalho em Scripter Lua   
    Tá e até agora você não ordenou os valores da tabela.
  21. Upvote
    Oneshot recebeu reputação de Skymagnum em Scripter Lua   
    Tá e até agora você não ordenou os valores da tabela.
  22. Upvote
    Oneshot recebeu reputação de AnneMotta em Vamos sair do passado, Kd o C#?   
    Uau, colocar um # no C, vai trazer quantos membros para essa seção flopada?
  23. Upvote
    Oneshot deu reputação a dalvorsn em dec2bin(number)   
    Vou dar um exemplo:
    Como ficaria o numero 10.25 na memoria:
    Primeiro voce converte ele para binario, fica: 1010.01
    Apos isso faz a normatização do mesmo, que consiste basicamente em levar todos os valores para direita da virgula por meio de notação cientifica, ficando:
    0.101001*2^4
    Pronto, agora temos tudo para montar o valor na memoria.
    a parte fracionaria é chamada de mantissa, correspondente a 101001 no exemplo
    [1 bit sinal expoente] [1 bit sinal do numero] [4 bits expoente] [10 bits mantissa] 0 0 0100 0000101001 (0 pois é positivo) (0 pois é positivo) (4 em binário) (parte fracionaria) Sendo assim a representação na memoria fica: 0000100000101001
  24. Upvote
    Oneshot recebeu reputação de gabriel28 em Forge System   
    ADVANCED FORGE SYSTEM



    O SISTEMA DE CRIAÇÃO DE ITENS PARA SEU SERVIDOR


     

     
    Creio que muitos já conhecem o sistema de forja criado por mim, acontece que o código já estava um pouco obsoleto, então resolvi reescrever ele do 0.
     
    Simplesmente consiste em um sistema de criação de itens avançado que ressuscita um pouco do RPG perdido nos servidores de hoje em dia. O jogador poderá criar itens através de forja, agindo como um verdadeiro ferreiro medieval. Adiciona itens em cima de uma bigorna previamente colocada no mapa e com um martelo cria um item totalmente novo.
     
    CARACTERÍSTICAS DA VERSÃO FINAL:
     
    - Configuração intuitiva e fácil de compreender;
    - Mini-tutorial auxiliando criação de novas receitas;
    - Receitas podem conter até 250 itens diferentes com suas respectivas quantidades;
    - Sistema inteligente que identifica uma receita em qualquer ordem;
    - Código totalmente orientado a objetos;
    - Possibilidade de configurar diferentes requerimentos, diferentes skills, magic level e level
     

     
    Há dois modos de instalar o Advanced Forge System, o primeiro é seguir os passos deste tópico e o segundo e baixar pasta data/ anexada no tópico com os arquivos em seus respectivos diretórios, precisando apenas o registro das chaves nos arquivos XML.
     
    Escolha o modo que mais convém a você.
     

     
     
    Crie um arquivo em data/lib chamado forgesystem.lua e cole o conteúdo abaixo:
     

    --[[ ADVANCED FORGE SYSTEM FINAL Criado por Oneshot É proibido a venda ou a cópia sem os devidos créditos desse script. ]]-- RecipeHandler = { itemtype = 0, items = {}, level = 1, maglevel = 0, skills = {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0} } Forge = { type = nil, position = nil, magicEffect = CONST_ME_MAGIC_GREEN, messages = { class = MESSAGE_STATUS_DEFAULT, success = "You have successfully forged a %s.", needskill = "You don't have enough %s to create a %s.", needlevel = "You need level %s to create a %s.", needmaglevel = "You need magic level %s to create a %s." } } function RecipeHandler:new(itemtype, items, level, maglevel, skills) local obj = { itemtype = (itemtype or 0), items = (items or {}), level = (level or 1), maglevel = (maglevel or 0), skills = (skills or {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0}) } table.insert(Recipes, obj) return setmetatable(obj, {__index = self}) end function RecipeHandler:setItem(itemtype) self.itemtype = (itemtype or 0) end function RecipeHandler:setRecipe(...) self.items = {...} end function RecipeHandler:setRecipeItem(itemid, amount) table.insert(self.items, {itemid, amount}) end function RecipeHandler:setSkill(skillid, value) self.skills[skillid] = value end function RecipeHandler:setLevel(value) self.level = value end function RecipeHandler:setMagLevel(value) self.maglevel = value end function RecipeHandler:check(position) local match = false for n, item in ipairs(self.items) do local thing = getTileItemById(position, item[1]) if thing.uid > 0 and math.max(1, thing.type) >= item[2] then if n == #self.items then match = true end else break end end return match end function RecipeHandler:get(position) if self:check(position) == true then return setmetatable({type = self, position = position}, {__index = Forge}) end return false end function Forge:create(cid) if self.type.itemid == 0 then print("[FORGE SYSTEM - ERROR] ATTEMPT TO CREATE A RECIPE ITEMID 0") return end local status = true if(cid) then if getPlayerLevel(cid) < self.type.level then doPlayerSendTextMessage(cid, self.messages.class, self.messages.needlevel:format(self.type.level, getItemNameById(self.type.itemtype))) return end if getPlayerMagLevel(cid) < self.type.maglevel then doPlayerSendTextMessage(cid, self.messages.class, self.messages.needmaglevel:format(self.type.maglevel, getItemNameById(self.type.itemtype))) return end for skillid, value in pairs(self.type.skills) do if getPlayerSkillLevel(cid, skillid) < value then status = false doPlayerSendTextMessage(cid, self.messages.class, self.messages.needskill:format(SKILL_NAMES[skillid], getItemNameById(self.type.itemtype))) break end end end if status == true then for _, item in ipairs(self.type.items) do local thing = getTileItemById(self.position, item[1]) doRemoveItem(thing.uid, item[2]) end doSendMagicEffect(self.position, self.magicEffect) doPlayerSendTextMessage(cid, self.messages.class, self.messages.success:format(getItemNameById(self.type.itemtype))) doCreateItem(self.type.itemtype, self.position) end end dofile(getDataDir() .."/lib/recipes.lua")
     
    Crie um arquivo em data/lib chamado recipes.lua e adicione o conteúdo abaixo:
     

    ---------------------------------------- -----** TUTORIAL DE CONFIGURAÇÃO **----- ---------------------------------------- --[[ O 'ADVANCED FORGE SYSTEM' é muito fácil e intuitivo de configurar, você só precisa chamar a função RecipeHandler:new(...), sendo que você já configurar os atributos da receita nela ou usar outras funções para isso. Por exemplo, quero criar uma Magic Sword que precise de 100 Gold Nuggets. RecipeHandler:new(2400, {{2157, 100}}) Ou então Magic_Sword = RecipeHandler:new() Magic_Sword:setItem(2400) Magic_Sword:setRecipe({2157, 100}) Funções do Sistema: RecipeHandler:new(itemtype, items, level, maglevel, skills) --> Cria uma nova instância de forja. RecipeHandler:setItem(itemtype) --> Atribui um certo itemid como resultado da receita. RecipeHandler:setRecipe(recipe) --> Atribui uma receita. RecipeHandler:setRecipeItem(itemid, amount) --> Adiciona um itemid e sua quantidade a receita. RecipeHandler:setSkill(skillid, value) --> Atribui um valor necessário de uma certa skill para poder criar a receita. RecipeHandler:setLevel(value) --> Atribui o level necessário para criar uma receita. RecipeHandler:setMagLevel(value) --> Atribui o magic level necessário para criar uma receita. ]]-- --[[ Este é um exemplo de receita usando algumas funções. É uma Magic Sword (ITEMID: 2400) que precisa de 100 Gold Nuggets (ITEMID: 2157), além disso, o personagem que tentar forjar, precisa ter Level 100 e Sword Fighting 50. ]]-- Recipes = {} magicsword = RecipeHandler:new() magicsword:setItem(2400) magicsword:setRecipeItem(2157, 100) magicsword:setLevel(100) magicsword:setSkill(2, 50)
     
    Agora em data/actions/scripts, crie um arquivo chamado iron_hammer.lua e adicione o conteúdo abaixo:
     

    function onUse(cid, item, fromPosition, itemEx, toPosition) local recipe = nil for _, v in ipairs(Recipes) do recipe = v:get(toPosition) if(recipe ~= false) then break end end if(recipe) then recipe:create(cid) else doPlayerSendCancel(cid, "This is not a valid recipe.") end return true end
     
    E por fim em actions.xml, adicione a seguinte linha:
     

    <action itemid="4846" event="script" value="iron_hammer.lua"/>
     
    OPCIONAL - TALKACTION
     
    A talkaction abaixo mostra ao jogadoras receitas configuradas no servidor que ele pode fazer.
     
    Em data/talkactions/scripts, crie um arquivo chamado recipes.lua e adicione o conteúdo abaixo:
     

    function onSay(cid, words, param, channel) local ret = {} local msg = " ADVANCED FORGE SYSTEM\n" for _, recipe in ipairs(Recipes) do local skills = true for skillid, value in pairs(recipe.skills) do if getPlayerSkillLevel(cid, skillid) < value then skills = false break end end if skills == true then if getPlayerLevel(cid) >= recipe.level and getPlayerMagLevel(cid) >= recipe.maglevel then table.insert(ret, {recipe, true}) else table.insert(ret, {recipe, false}) end else table.insert(ret, {recipe, false}) end end for _, recipe in ipairs(ret) do msg = msg .."\nRecipe for ".. getItemNameById(recipe[1].itemtype) ..":\n\n" if recipe[2] == true then for _, item in ipairs(recipe[1].items) do msg = msg .."* ".. getItemNameById(item[1]) .." [".. math.min(item[2], math.max(0, getPlayerItemCount(cid, item[1]))) .."/".. item[2] .."]\n" end else msg = msg .."[LOCKED]\n" end end doShowTextDialog(cid, 2555, msg) return true end
     
    Em data/talkactions/talkactions.xml, adicione a linha:
     

    <talkaction words="/recipes" event="script" value="recipes.lua"/>
     

     
    Siga as instruções para configuração de novas receitas.
     
    Em breve vídeo de funcionamento
    Advanced Forge System.rar
  25. Upvote
    Oneshot recebeu reputação de Mazynho em Monstro não pode ser healado   
    Isso não existe. Só através de um creaturescript "statschange"
    function onStatsChange(cid, attacker, type, combat, value) if type == STATSCHANGE_HEALTHGAIN and combat == COMBAT_HEALING then return false end return true end Cria o arquivo .lua, registra ele no creaturescripts.xml e coloca isso no monstro.
    <script> <event name="NOME_DO_EVENTO"/> </script> Pronto.
  • Quem Está Navegando   0 membros estão online

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