Postado Janeiro 1, 2015 10 anos local configs = { radius = {2, 2}, -- 2 X 2 validSlots = {1, 4, 7, 8}, -- Head, Body, Legs, Feet msg = "Armors Attack!", } local sets = { [1] = {items = {7900, 7899, 7894, 7891}, distaceEffect = CONST_ANI_FIRE, effect = CONST_ME_FIREATTACK, combat = COMBAT_FIREDAMAGE, chance = 20, min_max = {100, 300}}, [2] = {items = {11499, 11500, 11501, 11502}, distaceEffect = CONST_ANI_ICE, effect = CONST_ME_ICEATTACK, combat = COMBAT_ICEDAMAGE, chance = 40, min_max = {1000, 3000}}, } local function getCreaturesInArea(fromPos, toPos) local retPlayers = {} for x = fromPos.x, toPos.x do for y = fromPos.y, toPos.y do local player = getTopCreature({x=x, y=y, z=fromPos.z}) if isMonster(player.uid) then table.insert(retPlayers, player.uid) end end end return retPlayers end local function table.compare(table1, table2) local n = 0 local maxn = 0 if #table1 == #table2 then maxn = #table1 else return false end for i = 1, #table1 do for s = 1, #table2 do if table1[i] == table2[s] then n = n + 1 end end end if n == maxn then return true end return false end function onStatsChange(cid, attacker, type, combat, value) local playerSet = {} for s = 1, #configs.validSlots do if getPlayerSlotItem(cid, configs.validSlots[s]).uid > 0 then table.insert(playerSet, getPlayerSlotItem(cid, configs.validSlots[s]).itemid) end end for i = 1, #sets do if table.compare(sets[i].items, playerSet) then if math.random(100) <= sets[i].chance then local creatures = getCreaturesInArea({x = getThingPos(cid).x - configs.radius[1], y = getThingPos(cid).y - configs.radius[1], z = getThingPos(cid).z}, {x = getThingPos(cid).x + configs.radius[2], y = getThingPos(cid).y + configs.radius[2]}) if isPlayer(attacker) then table.insert(creatures, attacker) end doSendMagicEffect(getThingPos(cid), sets[i].effect) doCreatureSay(cid, configs.msg, TALKTYPE_MONSTER) for c = 1, #creatures do addEvent(function() doSendDistanceShoot(getThingPos(cid), getThingPos(creatures[c]), sets[i].distaceEffect) doAreaCombatHealth(cid, sets[i].combat, getThingPos(creatures[c]), 0, - sets[i].min_max[1], - sets[i].min_max[2], sets[i].effect) end, c * 100) end end end end return true end aqui ta dando erro 28 '(' expected near ',' Editado Janeiro 1, 2015 10 anos por jhony157 (veja o histórico de edições)
Postado Janeiro 1, 2015 10 anos Autor local configs = { radius = {2, 2}, -- 2 X 2 validSlots = {1, 4, 7, 8}, -- Head, Body, Legs, Feet msg = "Armors Attack!", } local sets = { [1] = {items = {7900, 7899, 7894, 7891}, distaceEffect = CONST_ANI_FIRE, effect = CONST_ME_FIREATTACK, combat = COMBAT_FIREDAMAGE, chance = 20, min_max = {100, 300}}, [2] = {items = {11499, 11500, 11501, 11502}, distaceEffect = CONST_ANI_ICE, effect = CONST_ME_ICEATTACK, combat = COMBAT_ICEDAMAGE, chance = 40, min_max = {1000, 3000}}, } local function getCreaturesInArea(fromPos, toPos) local retPlayers = {} for x = fromPos.x, toPos.x do for y = fromPos.y, toPos.y do local player = getTopCreature({x=x, y=y, z=fromPos.z}) if isMonster(player.uid) then table.insert(retPlayers, player.uid) end end end return retPlayers end local function table.compare(table1, table2) local n = 0 local maxn = 0 if #table1 == #table2 then maxn = #table1 else return false end for i = 1, #table1 do for s = 1, #table2 do if table1[i] == table2[s] then n = n + 1 end end end if n == maxn then return true end return false end function onStatsChange(cid, attacker, type, combat, value) local playerSet = {} for s = 1, #configs.validSlots do if getPlayerSlotItem(cid, configs.validSlots[s]).uid > 0 then table.insert(playerSet, getPlayerSlotItem(cid, configs.validSlots[s]).itemid) end end for i = 1, #sets do if table.compare(sets[i].items, playerSet) then if math.random(100) <= sets[i].chance then local creatures = getCreaturesInArea({x = getThingPos(cid).x - configs.radius[1], y = getThingPos(cid).y - configs.radius[1], z = getThingPos(cid).z}, {x = getThingPos(cid).x + configs.radius[2], y = getThingPos(cid).y + configs.radius[2]}) if isPlayer(attacker) then table.insert(creatures, attacker) end doSendMagicEffect(getThingPos(cid), sets[i].effect) doCreatureSay(cid, configs.msg, TALKTYPE_MONSTER) for c = 1, #creatures do addEvent(function() doSendDistanceShoot(getThingPos(cid), getThingPos(creatures[c]), sets[i].distaceEffect) doAreaCombatHealth(cid, sets[i].combat, getThingPos(creatures[c]), 0, - sets[i].min_max[1], - sets[i].min_max[2], sets[i].effect) end, c * 100) end end end end return true end aqui ta dando erro 28 '(' expected near ',' Opa brother, obrigado por reportar. Já arrumei no tópico.
Postado Janeiro 2, 2015 10 anos Autor legalzinho, lembra um sistema de aura q tinha feito. rep+ Opa, valeu lek <3
Postado Janeiro 4, 2015 10 anos ae pq aqui fica dando esse erro data/creaturescripts/scripts/armorsattack.lua:onStatschange <LuaGetThingPosition>Thing not found acho q so acontece quando ele ta tipo em andar de cima ai da o erro
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.