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

Dash spell, but for 9.60

Nightimarez

New Member
Joined
Jul 24, 2008
Messages
287
Reaction score
2
So I have this script and it works for the old TFS, but not for the new ones. Can anyone fix it?

PHP:
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
 
Lua:
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
return true
end
 
If it expects to close line near return from line 5 then you should close it. (end is missing)
Lua:
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
    return v > 0	
		end
return true
end
 
What distro are you using?
Works for me:
dashp.png
 
Does it take mana? It is a spell after all, did you install it correctly? Did you add it to spells.xml?
example:
Lua:
	<instant group="support" spellid="1111" name="Dash" words="dash" lvl="8" mana="20" aggressive="0" selftarget="1" cooldown="2000" groupcooldown="2000" needlearn="0" script="support/dash.lua">
		<vocation name="Sorcerer"/>
		<vocation name="Druid"/>
		<vocation name="Paladin"/>
		<vocation name="Knight"/>
		<vocation name="Master Sorcerer"/>
		<vocation name="Elder Druid"/>
		<vocation name="Royal Paladin"/>
		<vocation name="Elite Knight"/>
	</instant>
 
Then i can't help you no longer, sorry! It works for me, for God, for each vocation i just tested every way.
Either your distro doesn't support something in that script or you installed it incorrectly!
When you are in-game does it poof/take your mana? Did you put the script to correct directory script="support/dash.lua">? No Errors at all?
 
Just tested this and it worked for me =\

It is probably too late by now but if you still haven't gotten this script to work you can try this one I just made. Imo its cooler looking anyway! :) hope it helps! (Basically the same function but it moves you instead of teleporting +3 squares)



Code:
local function dashForward(cid)
	if(not isPlayer(cid)) then return true end
	local nextPos = getPositionByDirection(getCreaturePosition(cid), getCreatureLookDirection(cid), 1)
	if(doTileQueryAdd(cid, nextPos, 0, false) == RETURNVALUE_NOERROR) then
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_ENERGYAREA)
		doTeleportThing(cid, nextPos, true)
	end
	return true
end

function onCastSpell(cid, var)
	for i = 0, 2 do -- Raise/Lower the second number to control how far they dash
		addEvent(dashForward, i*100, cid)
	end
	return true 
end
 
Back
Top