• 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!

[Request] spell that teleports or allow characters to dash!

nas939

New Member
Joined
Mar 1, 2010
Messages
12
Reaction score
0
Well after watching jumper today >.< i sorta came up with the idea for a cool spell for tibia! from what i imagine i think it is possible to either make a character dash forward suddenly or simply teleport ahead several squares as if traveling very fast :D I'm using TFS 0.2.3 (mystic spirit) so is it possible with the lua functions for my current server?
 
data/spells/scripts/dash.lua
Code:
local t = {
	squares = 3,
	effects = {CONST_ME_POFF, CONST_ME_ENERGYAREA}
}
function onCastSpell(cid, var)
	local v, pos, dir = 0, getThingPos(cid), getPlayerLookDir(cid)
	for i = 1, t.squares do
		local cur = {x=pos.x+(dir==1 and i or dir==3 and -i or 0), y=pos.y+(dir==0 and -i or dir==2 and i or 0), z=pos.z}
		if queryTileAddThing(cid, cur) == 1 then
			for _, k in ipairs(t.effects) do
				doSendMagicEffect(cur, k)
			end
			doTeleportThing(cid, cur, true)
			v = v + 1
		else
			break
		end
	end
	return v > 0
end
data/spells/spells.xml
  • For TFS 0.3:
    Code:
    	<instant name="Dash" words="dash" lvl="1" mana="0" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="dash.lua"/>
  • For TFS 0.2:
    Code:
    	<instant name="Dash" words="dash" lvl="1" mana="0" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" script="dash.lua"/>
 
Thanks cyko XD but err i dont see the magic effects such as either a teleport kinda effect or smoke cloud trail :X how do i add those ? and i already repped you in the past so i cant rep you again for awhile :D
 
hmm i just tested it on TFS 0.2.3 and i see my character appearing ahead but no visible effects .... il go and do more tests.... i still see no effects 0.o errrm well is there a way to just modify the spell to show just the smoke effect ? i dont think my TFS can handle both effects at once :p
 
Last edited:
I see, had to make some adjustments for 0.2:
Code:
local t = {
	squares = 3,
	effects = {CONST_ME_POFF, CONST_ME_ENERGYAREA}
}
function onCastSpell(cid, var)
	local v, pos, dir, tmp = 0, getThingPos(cid), getPlayerLookDir(cid), {}
	for i = 1, t.squares do
		local cur = {x=pos.x+(dir==1 and i or dir==3 and -i or 0), y=pos.y+(dir==0 and -i or dir==2 and i or 0), z=pos.z}
		if queryTileAddThing(cid, cur) == 1 then
			table.insert(tmp, cur)
			doTeleportThing(cid, cur)
			v = v + 1
		else
			break
		end
	end
	if v > 0 then
		for _, g in ipairs(tmp) do
			for _, k in ipairs(t.effects) do
				doSendMagicEffect(g, k)
			end
		end
		return true
	end
end
 
There's one flaw. If a player uses it near stairs, he's gonna just stay on it blocking. Followed by (tile not found). I love the spell tho!
 
Last edited:
Back
Top