Postado Julho 20, 2017 7 anos Bom sou novo no fórum, não sei se pode fazer isto ou estou no local errado. Mas gostaria de pedir 4 Spells. Como funciona as spells: Uma spell funcionaria assim, o player X teleportaria para atras do target(player ou monstros) causando dano ao target. A segunda spell funcionaria da seguinte maneira, O player X empurra o target (player ou monstros) para longe ,causando dano ao target,e depois surge ao lado dele. Outra Spell seria uma paralizia que funciona assim o player usa o spell e seu próximo hit(spell ou ataque) paraliza o alvo. E por último mas não menos importante uma skill que desse um buff ao player X ,assim ele ganha + velocidade de ataque por um certo tempo. Todas essas spell iriam ter um certo tempo de colldown. Espero AJUDA! Utilizo um servidor derivado de dbo!
Postado Julho 20, 2017 7 anos Solução Spell 01 local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -3.2, -0 , -2.2, -0) function onCastSpell(cid, var) local waittime = 0.5 -- Tempo de exhaustion local storage = 1000 local efeito = 3 -- efeito da spell if exhaustion.check(cid, storage) then doPlayerSendCancel(cid, "You are exhausted") return false end local position1 = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z} local target = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z} doSendMagicEffect(position1, efeito) doTeleportThing(cid, target) exhaustion.set(cid, storage, waittime) return doCombat(cid, combat, var) end Spell 02 -- crédito xWhiteWolf local function doPushCreature(target, cid) if target > 0 then if not isNpc(target) then local position = getThingPosition(cid) local fromPosition = getThingPosition(target) local x = ((fromPosition.x - position.x) < 0 and -1 or ((fromPosition.x - position.x) == 0 and 0 or 1)) local y = ((fromPosition.y - position.y) < 0 and -1 or ((fromPosition.y - position.y) == 0 and 0 or 1)) local toPosition = {x = fromPosition.x + x, y = fromPosition.y + y, z = fromPosition.z} if doTileQueryAdd(target, toPosition) == 1 and getTileInfo(toPosition).house == false then doTeleportThing(target, toPosition, true) end end end end local spell = {} spell.config = { [3] = { damageType = 1, areaEffect = 2, area = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, } }, [2] = { damageType = 1, areaEffect = 2, area = { {0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 1, 0, 0, 0, 1, 0}, {0, 1, 0, 2, 0, 1, 0}, {0, 1, 0, 0, 0, 1, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0} } }, [1] = { damageType = 1, areaEffect = 2, area = { {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 0, 1, 2, 1, 0, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0} } } } spell.combats = {} for _, config in ipairs(spell.config) do local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, config.damageType) setCombatParam(combat, COMBAT_PARAM_EFFECT, config.areaEffect) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -4, 0, -4.7, 0) function onTargetCreature(cid, target) doPushCreature(target, cid) end setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature") setCombatArea(combat, createCombatArea(config.area)) table.insert(spell.combats, combat) end function onCastSpell(cid, var) for n = 1, #spell.combats do local alvo = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z} addEvent(doCombat, (n * 120), cid, spell.combats[n], var) addEvent(doTeleportThing, 3000, cid, alvo) end return true end Spell 03 Spell script Spoiler local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 6) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -3.2, -0 , -2.2, -0) function onCastSpell(cid, var) local waittime = 0.5 -- Tempo de exhaustion local storage = 1000 local storage2 = 3352 -- storage do paralize local efeito = 3 -- efeito da spell local tempo = 5 -- segundos q ficara paralizado local time = tempo * 1000 if exhaustion.check(cid, storage) then doPlayerSendCancel(cid, "You are exhausted") return false end local position1 = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z} doSendMagicEffect(position1, efeito) exhaustion.set(cid, storage, waittime) setPlayerStorageValue(cid, storage + os.time + time, 1) return doCombat(cid, combat, var) end Agora vá em creaturescripts Creaturescripts.xml e registre a tag <event type="think" name="Paralize" event="script" value="paralize.lua"/> Crie um arquivo.lua na pasta creaturescrips/scripts e cole isso dentro function onThink(cid, interval) local storage = 23432 -- deixe a mesma que na script da spell if getPlayerStorageValue(cid, storage) == 1 then doCreatureSetNoMove(cid, true) doPlayerSendTextMessage(cid, 22, "voce esta paralisado") return true end end Abra o login.lua na msm pasta e registre a tag. registerCreatureEvent(cid, "Paralize")
Postado Julho 20, 2017 7 anos Autor Em 20/07/2017 ás 15:51, PedroSTT disse: Spell 01 local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -3.2, -0 , -2.2, -0) function onCastSpell(cid, var) local waittime = 0.5 -- Tempo de exhaustion local storage = 1000 local efeito = 3 -- efeito da spell if exhaustion.check(cid, storage) then doPlayerSendCancel(cid, "You are exhausted") return false end local position1 = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z} local target = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z} doSendMagicEffect(position1, efeito) doTeleportThing(cid, target) exhaustion.set(cid, storage, waittime) return doCombat(cid, combat, var) end Spell 02 -- crédito xWhiteWolf local function doPushCreature(target, cid) if target > 0 then if not isNpc(target) then local position = getThingPosition(cid) local fromPosition = getThingPosition(target) local x = ((fromPosition.x - position.x) < 0 and -1 or ((fromPosition.x - position.x) == 0 and 0 or 1)) local y = ((fromPosition.y - position.y) < 0 and -1 or ((fromPosition.y - position.y) == 0 and 0 or 1)) local toPosition = {x = fromPosition.x + x, y = fromPosition.y + y, z = fromPosition.z} if doTileQueryAdd(target, toPosition) == 1 and getTileInfo(toPosition).house == false then doTeleportThing(target, toPosition, true) end end end end local spell = {} spell.config = { [3] = { damageType = 1, areaEffect = 2, area = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, } }, [2] = { damageType = 1, areaEffect = 2, area = { {0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 1, 0, 0, 0, 1, 0}, {0, 1, 0, 2, 0, 1, 0}, {0, 1, 0, 0, 0, 1, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0} } }, [1] = { damageType = 1, areaEffect = 2, area = { {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 0, 1, 2, 1, 0, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0} } } } spell.combats = {} for _, config in ipairs(spell.config) do local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, config.damageType) setCombatParam(combat, COMBAT_PARAM_EFFECT, config.areaEffect) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -4, 0, -4.7, 0) function onTargetCreature(cid, target) doPushCreature(target, cid) end setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature") setCombatArea(combat, createCombatArea(config.area)) table.insert(spell.combats, combat) end function onCastSpell(cid, var) for n = 1, #spell.combats do local alvo = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z} addEvent(doCombat, (n * 120), cid, spell.combats[n], var) addEvent(doTeleportThing, 3000, cid, alvo) end return true end Spell 03 Spell script Mostrar conteúdo oculto local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 6) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -3.2, -0 , -2.2, -0) function onCastSpell(cid, var) local waittime = 0.5 -- Tempo de exhaustion local storage = 1000 local storage2 = 3352 -- storage do paralize local efeito = 3 -- efeito da spell local tempo = 5 -- segundos q ficara paralizado local time = tempo * 1000 if exhaustion.check(cid, storage) then doPlayerSendCancel(cid, "You are exhausted") return false end local position1 = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z} doSendMagicEffect(position1, efeito) exhaustion.set(cid, storage, waittime) setPlayerStorageValue(cid, storage + os.time + time, 1) return doCombat(cid, combat, var) end Agora vá em creaturescripts Creaturescripts.xml e registre a tag <event type="think" name="Paralize" event="script" value="paralize.lua"/> Crie um arquivo.lua na pasta creaturescrips/scripts e cole isso dentro function onThink(cid, interval) local storage = 23432 -- deixe a mesma que na script da spell if getPlayerStorageValue(cid, storage) == 1 then doCreatureSetNoMove(cid, true) doPlayerSendTextMessage(cid, 22, "voce esta paralisado") return true end end Abra o login.lua na msm pasta e registre a tag. registerCreatureEvent(cid, "Paralize") Vlw Cara Muito Obrigado! REP+ @PedroSTT Para ir para trás do alvo no 1° Spell: Substitui a linha: local target = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z} por: local target = {x=getThingPosition(getCreatureTarget(cid)).x-0, y=getThingPosition(getCreatureTarget(cid)).y-1, z=getThingPosition(getCreatureTarget(cid)).z} Mas está funcionando perfeitamente! OBRIGADO! O 2° Spell: Esta empurrando para longe,mas depois surge onde estava o target na posição inicial.( antes de ser empurrado) Estou tendo este erro no 2° Spell: [17:50:36.238] [Error - Spell Interface] [17:50:36.238] In a callback: data/spells/scripts/Zaion/para longe.lua:onTargetCreature [17:50:36.238] (Unknown script file) [17:50:36.238] Description: [17:50:36.238] (luaDoTileQueryAdd) Tile not found O 3° Spell você pode me explicar como funciona o storage, tem que colocar algum específico? ( não sei sobre storage,se puder explicar) O 3° Spell da o seguinte error: [18:22:06.507] [Error - Spell Interface] [18:22:06.508] data/spells/scripts/Zaion/parado.lua:onCastSpell [18:22:06.509] Description: [18:22:06.511] data/spells/scripts/Zaion/parado.lua:21: attempt to perform arithmetic on field 'time' (a function value) [18:22:06.512] stack traceback: [18:22:06.513] data/spells/scripts/Zaion/parado.lua:21: in function <data/spells/scripts/Zaion/parado.lua:5> Namoral tu é mt fera mano já me ajudo bastante! Editado Julho 21, 2017 7 anos por TheKiler Paralizar error (veja o histórico de edições)
Postado Outubro 21, 2017 7 anos Autor Em 20/07/2017 em 15:51, PedroSTT disse: Spell 01 local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -3.2, -0 , -2.2, -0) function onCastSpell(cid, var) local waittime = 0.5 -- Tempo de exhaustion local storage = 1000 local efeito = 3 -- efeito da spell if exhaustion.check(cid, storage) then doPlayerSendCancel(cid, "You are exhausted") return false end local position1 = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z} local target = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z} doSendMagicEffect(position1, efeito) doTeleportThing(cid, target) exhaustion.set(cid, storage, waittime) return doCombat(cid, combat, var) end Spell 02 -- crédito xWhiteWolf local function doPushCreature(target, cid) if target > 0 then if not isNpc(target) then local position = getThingPosition(cid) local fromPosition = getThingPosition(target) local x = ((fromPosition.x - position.x) < 0 and -1 or ((fromPosition.x - position.x) == 0 and 0 or 1)) local y = ((fromPosition.y - position.y) < 0 and -1 or ((fromPosition.y - position.y) == 0 and 0 or 1)) local toPosition = {x = fromPosition.x + x, y = fromPosition.y + y, z = fromPosition.z} if doTileQueryAdd(target, toPosition) == 1 and getTileInfo(toPosition).house == false then doTeleportThing(target, toPosition, true) end end end end local spell = {} spell.config = { [3] = { damageType = 1, areaEffect = 2, area = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, } }, [2] = { damageType = 1, areaEffect = 2, area = { {0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 1, 0, 0, 0, 1, 0}, {0, 1, 0, 2, 0, 1, 0}, {0, 1, 0, 0, 0, 1, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0} } }, [1] = { damageType = 1, areaEffect = 2, area = { {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 0, 1, 2, 1, 0, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0} } } } spell.combats = {} for _, config in ipairs(spell.config) do local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, config.damageType) setCombatParam(combat, COMBAT_PARAM_EFFECT, config.areaEffect) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -4, 0, -4.7, 0) function onTargetCreature(cid, target) doPushCreature(target, cid) end setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature") setCombatArea(combat, createCombatArea(config.area)) table.insert(spell.combats, combat) end function onCastSpell(cid, var) for n = 1, #spell.combats do local alvo = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z} addEvent(doCombat, (n * 120), cid, spell.combats[n], var) addEvent(doTeleportThing, 3000, cid, alvo) end return true end Spell 03 Spell script Mostrar conteúdo oculto local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 6) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -3.2, -0 , -2.2, -0) function onCastSpell(cid, var) local waittime = 0.5 -- Tempo de exhaustion local storage = 1000 local storage2 = 3352 -- storage do paralize local efeito = 3 -- efeito da spell local tempo = 5 -- segundos q ficara paralizado local time = tempo * 1000 if exhaustion.check(cid, storage) then doPlayerSendCancel(cid, "You are exhausted") return false end local position1 = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z} doSendMagicEffect(position1, efeito) exhaustion.set(cid, storage, waittime) setPlayerStorageValue(cid, storage + os.time + time, 1) return doCombat(cid, combat, var) end Agora vá em creaturescripts Creaturescripts.xml e registre a tag <event type="think" name="Paralize" event="script" value="paralize.lua"/> Crie um arquivo.lua na pasta creaturescrips/scripts e cole isso dentro function onThink(cid, interval) local storage = 23432 -- deixe a mesma que na script da spell if getPlayerStorageValue(cid, storage) == 1 then doCreatureSetNoMove(cid, true) doPlayerSendTextMessage(cid, 22, "voce esta paralisado") return true end end Abra o login.lua na msm pasta e registre a tag. registerCreatureEvent(cid, "Paralize") @PedroSTT Só 1 erro , no primeiro spell se não houver target selecionado , fica dando muito erro na distro. Seguinte Error: [21:12:53.403] [Error - Spell Interface] [21:12:53.403] data/spells/scripts/Teste/investida.lua:onCastSpell [21:12:53.403] Description: [21:12:53.403] (luaGetThingPosition) Thing not found Sabe como arrumar? No 2° Spell Teria como que ele só empurrasse todos que estão em volta e não precisa ir até o target. Ou seja seria uma skill em área que ele iria jogar todos os monstros ou player's em volta para longe e daria dano a esses player's. Editado Outubro 21, 2017 7 anos por TheKiler (veja o histórico de edições)
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.