sabodden
Member
- Joined
- Sep 27, 2019
- Messages
- 138
- Reaction score
- 18
I have this spell, to teleport player to a target
But i would like to make some changes...
It teleport player to target position, i would like to teleport player to the target back
lookingDirection prints:
0 north, 2 south, 1 east, 3 west
But how to detect back target position, if is valid to teleport and teleport if it is?
Code:
<instant name="Jump Target" words="jump target" range="5" maglv="11" mana="100" prem="0" aggressive="0" needtarget="1" params="0" exhaustion="2000" needlearn="0" event="script" value="attack/jump target.lua">
<vocation id="1"/>
<vocation id="5"/>
</instant>
Code:
local config = {
effect = 65, -- efeito
}
function onCastSpell(cid, var)
local target = variantToNumber(var)
if isCreature(cid) and isCreature(target) then
local lookingDirection = getCreatureLookDirection(target)
print(lookingDirection)
doSendMagicEffect(getThingPos(cid), config.effect)
doTeleportThing(cid, getThingPos(target))
doSendMagicEffect(getThingPos(cid), config.effect)
end
return true
end
But i would like to make some changes...
It teleport player to target position, i would like to teleport player to the target back
lookingDirection prints:
0 north, 2 south, 1 east, 3 west
But how to detect back target position, if is valid to teleport and teleport if it is?