Postado Abril 28, 2014 11 anos Preciso de ajuda com minha spell, quero que quando o player esteja com o addon do druid full ele use o combat e quando estiver com qualquer outro addon usar o combat2. Script: local combat = createCombatObject() local meteor = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, 41) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -10.3, -47, -10.2, 2) local stun = createConditionObject(CONDITION_PARALYZE) setConditionParam(stun, CONDITION_PARAM_TICKS, 5000) setConditionFormula(stun, -0.8, 0, -0.9, 0) setCombatCondition(meteor, stun) local combat2 = createCombatObject() local meteor2 = createCombatObject() setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE) setCombatParam(combat2, COMBAT_PARAM_EFFECT, 43) setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -7.3, -47, -6.2, 2) local arr = { {0, 0, 0, 0, 0}, {0, 0, 1, 0, 0}, {0, 1, 3, 1, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 0, 0} } local arr2 = { {0, 0, 0, 0, 0}, {0, 0, 1, 0, 0}, {0, 1, 3, 1, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 0, 0} } local area = createCombatArea(arr) local area2 = createCombatArea(arr2) setCombatArea(combat, area) setCombatArea(combat2, area2) local function meteorCast(p) doCombat(p.cid, p.combat, positionToVariant(p.pos)) end local function meteorCast2(p) doCombat(p.cid, p.combat2, positionToVariant(p.pos)) end local function stunEffect(cid) doSendMagicEffect(getThingPos(cid), CONST_ME_STUN) end function onTargetTile(cid, pos) if (math.random(0, 0) == 0) then local ground = getThingfromPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}) if (isInArray(water, ground.itemid) == TRUE) then local newpos = {x = pos.x + 7, y = pos.y - 6, z = pos.z} doSendDistanceShoot(newpos, pos, CONST_ANI_ICE) addEvent(meteorCast, 200, {cid = cid, pos = pos, combat = meteor_water}) else local newpos = {x = pos.x + 7, y = pos.y - 6, z = pos.z} doSendDistanceShoot(newpos, pos, CONST_ANI_ICE) addEvent(meteorCast, 200, {cid = cid,pos = pos, combat = meteor}) end end end setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTile") function onTargetTile(cid, pos) if (math.random(0, 0) == 0) then local ground = getThingfromPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}) if (isInArray(water, ground.itemid) == TRUE) then local newpos = {x = pos.x + 7, y = pos.y - 6, z = pos.z} doSendDistanceShoot(newpos, pos, CONST_ANI_ICE) addEvent(meteorCast2, 200, {cid = cid, pos = pos, combat2 = meteor_water2}) else local newpos = {x = pos.x + 7, y = pos.y - 6, z = pos.z} doSendDistanceShoot(newpos, pos, CONST_ANI_ICE) addEvent(meteorCast2, 200, {cid = cid,pos = pos, combat2 = meteor2}) end end end setCombatCallback(combat2, CALLBACK_PARAM_TARGETTILE, "onTargetTile") function onCastSpell(cid, var) local parameters = { cid = cid, var = var, combat = combat, combat2 = combat2 } local sex = getPlayerSex(cid) localOutfit = {lookType = 144, lookAddons = 3} localOufit2 = {lookType = 148, lookAddons = 3} if sex == 0 then if getCreatureOutfit == localOutfit2 then return doCombat(cid, combat, var) else return doCombat(cid, combat2, var) end end if sex == 1 then if getCreatureOutfit == localOutfit then return doCombat(cid, combat, var) else return doCombat(cid, combat2, var) end end end Editado Abril 28, 2014 11 anos por Thiago Virtuoso (veja o histórico de edições)
Postado Abril 28, 2014 11 anos esse script tá me parecendo errado mas se não tá dando erro no console então na teoria era pra estar funcionando: experimenta tirar os returns da função onCastSpell e deixa só doCombat
Postado Abril 29, 2014 11 anos Solução local combat = createCombatObject() local meteor = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, 41) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -10.3, -47, -10.2, 2) local stun = createConditionObject(CONDITION_PARALYZE) setConditionParam(stun, CONDITION_PARAM_TICKS, 5000) setConditionFormula(stun, -0.8, 0, -0.9, 0) setCombatCondition(meteor, stun) local combat2 = createCombatObject() local meteor2 = createCombatObject() setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE) setCombatParam(combat2, COMBAT_PARAM_EFFECT, 43) setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -7.3, -47, -6.2, 2) local arr = { {0, 0, 0, 0, 0}, {0, 0, 1, 0, 0}, {0, 1, 3, 1, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 0, 0} } local arr2 = { {0, 0, 0, 0, 0}, {0, 0, 1, 0, 0}, {0, 1, 3, 1, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 0, 0} } local area = createCombatArea(arr) local area2 = createCombatArea(arr2) setCombatArea(combat, area) setCombatArea(combat2, area2) local function meteorCast(p) doCombat(p.cid, p.combat, positionToVariant(p.pos)) end local function meteorCast2(p) doCombat(p.cid, p.combat2, positionToVariant(p.pos)) end local function stunEffect(cid) doSendMagicEffect(getThingPos(cid), CONST_ME_STUN) end function onTargetTile(cid, pos) if (math.random(0, 0) == 0) then local ground = getThingfromPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}) if (isInArray(water, ground.itemid) == TRUE) then local newpos = {x = pos.x + 7, y = pos.y - 6, z = pos.z} doSendDistanceShoot(newpos, pos, CONST_ANI_ICE) addEvent(meteorCast, 200, {cid = cid, pos = pos, combat = meteor_water}) else local newpos = {x = pos.x + 7, y = pos.y - 6, z = pos.z} doSendDistanceShoot(newpos, pos, CONST_ANI_ICE) addEvent(meteorCast, 200, {cid = cid,pos = pos, combat = meteor}) end end end setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTile") function onTargetTile(cid, pos) if (math.random(0, 0) == 0) then local ground = getThingfromPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}) if (isInArray(water, ground.itemid) == TRUE) then local newpos = {x = pos.x + 7, y = pos.y - 6, z = pos.z} doSendDistanceShoot(newpos, pos, CONST_ANI_ICE) addEvent(meteorCast2, 200, {cid = cid, pos = pos, combat2 = meteor_water2}) else local newpos = {x = pos.x + 7, y = pos.y - 6, z = pos.z} doSendDistanceShoot(newpos, pos, CONST_ANI_ICE) addEvent(meteorCast2, 200, {cid = cid,pos = pos, combat2 = meteor2}) end end end setCombatCallback(combat2, CALLBACK_PARAM_TARGETTILE, "onTargetTile") local outfits = { [0] = {lookType = 144, lookAddons = 3}, [1] = {lookType = 148, lookAddons = 3} } function onCastSpell(cid, var) local conf = outfits[getPlayerSex(cid)] local outf = getCreatureOutfit(cid) if outf.lookType == conf.lookType and outf.lookAddons == conf.lookAddons then doCombat(cid, combat, var) else doCombat(cid, combat2, var) end return true end
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.