• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Spell: Dodge

Werewolf

Forbidden Ascension
Joined
Jul 15, 2012
Messages
886
Reaction score
123
(I use TFS 0.3.6 8.54)

Is it Possible to make a spell that teleport a character say... 1-3 Squares in a single direction, using a spell. so like..

When using dodge skill North -- Character teleports 3 squares to the North
When using dodge skill east -- Character teleports 3 squares to the east
When using dodge skill South -- Character teleports 3 squares to the South
When using dodge skill West -- Character teleports 3 squares to the West

the reason for this spell is to, spice up melee combat a little bit.
 
Last edited:
Yes, a teleport that goes in 1 of the 4 directions the 4 examples i put up are 4 different spells.. although if its possible to some how make it 1 spell

thats cool too.
 
LUA:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_SUBID, 2)
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setConditionParam(condition, CONDITION_PARAM_TICKS, 5 * 60 * 1000)

local config = {
	requiredMana = 90,
	sqmDodged = 3,
	vocations = {1, 2, 3, 4}
}

function onCastSpell(cid, var)
	local pos = getClosestFreeTile(cid, getPosByDir(getCreaturePosition(cid), getCreatureLookDirection(cid), config.sqmDodged), false, false)
	if(not isInArray(config.vocations, getPlayerVocation(cid))) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		doSendMagicEffect(pos, CONST_ME_POFF)
		return false
	end
	
	if(getCreatureMana(cid) < config.requiredMana) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHMANA)
		doSendMagicEffect(pos, CONST_ME_POFF)
		return false
	end

	doAddCondition(cid, condition)
	doTeleportThing(cid, pos, false)
	doSendMagicEffect(pos, CONST_ME_TELEPORT)
	doCreatureAddMana(cid, - config.requiredMana, false)
	doCreatureSay(cid, "Missed me!", TALKTYPE_MONSTER, nil, nil, pos)
	return true
end
I made this a few moments ago. It is not tested and may not work. Try it and let me know! ^_^
 
Last edited:
Hey i Had an idea... Is it possible to make a spell, were its an active buff for. 10 Seconds. and when you Click the directional key. your character teleports, 3 Squares in that direction?

So for that 10 seconds, your character basically, quickly scoots around. Is that possible to do? would be awsome.

And J.Dre your Spell works great, however it Teleports you into walls, then you cant get out XD.
 
LUA:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_SUBID, 2)
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setConditionParam(condition, CONDITION_PARAM_TICKS, 5 * 60 * 1000)
 
local config = {
	sqmDodged = 3
}

function isClear(pos)
	local tile = getTileThingByPos({x=pos.x, y=pos.y, z=pos.z, stackpos=0})
	if tile ~= 0 and not hasProperty(tile.uid, CONST_PROP_BLOCKSOLID) and not getTileInfo(pos).house and not isCreature(getTopCreature(pos).uid) then
		return true
	end
end

function onCastSpell(cid, var)
	local pos = getClosestFreeTile(cid, getPosByDir(getCreaturePosition(cid), getCreatureLookDirection(cid), config.sqmDodged), false, false)
	if(not pos or isInArray({pos.x, pos.y}, 0)) or (getTilePzInfo(pos)) or not isClear(pos) then
		doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) 
		doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		return false
	end
 
	if(doTeleportThing(cid, pos, true)) then
	doAddCondition(cid, condition)
	doSendMagicEffect(pos, CONST_ME_TELEPORT)
	doCreatureSay(cid, "Missed me!", TALKTYPE_MONSTER, nil, nil, pos)
	end
	
	return true
end

Fixed J.Dre script, Rep++ or whatever goes to him.
 
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_GROUNDSHAKER)

local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_SUBID, 2)
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setConditionParam(condition, CONDITION_PARAM_TICKS, 5 * 60 * 1000)
 
local config = {
	sqmDodged = -2
}
 
 local arr = {
{0, 0, 3, 0, 0},
{0, 0, 1, 0, 0},
{0, 0, 0, 0, 0}
}

local area = createCombatArea(arr)
setCombatArea(combat, area)

function isClear(pos)
	local tile = getTileThingByPos({x=pos.x, y=pos.y, z=pos.z, stackpos=0})
	if tile ~= 0 and not hasProperty(tile.uid, CONST_PROP_BLOCKSOLID) and not getTileInfo(pos).house and not isCreature(getTopCreature(pos).uid) then
		return true
	end
end
 
function onCastSpell(cid, var)
	local pos = getClosestFreeTile(cid, getPosByDir(getCreaturePosition(cid), getCreatureLookDirection(cid), config.sqmDodged), false, false)
	if(not pos or isInArray({pos.x, pos.y}, 0)) or (getTilePzInfo(pos)) or not isClear(pos) then
		doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) 
		doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		return false
	end
 
	if(doTeleportThing(cid, pos, true)) then
	doAddCondition(cid, condition)
	doCombat(cid, combat, var)
	doSendMagicEffect(pos, CONST_ME_EXPLOSIONAREA)
	end
 
	return true
end

Alright so i made a few tweaks to it, and give it some effects. But i have ran into a problem.. People can use the spell to go past, trees, Rocks, Hedges, and any type of obstetrical except for walls.. does anyone know how to make it so they cannot teleport past trees and stuff?
 
You have to change the stackpos to 1, but I think you might dodge through caves or something... But you don't lose anything by testing it :)
 
local places = {
[0] = {x=x, y=(y-tiles), z=z, stackpos = 253},
[1] = {x=(x+tiles), y=y, z=z, stackpos = 253},
[2] = {x=x, y=(y+tiles), z=z, stackpos = 253},
[3] = {x=(x-tiles), y=y, z=z, stackpos = 253}}
return places[getPlayerLookDir(cid)]
end

Something like this maybe?
 

Similar threads

Back
Top