Postado Maio 27, 2017 8 anos Autor 4 horas atrás, reisbro disse: auheuahea é chatinho mesmo eu tava com um sistema em mente parecido, e vou começar a programar e tentar deixar bem fácil pra editar e adicionar coisas novas. se eu conseguir fazer dar certo eu posto aqui pra ti Obrigado, ficarei esperando!
Postado Novembro 19, 2017 7 anos Solução Para evitar maiores modificações, você poderia utilizar esse aumento de dano apenas para player vs player (com monstros não funciona). Após usar a magia, o player só poderia utilizar novamente assim que o efeito do bônus no elemento (fire, ice, etc) acabasse. Então, teste assim: Em spells/scripts crie um arquivo: buffelemental.lua Spoiler local t = { stors = {96572, 96573}, -- modifique apenas se for realmente necessário effect_time = {5, "min"}, -- tempo de efeito da spell ["flam"] = {bonus = 10, element = COMBAT_FIREDAMAGE}, -- bonus = % de aumento no hit, element = tipo do dano ["tera"] = {bonus = 10, element = COMBAT_EARTHDAMAGE}, ["ico"] = {bonus = 10, element = COMBAT_PHYSICALDAMAGE}, ["frigo"] = {bonus = 10, element = COMBAT_ICEDAMAGE} } function onCastSpell(cid, var) local p, buff = getPlayerPosition(cid), t[var.string] local buff_on = getPlayerStorageValue(cid, t.stors[1]) if not buff then doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) doSendMagicEffect(p, CONST_ME_POFF) return true end if buff_on > os.time() then doPlayerSendCancel(cid, "Your elemental buff is already active.") doSendMagicEffect(p, CONST_ME_POFF) return true end setPlayerStorageValue(cid, t.stors[1], mathtime(t.effect_time) + os.time()) local info = var.string..","..buff.bonus..","..buff.element setPlayerStorageValue(cid, t.stors[2], info) doSendMagicEffect(p, CONST_ME_MAGIC_GREEN) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, (var.string:upper()).." BUFF ON!") return true end function mathtime(table) -- by dwarfer local unit = {"sec", "min", "hour", "day"} for i, v in pairs(unit) do if v == table[2] then return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1) end end return error("Bad declaration in mathtime function.") end Edite as palavras "flam", "frigo" como queira ou adicione outras. Em spells.xml: (Edite as palavras da magia, o maglvl, mana e os outros parâmetros de acordo com o que desejar, esse aí é apenas para servir como base caso você não saiba como fazer) Spoiler <instant name="Elemental Buff" words="utori buff" aggressive="1" params="1" needtarget="0" lvl="1" maglv="1" mana="10" soul="0" exhaustion="1" prem="1" enabled="1" script="buffelemental.lua"> <vocation id="1"/> <vocation id="2"/> <vocation id="3"/> <vocation id="4"/> <vocation id="5"/> <vocation id="6"/> <vocation id="7"/> <vocation id="8"/> </instant> Em creaturescripts/scripts crie um arquivo: buffelementalattack.lua Spoiler local protect, stors = {}, {96572, 96573} -- modifique os storages apenas se necessário function onStatsChange(cid, attacker, type, combat, value) if isPlayer(attacker) and (not (attacker == cid)) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) and isPlayer(cid) and value >= 1 then if getPlayerStorageValue(attacker, stors[1]) > os.time() then if protect[attacker] then protect[attacker] = nil return true end local t = string.explode(tostring(getPlayerStorageValue(attacker, stors[2])), ",") local buff = {type = (t[1]:upper()).."!", bonus = tonumber(t[2])/100, element = tonumber(t[3])} if combat == buff.element then attack_bonus = math.ceil(2*value*(1+buff.bonus)) protect[attacker] = true doTargetCombatHealth(attacker, cid, combat, -attack_bonus, -attack_bonus, CONST_ME_NONE) doSendAnimatedText(getPlayerPosition(attacker), buff.type, COLOR_TEAL) return false end end end return true end No login.lua, registre o evento adicionando: registerCreatureEvent(cid, "BuffElemental") Em creaturescripts.xml, adicione a tag: <event type="statschange" name="BuffElemental" event="script" value="buffelementalattack.lua"/> Para utilizar a magia: utori buff "flam -- o hit do player quando FIRE será aumentado em 10% como foi configurado lá na spell Para os demais: utori buff "terautori buff "icoutori buff "frigo Contato: Email: [email protected] Discord: Dwarfer#2715
Postado Dezembro 22, 2020 4 anos Em 19/11/2017 em 12:09, Dwarfer disse: Para evitar maiores modificações, você poderia utilizar esse aumento de dano apenas para player vs player (com monstros não funciona). Após usar a magia, o player só poderia utilizar novamente assim que o efeito do bônus no elemento (fire, ice, etc) acabasse. Então, teste assim: Em spells/scripts crie um arquivo: buffelemental.lua Mostrar conteúdo oculto local t = { stors = {96572, 96573}, -- modifique apenas se for realmente necessário effect_time = {5, "min"}, -- tempo de efeito da spell ["flam"] = {bonus = 10, element = COMBAT_FIREDAMAGE}, -- bonus = % de aumento no hit, element = tipo do dano ["tera"] = {bonus = 10, element = COMBAT_EARTHDAMAGE}, ["ico"] = {bonus = 10, element = COMBAT_PHYSICALDAMAGE}, ["frigo"] = {bonus = 10, element = COMBAT_ICEDAMAGE} } function onCastSpell(cid, var) local p, buff = getPlayerPosition(cid), t[var.string] local buff_on = getPlayerStorageValue(cid, t.stors[1]) if not buff then doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) doSendMagicEffect(p, CONST_ME_POFF) return true end if buff_on > os.time() then doPlayerSendCancel(cid, "Your elemental buff is already active.") doSendMagicEffect(p, CONST_ME_POFF) return true end setPlayerStorageValue(cid, t.stors[1], mathtime(t.effect_time) + os.time()) local info = var.string..","..buff.bonus..","..buff.element setPlayerStorageValue(cid, t.stors[2], info) doSendMagicEffect(p, CONST_ME_MAGIC_GREEN) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, (var.string:upper()).." BUFF ON!") return true end function mathtime(table) -- by dwarfer local unit = {"sec", "min", "hour", "day"} for i, v in pairs(unit) do if v == table[2] then return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1) end end return error("Bad declaration in mathtime function.") end Edite as palavras "flam", "frigo" como queira ou adicione outras. Em spells.xml: (Edite as palavras da magia, o maglvl, mana e os outros parâmetros de acordo com o que desejar, esse aí é apenas para servir como base caso você não saiba como fazer) Mostrar conteúdo oculto <instant name="Elemental Buff" words="utori buff" aggressive="1" params="1" needtarget="0" lvl="1" maglv="1" mana="10" soul="0" exhaustion="1" prem="1" enabled="1" script="buffelemental.lua"> <vocation id="1"/> <vocation id="2"/> <vocation id="3"/> <vocation id="4"/> <vocation id="5"/> <vocation id="6"/> <vocation id="7"/> <vocation id="8"/> </instant> Em creaturescripts/scripts crie um arquivo: buffelementalattack.lua Mostrar conteúdo oculto local protect, stors = {}, {96572, 96573} -- modifique os storages apenas se necessário function onStatsChange(cid, attacker, type, combat, value) if isPlayer(attacker) and (not (attacker == cid)) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) and isPlayer(cid) and value >= 1 then if getPlayerStorageValue(attacker, stors[1]) > os.time() then if protect[attacker] then protect[attacker] = nil return true end local t = string.explode(tostring(getPlayerStorageValue(attacker, stors[2])), ",") local buff = {type = (t[1]:upper()).."!", bonus = tonumber(t[2])/100, element = tonumber(t[3])} if combat == buff.element then attack_bonus = math.ceil(2*value*(1+buff.bonus)) protect[attacker] = true doTargetCombatHealth(attacker, cid, combat, -attack_bonus, -attack_bonus, CONST_ME_NONE) doSendAnimatedText(getPlayerPosition(attacker), buff.type, COLOR_TEAL) return false end end end return true end No login.lua, registre o evento adicionando: registerCreatureEvent(cid, "BuffElemental") Em creaturescripts.xml, adicione a tag: <event type="statschange" name="BuffElemental" event="script" value="buffelementalattack.lua"/> Para utilizar a magia: utori buff "flam -- o hit do player quando FIRE será aumentado em 10% como foi configurado lá na spell Para os demais: utori buff "tera utori buff "ico utori buff "frigo Boa noite, desculpe-me reviver o tópico, mas seria possivel editar esse script para aumentar o dano do personagem permanent? Por exemplo, colocar pra usar um item, exemplo "mastermind potion", ao usar o item o jogador ganhará 5% de dano a mais tanto em atk basico quanto em magia, alguém poderia me ajudar por favor?
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.