LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_BLOCKHIT)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_MANASHIELD)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -60, -1, -60, 5, 5, 4, 7)
function onGetFormulaValues(cid, level, skill)
local min = -(level * 3.0) * 1.0
local max = -(level * 6.0) * 1.0
return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
local e = 146
local et = 10
local target = getCreatureTarget(cid)
local pPos = getCreaturePosition(target)
local b = getPlayerLookDirection(cid)
local pPas = getCreaturePosition(cid)
local SQM = 1
local positions = {
north = {x = pPos.x, y = pPos.y-SQM, z = pPos.z},
west = {x = pPos.x-SQM, y = pPos.y, z = pPos.z},
south = {x = pPos.x, y = pPos.y+SQM, z = pPos.z},
east = {x = pPos.x+SQM, y = pPos.y, z = pPos.z},
northwest = {x = pPos.x-SQM, y = pPos.y-SQM, z = pPos.z},
northeast = {x = pPos.x+SQM, y = pPos.y-SQM, z = pPos.z},
southwest = {x = pPos.x-SQM, y = pPos.y+SQM, z = pPos.z},
southeast = {x = pPos.x+SQM, y = pPos.y+SQM, z = pPos.z}
}
if(exhaustion.check(cid, e) == false) then
if(isPlayer(cid)) then
if(getCreatureSpeed(target) ~= 0) then
if(isItemEquipped(cid, WEAPON_SHIELD)) then
-- Rakt
if(isInRange(pPas, positions.north, positions.north)) then
if(isWalkable(cid, positions.south)) then
doTeleportThing(target, positions.south)
doCombat(cid, combat, var)
doSendAnimatedText(pPos, "Boom", TEXTCOLOR_RED)
exhaustion.set(cid, e, et)
else
doCombat(cid, combat, var)
doSendAnimatedText(pPos, "Boom", TEXTCOLOR_RED)
exhaustion.set(cid, e, et)
return false
end
elseif(isInRange(pPas, positions.south, positions.south)) then
if(isWalkable(cid, positions.north)) then
doTeleportThing(target, positions.north)
doCombat(cid, combat, var)
doSendAnimatedText(pPos, "Boom", TEXTCOLOR_RED)
exhaustion.set(cid, e, et)
else
doCombat(cid, combat, var)
doSendAnimatedText(pPos, "Boom", TEXTCOLOR_RED)
exhaustion.set(cid, e, et)
return false
end
elseif(isInRange(pPas, positions.west, positions.west)) then
if(isWalkable(cid, positions.east)) then
doTeleportThing(target, positions.east)
doCombat(cid, combat, var)
doSendAnimatedText(pPos, "Boom", TEXTCOLOR_RED)
exhaustion.set(cid, e, et)
else
doCombat(cid, combat, var)
doSendAnimatedText(pPos, "Boom", TEXTCOLOR_RED)
exhaustion.set(cid, e, et)
return false
end
elseif(isInRange(pPas, positions.east, positions.east)) then
if(isWalkable(cid, positions.west)) then
doTeleportThing(target, positions.west)
doCombat(cid, combat, var)
doSendAnimatedText(pPos, "Boom", TEXTCOLOR_RED)
exhaustion.set(cid, e, et)
else
doCombat(cid, combat, var)
doSendAnimatedText(pPos, "Boom", TEXTCOLOR_RED)
exhaustion.set(cid, e, et)
return false
end
-- Snett
elseif(isInRange(pPas, positions.northwest, positions.northwest)) then
if(isWalkable(cid, positions.southeast)) then
doTeleportThing(target, positions.southeast)
doCombat(cid, combat, var)
doSendAnimatedText(pPos, "Boom", TEXTCOLOR_RED)
exhaustion.set(cid, e, et)
else
doCombat(cid, combat, var)
doSendAnimatedText(pPos, "Boom", TEXTCOLOR_RED)
exhaustion.set(cid, e, et)
return false
end
elseif(isInRange(pPas, positions.northeast, positions.northeast)) then
if(isWalkable(cid, positions.southwest)) then
doTeleportThing(target, positions.southwest)
doCombat(cid, combat, var)
doSendAnimatedText(pPos, "Boom", TEXTCOLOR_RED)
exhaustion.set(cid, e, et)
else
doCombat(cid, combat, var)
doSendAnimatedText(pPos, "Boom", TEXTCOLOR_RED)
exhaustion.set(cid, e, et)
return false
end
elseif(isInRange(pPas, positions.southwest, positions.southwest)) then
if(isWalkable(cid, positions.northeast)) then
doTeleportThing(target, positions.northeast)
doCombat(cid, combat, var)
doSendAnimatedText(pPos, "Boom", TEXTCOLOR_RED)
exhaustion.set(cid, e, et)
else
doCombat(cid, combat, var)
doSendAnimatedText(pPos, "Boom", TEXTCOLOR_RED)
exhaustion.set(cid, e, et)
return false
end
elseif(isInRange(pPas, positions.southeast, positions.southeast)) then
if(isWalkable(cid, positions.northwest)) then
doTeleportThing(target, positions.northwest)
doCombat(cid, combat, var)
doSendAnimatedText(pPos, "Boom", TEXTCOLOR_RED)
exhaustion.set(cid, e, et)
else
doCombat(cid, combat, var)
doSendAnimatedText(pPos, "Boom", TEXTCOLOR_RED)
exhaustion.set(cid, e, et)
return false
end
end
else
doPlayerSendCancel(cid, "You need a shield equipped to use this spell!")
return false
end
else
doCombat(cid, combat, var)
doSendAnimatedText(pPos, "Boom", TEXTCOLOR_RED)
exhaustion.set(cid, e, et)
return false
end
end
else
doPlayerSendCancel(cid, "You are exhausted.")
doSendMagicEffect(pPas, 2)
return false
end
return true
end
This is a script for a spell that when you use it on a target it knocks the target back 1 square. Now it works perfect for knocking it back ONE square. However, i want it to knock the target back 4 squares. I tried to change "local SQM = 1" to 4, 3, 2 ,10, no other numbers will work. the only number it will recognize is 1. Anyone have any ideas? Thanks.
REP++