function onCastSpell(cid, var)
local target = variantToNumber(target)
if(isCreature(target)) then
local targetPos = getPositionByDirection(getCreaturePosition(target), getCreatureLookDirection(target))
if(doTileQueryAdd(cid, targetPos) == 1) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doTeleportThing(cid, targetPos)
doSendMagicEffect(targetPos, CONST_ME_TELEPORT)
return true
end
end
return false
end
Maybe smth like this:
Code:function onCastSpell(cid, var) local target = varianToNumber(target) if(isCreature(target)) then local targetPos = getPositionByDirection(getCreaturePosition(target), getCreatureLookDirection(target)) if(doTileQueryAdd(cid, targetPos) == 1) then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) doTeleportThing(cid, targetPos) doSendMagicEffect(targetPos, CONST_ME_TELEPORT) return true end return false else return false end end
function onCastSpell(cid, var)
local target = varianToNumber(target)
if(isCreature(target)) then
local targetPos = getPositionByDirection(getCreaturePosition(target), getCreatureLookDirection(target))
if(doTileQueryAdd(cid, targetPos) == 1) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doTeleportThing(cid, targetPos)
doSendMagicEffect(targetPos, CONST_ME_TELEPORT)
end
return true
end
return false
end
function onCastSpell(cid, var)
local target = varianToNumber(target)
if(isCreature(target)) then
local targetPos = getPositionByDirection(getCreaturePosition(target), getCreatureLookDirection(target))
if(doTileQueryAdd(cid, targetPos) == 1) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doTeleportThing(cid, targetPos)
doSendMagicEffect(targetPos, CONST_ME_TELEPORT)
end
return true
end
end
function onCastSpell(cid, var)
local target = varianToNumber(target)
if(isCreature(target)) then
local targetPos = getCreatureLookPosition(target)
if(doTileQueryAdd(cid, targetPos) == 1) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doTeleportThing(cid, targetPos)
doSendMagicEffect(targetPos, CONST_ME_TELEPORT)
end
return true
end
end
theyre both sameYea, let's drop false returns everywhere...
@Edit:
And umm, getCreatureLookPosition references to getPosByDir so I don't see difference, you better stfu.
@Edit2:
Edited my post, missed 't' character.![]()
function getCreatureLookPosition(cid)
return getPosByDir(getThingPos(cid), getCreatureLookDirection(cid))
end
theyre both same
-
getPosByDir = getPositionByDirection
function doTeleport(uid,target)
local targetPos = type(target) == "table" and target or getThingPos(target)
local dir = getDirectionTo(getThingPos(uid), targetPos)
local toPos = isInArray({0,1,2,3},dir) and getPosByDir(getThingPos(uid), dir, getDistanceBetween(getThingPos(uid),targetPos)+1) or getPosByDir(targetPos, dir, 1)
if not(doTileQueryAdd(uid, toPos) == 1) then
return false
end
doTeleportThing(uid,toPos)
return toPos
end
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_USECHARGES, true)
function onGetFormulaValues(cid, level, skill, attack, factor)
local vital = getCreatureHealth(cid)
local min = -(vital*(skill/50))
local max = -(vital*(skill/20))
return min, max
end
setCombatCallback(combat1, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function doRemoveHealth(cid, var) --by foxkbt
local vital = getCreatureHealth(cid)
if isCreature(cid) and getCreatureHealth(cid) >= 10 then
return doCombat(cid, combat1, var)
end
end
function onCastSpell(cid, var) -- by foxkbt
local vital = getCreatureHealth(cid)
if getPlayerStorageValue(cid, 89456) == 1 then
doPlayerSendCancel(cid, "voce esta impossibilitado de gastar mana.")
else
if doRemoveHealth(cid, var) == true then
doCreatureAddHealth(cid, -(vital - 10))
doTeleport(cid,target)
else
doPlayerSendTextMessage(cid, 26, "voce nao tem forças para usar esse jutsu")
return FALSE
end
return TRUE
end
end