lukervis 0 Postado Março 14, 2012 Share Postado Março 14, 2012 (editado) Então... estou com essa magia aqui e não consegui colocar ela para funcionar somente se o player estiver com algum target, antes que venham falar para eu colocar needtarget="1" no spells.xml, eu ja fiz isso e não deu... Essa é a magia: local conf = { summon = {"Headcaptor", "Headcaptor", "Headcaptor", "Headcaptor"}, -- nome dos 4 monstros que irão aparecer. min = 500, -- dano minimo de cada SD max = 550, -- dano maximo de cada SD hits = 1, -- qntos hits cada summon vai dar exhaustionInSeconds = 50, -- segundos de exausted storage = 34534 -- storage(não mexa) } local summon = { monster = function (cid, tab, k) for _, mid in pairs(tab) do s = doSummonCreature(mid, getThingPos(k)) doSendMagicEffect(getThingPos(s), 10) doConvinceCreature(cid, s) end end, attack = function (cid, target, min, max) for _, summon in pairs(getCreatureSummons(cid)) do if isCreature(target) and isCreature(summon) then doSendDistanceShoot(getThingPos(summon), getThingPos(target), CONST_ANI_SUDDENDEATH) doAreaCombatHealth(summon, COMBAT_DEATHDAMAGE, getThingPos(target), 0, -min, -max, CONST_ME_MORTAREA) end end end, remove = function (cid) for _, summon in pairs(getCreatureSummons(cid)) do if isCreature(summon) then doRemoveCreature(summon) end end end, } function onCastSpell(cid, var) if(exhaustion.check(cid, conf.storage) == TRUE) then doPlayerSendCancel(cid, "You can only use after [" .. exhaustion.get(cid, 34534).."] seconds.") return false end local target = getCreatureTarget(cid) if target then summon.monster(cid, conf.summon, target) for i = 1, conf.hits do addEvent(summon.attack, 200 * i, cid, target, conf.min, conf.max) end addEvent(summon.remove, conf.hits * 500 + 500, cid) end exhaustion.set(cid, conf.storage, conf.exhaustionInSeconds) return true end Quando eu solto ela sem target, aparece a magia no default, gasta mana e da alguns erros no distro: [14/03/2012 13:51:50] [Error - Spell Interface] [14/03/2012 13:51:50] data/spells/scripts/edits/utevo mort.lua:onCastSpell [14/03/2012 13:51:50] Description: [14/03/2012 13:51:50] (luaGetThingPosition) Thing not found [14/03/2012 13:51:50] [Error - Spell Interface] [14/03/2012 13:51:50] data/spells/scripts/edits/utevo mort.lua:onCastSpell [14/03/2012 13:51:50] Description: [14/03/2012 13:51:50] (luaGetThingPosition) Thing not found [14/03/2012 13:51:50] [Error - Spell Interface] [14/03/2012 13:51:50] data/spells/scripts/edits/utevo mort.lua:onCastSpell [14/03/2012 13:51:50] Description: [14/03/2012 13:51:50] (luaDoConvinceCreature) Creature not found [14/03/2012 13:51:50] [Error - Spell Interface] [14/03/2012 13:51:50] data/spells/scripts/edits/utevo mort.lua:onCastSpell [14/03/2012 13:51:50] Description: [14/03/2012 13:51:50] (luaGetThingPosition) Thing not found [14/03/2012 13:51:50] [Error - Spell Interface] [14/03/2012 13:51:50] data/spells/scripts/edits/utevo mort.lua:onCastSpell [14/03/2012 13:51:50] Description: [14/03/2012 13:51:50] (luaGetThingPosition) Thing not found [14/03/2012 13:51:50] [Error - Spell Interface] [14/03/2012 13:51:50] data/spells/scripts/edits/utevo mort.lua:onCastSpell [14/03/2012 13:51:50] Description: [14/03/2012 13:51:50] (luaDoConvinceCreature) Creature not found [14/03/2012 13:51:50] [Error - Spell Interface] [14/03/2012 13:51:50] data/spells/scripts/edits/utevo mort.lua:onCastSpell [14/03/2012 13:51:50] Description: [14/03/2012 13:51:50] (luaGetThingPosition) Thing not found [14/03/2012 13:51:50] [Error - Spell Interface] [14/03/2012 13:51:50] data/spells/scripts/edits/utevo mort.lua:onCastSpell [14/03/2012 13:51:50] Description: [14/03/2012 13:51:50] (luaGetThingPosition) Thing not found [14/03/2012 13:51:50] [Error - Spell Interface] [14/03/2012 13:51:50] data/spells/scripts/edits/utevo mort.lua:onCastSpell [14/03/2012 13:51:50] Description: [14/03/2012 13:51:50] (luaDoConvinceCreature) Creature not found [14/03/2012 13:51:50] [Error - Spell Interface] [14/03/2012 13:51:50] data/spells/scripts/edits/utevo mort.lua:onCastSpell [14/03/2012 13:51:50] Description: [14/03/2012 13:51:50] (luaGetThingPosition) Thing not found [14/03/2012 13:51:50] [Error - Spell Interface] [14/03/2012 13:51:50] data/spells/scripts/edits/utevo mort.lua:onCastSpell [14/03/2012 13:51:50] Description: [14/03/2012 13:51:50] (luaGetThingPosition) Thing not found [14/03/2012 13:51:50] [Error - Spell Interface] [14/03/2012 13:51:50] data/spells/scripts/edits/utevo mort.lua:onCastSpell Editado Março 14, 2012 por luakao Link para o comentário https://xtibia.com/forum/topic/182504-m%C3%A1gia-somente-com-target/ Compartilhar em outros sites More sharing options...
Vinc 101 Postado Março 14, 2012 Share Postado Março 14, 2012 (editado) tenta assim,tbm pois aquele bagulho das posição local conf = { summon = {"Headcaptor", "Headcaptor", "Headcaptor", "Headcaptor"}, -- nome dos 4 monstros que irão aparecer. min = 500, -- dano minimo de cada SD max = 550, -- dano maximo de cada SD hits = 1, -- qntos hits cada summon vai dar exhaustionInSeconds = 50, -- segundos de exausted storage = 34534 -- storage(não mexa) } i = 1 local summon = { monster = function (cid, tab, k) for _, mid in pairs(tab) do pos = getThingPos(k) posk = { {x = pos.x + 1, y = pos.y + 1,z = pos.z}, {x = pos.x - 1, y = pos.y + 1,z = pos.z}, {x = pos.x + 1, y = pos.y - 1,z = pos.z}, {x = pos.x - 1, y = pos.y - 1,z = pos.z} } s = doSummonCreature(mid, posk) doSendMagicEffect(getThingPos(s), 10) doConvinceCreature(cid, s) i = i + 1 end end, attack = function (cid, target, min, max) for _, summon in pairs(getCreatureSummons(cid)) do if isCreature(target) and isCreature(summon) then doSendDistanceShoot(getThingPos(summon), getThingPos(target), CONST_ANI_SUDDENDEATH) doAreaCombatHealth(summon, COMBAT_DEATHDAMAGE, getThingPos(target), 0, -min, -max, CONST_ME_MORTAREA) end end end, remove = function (cid) for _, summon in pairs(getCreatureSummons(cid)) do if isCreature(summon) then doRemoveCreature(summon) end end end, } function onCastSpell(cid, var) if(exhaustion.check(cid, conf.storage) == TRUE) then doPlayerSendCancel(cid, "You can only use after [" .. exhaustion.get(cid, 34534).."] seconds.") return false end local target = getCreatureTarget(cid) if target ~= 0 and target ~= nill then summon.monster(cid, conf.summon, target) for i = 1, conf.hits do addEvent(summon.attack, 200 * i, cid, target, conf.min, conf.max) end addEvent(summon.remove, conf.hits * 500 + 500, cid) end exhaustion.set(cid, conf.storage, conf.exhaustionInSeconds) return true end Editado Março 14, 2012 por lordbug99 Link para o comentário https://xtibia.com/forum/topic/182504-m%C3%A1gia-somente-com-target/#findComment-1217274 Compartilhar em outros sites More sharing options...
lukervis 0 Postado Março 14, 2012 Autor Share Postado Março 14, 2012 (editado) Opa, você novamente iauheuiae, então... coloquei a magia, só que quando eu vou soltar pela segunda vez, da um erro Erro: [14/03/2012 14:59:46] [Error - Spell Interface] [14/03/2012 14:59:46] data/spells/scripts/edits/utevo mort.lua:onCastSpell [14/03/2012 14:59:46] Description: [14/03/2012 14:59:46] attempt to index a nil value [14/03/2012 14:59:46] stack traceback: [14/03/2012 14:59:46] [C]: in function 'doCreateMonster' [14/03/2012 14:59:46] data/lib/050-function.lua:283: in function 'doSummonCreature' [14/03/2012 14:59:46] data/spells/scripts/edits/utevo mort.lua:15: in function 'monster' [14/03/2012 14:59:46] data/spells/scripts/edits/utevo mort.lua:47: in function <data/spells/scripts/pbot/utevo mort.lua:38> Editado Março 14, 2012 por luakao Link para o comentário https://xtibia.com/forum/topic/182504-m%C3%A1gia-somente-com-target/#findComment-1217278 Compartilhar em outros sites More sharing options...
Vinc 101 Postado Março 14, 2012 Share Postado Março 14, 2012 tenta asim local conf = { summon = {"Headcaptor", "Headcaptor", "Headcaptor", "Headcaptor"}, -- nome dos 4 monstros que irão aparecer. min = 500, -- dano minimo de cada SD max = 550, -- dano maximo de cada SD hits = 1, -- qntos hits cada summon vai dar exhaustionInSeconds = 50, -- segundos de exausted storage = 34534 -- storage(não mexa) } local summon = { monster = function (cid, tab, k, l) for _, mid in pairs(tab) do pos = getThingPos(k) posk = { {x = pos.x + 1, y = pos.y + 1,z = pos.z}, {x = pos.x - 1, y = pos.y + 1,z = pos.z}, {x = pos.x + 1, y = pos.y - 1,z = pos.z}, {x = pos.x - 1, y = pos.y - 1,z = pos.z} } s = doSummonCreature(mid, posk[l]) doSendMagicEffect(getThingPos(s), 10) doConvinceCreature(cid, s) l = l + 1 end end, attack = function (cid, target, min, max) for _, summon in pairs(getCreatureSummons(cid)) do if isCreature(target) and isCreature(summon) then doSendDistanceShoot(getThingPos(summon), getThingPos(target), CONST_ANI_SUDDENDEATH) doAreaCombatHealth(summon, COMBAT_DEATHDAMAGE, getThingPos(target), 0, -min, -max, CONST_ME_MORTAREA) end end end, remove = function (cid) for _, summon in pairs(getCreatureSummons(cid)) do if isCreature(summon) then doRemoveCreature(summon) end end end, } function onCastSpell(cid, var) if(exhaustion.check(cid, conf.storage) == TRUE) then doPlayerSendCancel(cid, "You can only use after [" .. exhaustion.get(cid, 34534).."] seconds.") return false end local target = getCreatureTarget(cid) if target ~= 0 and target ~= nill then i = 1 summon.monster(cid, conf.summon, target, i) for i = 1, conf.hits do addEvent(summon.attack, 200 * i, cid, target, conf.min, conf.max) end addEvent(summon.remove, conf.hits * 500 + 500, cid) end exhaustion.set(cid, conf.storage, conf.exhaustionInSeconds) return true end se de esse erro denovo,abre o 050-lib e passa a fumção doSumonCreature eu acho que o erro foi a posição, por causa que o "i" tava isolado Link para o comentário https://xtibia.com/forum/topic/182504-m%C3%A1gia-somente-com-target/#findComment-1217283 Compartilhar em outros sites More sharing options...
lukervis 0 Postado Março 14, 2012 Autor Share Postado Março 14, 2012 (editado) Caraca velho, obrigado meeeeeeeesmo! REP+ REP+ REP+ REP+ REP+ REP+ REP+ Editado Março 14, 2012 por luakao Link para o comentário https://xtibia.com/forum/topic/182504-m%C3%A1gia-somente-com-target/#findComment-1217287 Compartilhar em outros sites More sharing options...
Vinc 101 Postado Março 14, 2012 Share Postado Março 14, 2012 qual quer coisa so manda pm, nem pedi msn que eu nunca to on uassauhsauhasuh Link para o comentário https://xtibia.com/forum/topic/182504-m%C3%A1gia-somente-com-target/#findComment-1217289 Compartilhar em outros sites More sharing options...
lukervis 0 Postado Março 14, 2012 Autor Share Postado Março 14, 2012 Okay, valeuzão Link para o comentário https://xtibia.com/forum/topic/182504-m%C3%A1gia-somente-com-target/#findComment-1217290 Compartilhar em outros sites More sharing options...
Posts Recomendados