kingsley666
Active Member
Hello OtLand.
I just made my first spell and i want to share with you, hope you can give some feedbacks.
TFS I used: 1.2
As the title say, the spell teleport you to the back of your target with some restrictions.
The following images are for reference:
Facing the monster:
You don't need to be facing the monster, the spells works validating the distance of 2 sqm from the mosnter/player, also you need to be attacking the enemy.
Then if you are close enough it will teleport you to the back of the monster and will set your direction the same as the target.
You could use it for a dagger or rogue vocation, followed by a spell to attack from back .
Installation:
spells/spells.xml
spells/scripts/attack/back_port.lua
Hope i helped you, enjoy.
I just made my first spell and i want to share with you, hope you can give some feedbacks.
TFS I used: 1.2
As the title say, the spell teleport you to the back of your target with some restrictions.
The following images are for reference:
Facing the monster:
You don't need to be facing the monster, the spells works validating the distance of 2 sqm from the mosnter/player, also you need to be attacking the enemy.
Then if you are close enough it will teleport you to the back of the monster and will set your direction the same as the target.
You could use it for a dagger or rogue vocation, followed by a spell to attack from back .
Installation:
spells/spells.xml
Lua:
<instant group="attack" spellid="122" name="Back Port" words="backstab" lvl="40" mana="20" prem="0" range="2" casterTargetOrDirection="1" needlearn="0" blockwalls="1" cooldown="2000" groupcooldown="2000" script="support/back_port.lua">
<vocation name="Paladin" />
<vocation name="Royal Paladin" />
</instant>
spells/scripts/attack/back_port.lua
Lua:
function onCastSpell(creature, variant)
local north = 0
local south = 2
local east = 1
local west = 3
local creaturePosition = creature:getPosition()
local creatureDirection = creature:getDirection()
if creature:getTarget() ~= nil then
enemy = creature:getTarget()
targetPosition = enemy:getPosition()
enemyDirection = enemy:getDirection()
else
creature:sendCancelMessage("You need to select a target.")
creaturePosition:sendMagicEffect(CONST_ME_POFF)
return false
end
if enemyDirection == north then
targetPosition.y = targetPosition.y + 1
elseif enemyDirection == south then
targetPosition.y = targetPosition.y - 1
elseif enemyDirection == east then
targetPosition.x = targetPosition.x - 1
else
targetPosition.x = targetPosition.x + 1
end
creature:teleportTo(targetPosition)
creature:setDirection(enemyDirection)
creaturePosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
creaturePosition = creature:getPosition()
creaturePosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
return false
end
Hope i helped you, enjoy.