Postado Janeiro 27, 2019 6 anos Boa tarde guys, tô com um problema em uma spell, mas não consegui arrumar, vou postar a script e estarei explicando logo abaixo: local configSpell = { exhaustStorage = 55230, -- se quiser pode mudar exhaustTime = 5 -- exhausted em segundos } local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -16, 0, -16, 0) local function isWalkable(pos, creature, pz, proj) if(getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0) then return false end if(getTilePzInfo(pos) and not pz) then return false end local n = not proj and 3 or 2 for i = 0, 255 do pos.stackpos = i local tile = getTileThingByPos(pos) if(tile.itemid ~= 0 and not isCreature(tile.uid)) then if(hasProperty(tile.uid, n) or hasProperty(tile.uid, 7)) then return false end end end if(getTopCreature(pos).uid ~= 0 and not creature) then return false end return true end local function doSpell(cid, target, var) local pos = getThingPos(target) local posit = getCreaturePosition(cid) local posi = {x=getThingPosition(getCreatureTarget(cid)).x+1, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z} local config = { [NORTH] = {SOUTH, {x=pos.x, y=pos.y+1, z=pos.z}}, [EAST] = {WEST, {x=pos.x-1, y=pos.y, z=pos.z}}, [SOUTH] = {NORTH, {x=pos.x, y=pos.y-1, z=pos.z}}, [WEST] = {EAST, {x=pos.x+1, y=pos.y, z=pos.z}} } local a, b = config[getCreatureLookDirection(target)], getCreatureLookPosition(target) if(isWalkable(a[2]) and isWalkable(b)) then doTeleportThing(cid, a[2], false) doCreatureSetLookDirection(cid, getCreatureLookDirection(target)) doSendMagicEffect(posit, 390) doCombat(cid, combat, var) doSendMagicEffect(posi, 298) else doPlayerSendCancel(cid, "Não pode ir para lá.") return false end return true end function onCastSpell(cid, var) if(isPlayer(cid) and exhaustion.check(cid, configSpell.exhaustStorage)) then doPlayerSendCancel(cid, "Voce está exausto.") return false end exhaustion.set(cid, configSpell.exhaustStorage, configSpell.exhaustTime) return doSpell(cid, getCreatureTarget(cid), var) end A spell tem duas condições, e o cooldown se aplica as duas, queria que ele só contasse se a spell desse o dano.
Postado Janeiro 27, 2019 6 anos Solução @ZeeroBR local configSpell = { exhaustStorage = 55230, -- se quiser pode mudar exhaustTime = 5 -- exhausted em segundos } local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -16, 0, -16, 0) local function isWalkable(pos, creature, pz, proj) if(getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0) then return false end if(getTilePzInfo(pos) and not pz) then return false end local n = not proj and 3 or 2 for i = 0, 255 do pos.stackpos = i local tile = getTileThingByPos(pos) if(tile.itemid ~= 0 and not isCreature(tile.uid)) then if(hasProperty(tile.uid, n) or hasProperty(tile.uid, 7)) then return false end end end if(getTopCreature(pos).uid ~= 0 and not creature) then return false end return true end local function doSpell(cid, target, var) local pos = getThingPos(target) local posit = getCreaturePosition(cid) local posi = {x=getThingPosition(getCreatureTarget(cid)).x+1, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z} local config = { [NORTH] = {SOUTH, {x=pos.x, y=pos.y+1, z=pos.z}}, [EAST] = {WEST, {x=pos.x-1, y=pos.y, z=pos.z}}, [SOUTH] = {NORTH, {x=pos.x, y=pos.y-1, z=pos.z}}, [WEST] = {EAST, {x=pos.x+1, y=pos.y, z=pos.z}} } local a, b = config[getCreatureLookDirection(target)], getCreatureLookPosition(target) if(isWalkable(a[2]) and isWalkable(b)) then doTeleportThing(cid, a[2], false) doCreatureSetLookDirection(cid, getCreatureLookDirection(target)) doSendMagicEffect(posit, 390) doCombat(cid, combat, var) exhaustion.set(cid, configSpell.exhaustStorage, configSpell.exhaustTime) doSendMagicEffect(posi, 298) else doPlayerSendCancel(cid, "Não pode ir para lá.") return false end return true end function onCastSpell(cid, var) if(isPlayer(cid) and exhaustion.check(cid, configSpell.exhaustStorage)) then doPlayerSendCancel(cid, "Voce está exausto.") return false end return doSpell(cid, getCreatureTarget(cid), var) end
Postado Janeiro 27, 2019 6 anos Autor 4 horas atrás, Storm disse: @ZeeroBR local configSpell = { exhaustStorage = 55230, -- se quiser pode mudar exhaustTime = 5 -- exhausted em segundos } local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -16, 0, -16, 0) local function isWalkable(pos, creature, pz, proj) if(getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0) then return false end if(getTilePzInfo(pos) and not pz) then return false end local n = not proj and 3 or 2 for i = 0, 255 do pos.stackpos = i local tile = getTileThingByPos(pos) if(tile.itemid ~= 0 and not isCreature(tile.uid)) then if(hasProperty(tile.uid, n) or hasProperty(tile.uid, 7)) then return false end end end if(getTopCreature(pos).uid ~= 0 and not creature) then return false end return true end local function doSpell(cid, target, var) local pos = getThingPos(target) local posit = getCreaturePosition(cid) local posi = {x=getThingPosition(getCreatureTarget(cid)).x+1, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z} local config = { [NORTH] = {SOUTH, {x=pos.x, y=pos.y+1, z=pos.z}}, [EAST] = {WEST, {x=pos.x-1, y=pos.y, z=pos.z}}, [SOUTH] = {NORTH, {x=pos.x, y=pos.y-1, z=pos.z}}, [WEST] = {EAST, {x=pos.x+1, y=pos.y, z=pos.z}} } local a, b = config[getCreatureLookDirection(target)], getCreatureLookPosition(target) if(isWalkable(a[2]) and isWalkable(b)) then doTeleportThing(cid, a[2], false) doCreatureSetLookDirection(cid, getCreatureLookDirection(target)) doSendMagicEffect(posit, 390) doCombat(cid, combat, var) exhaustion.set(cid, configSpell.exhaustStorage, configSpell.exhaustTime) doSendMagicEffect(posi, 298) else doPlayerSendCancel(cid, "Não pode ir para lá.") return false end return true end function onCastSpell(cid, var) if(isPlayer(cid) and exhaustion.check(cid, configSpell.exhaustStorage)) then doPlayerSendCancel(cid, "Voce está exausto.") return false end return doSpell(cid, getCreatureTarget(cid), var) end Valeu aí, funcionou perfeitamente! Rep+
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.