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

Shinra Tensei (area)

Strack

Member
Joined
May 15, 2009
Messages
199
Reaction score
14
Well, that's a version I made of Cybershot's shinra tensei, but that runs on area

it's a v.1 of spell, but runs perfectly, (v.1 means its not fully done -> no have effects, only repel 1sql, only repel players, and no damage is done)

you need function-> isWalkable (thanks for that function), if you dont have add it on lib/050-function.lua:
Lua:
function isWalkable(pos, creature, proj, pz)-- by Nord
        if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
        if getTopCreature(pos).uid > 0 and creature then return false end
        if getTileInfo(pos).protection and pz then return false, true end
        local n = not proj and 3 or 2
        for i = 0, 255 do
                pos.stackpos = i
                local tile = getTileThingByPos(pos)
                if tile.itemid ~= 0 and not isCreature(tile.uid) then
                        if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                                return false
                        end
                end
        end
        return true
end

and now, create an script on spells and add:
Lua:
function getDistance(cid)
    local tile = {{20, 1},{40, 2},{60, 3},{80, 4},{100, 5}}
    table.sort(tile, function(a, b) return a[1] > b[1] end)
    for _, t in ipairs(tile) do    
        if(getPlayerLevel(cid) >= t[1]) then
            return t[2]
        end
    end
    return tile[1][2]
end
 
function onCastSpell(cid, var)
    local dist = getDistance(cid)
    local areaPosition = {
        {x=getCreaturePosition(cid).x-dist, y=getCreaturePosition(cid).y-dist, z=getCreaturePosition(cid).z, stackpos = 255},
        {x=getCreaturePosition(cid).x+dist, y=getCreaturePosition(cid).y+dist, z=getCreaturePosition(cid).z, stackpos = 255}
    }
    local players = getPlayersOnline()
    local dmg = math.random(10, getPlayerLevel(cid)+10)
 
    for i= 1, dist do
        for _, pid in ipairs(players) do
            if isInRange(getCreaturePosition(pid), areaPosition[1], areaPosition[2]) then
                local tp = getCreaturePosition(pid)
                    if (tp.x < getCreaturePosition(cid).x) and (tp.y < getCreaturePosition(cid).y) then
                        tp.x = tp.x-1
                        tp.y = tp.y-1
                        if isWalkable(tp, true) and not getTileInfo(tp).protection then
                            doSendMagicEffect(getCreaturePosition(pid), 34)
                            doTeleportThing(pid, tp, true)
                            doTargetCombatHealth(cid, pid, COMBAT_PHYSICALDAMAGE, -dmg, -dmg, CONST_ME_BLOCKHIT)
                            doSendMagicEffect(getCreaturePosition(pid), 34)
                        else    
                            doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)
                        end
                    elseif (tp.x < getCreaturePosition(cid).x) and (tp.y > getCreaturePosition(cid).y) then
                        tp.x = tp.x-1
                        tp.y = tp.y+1
                        if isWalkable(tp, true) and not getTileInfo(tp).protection then
                            doSendMagicEffect(getCreaturePosition(pid), 34)
                            doTeleportThing(pid, tp, true)
                            doTargetCombatHealth(cid, pid, COMBAT_PHYSICALDAMAGE, -dmg, -dmg, CONST_ME_BLOCKHIT)
                            doSendMagicEffect(getCreaturePosition(pid), 34)
                        else
                            doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)
                        end
                    elseif (tp.x < getCreaturePosition(cid).x) and (tp.y == getCreaturePosition(cid).y) then
                        tp.x = tp.x-1
                        if isWalkable(tp, true) and not getTileInfo(tp).protection then
                            doSendMagicEffect(getCreaturePosition(pid), 34)
                            doTeleportThing(pid, tp, true)
                            doTargetCombatHealth(cid, pid, COMBAT_PHYSICALDAMAGE, -dmg, -dmg, CONST_ME_BLOCKHIT)
                            doSendMagicEffect(getCreaturePosition(pid), 34)
                        else
                            doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)
                        end
                    elseif (tp.x > getCreaturePosition(cid).x) and (tp.y < getCreaturePosition(cid).y) then
                        tp.x = tp.x+1 
                        tp.y = tp.y-1
                        if isWalkable(tp, true) and not getTileInfo(tp).protection then
                            doSendMagicEffect(getCreaturePosition(pid), 34)
                            doTeleportThing(pid, tp, true)
                            doTargetCombatHealth(cid, pid, COMBAT_PHYSICALDAMAGE, -dmg, -dmg, CONST_ME_BLOCKHIT)
                            doSendMagicEffect(getCreaturePosition(pid), 34)
                        else    
                            doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)
                        end    
                    elseif (tp.x > getCreaturePosition(cid).x) and (tp.y > getCreaturePosition(cid).y) then
                        tp.x = tp.x+1
                        tp.y = tp.y+1
                        if isWalkable(tp, true) and not getTileInfo(tp).protection then
                            doSendMagicEffect(getCreaturePosition(pid), 34)
                            doTeleportThing(pid, tp, true)
                            doTargetCombatHealth(cid, pid, COMBAT_PHYSICALDAMAGE, -dmg, -dmg, CONST_ME_BLOCKHIT)
                            doSendMagicEffect(getCreaturePosition(pid), 34)
                        else
                            doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)
                        end
                    elseif (tp.x > getCreaturePosition(cid).x) and (tp.y == getCreaturePosition(cid).y) then
                        tp.x = tp.x+1
                        if isWalkable(tp, true) and not getTileInfo(tp).protection then
                            doSendMagicEffect(getCreaturePosition(pid), 34)
                            doTeleportThing(pid, tp, true)
                            doTargetCombatHealth(cid, pid, COMBAT_PHYSICALDAMAGE, -dmg, -dmg, CONST_ME_BLOCKHIT)
                            doSendMagicEffect(getCreaturePosition(pid), 34)
                        else
                            doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)
                        end
                    elseif (tp.x == getCreaturePosition(cid).x) and (tp.y < getCreaturePosition(cid).y) then
                        tp.y = tp.y-1
                        if isWalkable(tp, true) and not getTileInfo(tp).protection then
                            doSendMagicEffect(getCreaturePosition(pid), 34)
                            doTeleportThing(pid, tp, true)
                            doTargetCombatHealth(cid, pid, COMBAT_PHYSICALDAMAGE, -dmg, -dmg, CONST_ME_BLOCKHIT)
                            doSendMagicEffect(getCreaturePosition(pid), 34)
                        else
                            doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)
                        end
                    elseif (tp.x == getCreaturePosition(cid).x) and (tp.y > getCreaturePosition(cid).y) then
                        tp.y = tp.y+1
                        if isWalkable(tp, true) and not getTileInfo(tp).protection then
                            doSendMagicEffect(getCreaturePosition(pid), 34)
                            doTeleportThing(pid, tp, true)
                            doTargetCombatHealth(cid, pid, COMBAT_PHYSICALDAMAGE, -dmg, -dmg, CONST_ME_BLOCKHIT)
                            doSendMagicEffect(getCreaturePosition(pid), 34)
                        else
                            doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)
                        end
                    end
                end
            end
        end
    return true
end

dmg = damage dealt to target (more sql repels = more damage) Ex.: if damage = 25, and I repel 4 sql, then total dmg = 4x25 = 100
times = how many sql it repels, I put it equal to repelling area, configure it as u want

Hope you enjoy it! ^^
 
Last edited:
Lua:
[01/09/2010 13:04:32] [Error - Spell Interface] 
[01/09/2010 13:04:32] data/spells/scripts/shinra big.lua:onCastSpell
[01/09/2010 13:04:32] Description: 
[01/09/2010 13:04:32] data/lib/032-position.lua:2: attempt to index global 'position' (a nil value)
[01/09/2010 13:04:32] stack traceback:
[01/09/2010 13:04:32] 	data/lib/032-position.lua:2: in function 'isInRange'
[01/09/2010 13:04:32] 	data/spells/scripts/shinra big.lua:23: in function <data/spells/scripts/shinra big.lua:1>
I get this error when I try to use the spell
 
What this spell do ?
If you have higher level then area is bigger or what ?
 
@luigi
what server u use, i've tested it on tfs 0.3.6pl1 and runs perfectly, seems you dont have function isInRange

@Fresh
well that's the first version of spell, but yes, the more lvl, higher area you have, but it only repels players 1sql
 
I use tfs 0.3.6pl1, can you teach me how to add the function isInRange?
your tfs HAS that function
Code:
    //lua-made functions
    doPlayerGiveItem(cid, itemid, amount, subType)
    doPlayerTakeItem(cid, itemid, amount)
    doPlayerBuyItem(cid, itemid, count, cost, charges)
    doPlayerBuyItemContainer(cid, containerid, itemid, count, cost, charges)
    doPlayerSellItem(cid, itemid, count, cost)
    doPlayerWithdrawMoney(cid, money)
    doPlayerDepositMoney(cid, money)
    comparePos(pos, posEx)
[COLOR=red]    isInRange(pos, fromPos, toPos)[/COLOR]
the problem isn't the missing function, it's just a small thing you need to modify at lib/position that I saw in other thread
 
my server has the function isInRange but not working with the same error the guy up there, what do I do?
 
go to lib/ and open 032-position.lua, your function isInRange is like this?
Lua:
function isInRange(position, fromPosition, toPosition)
	return (position.x >= fromPosition.x and position.y >= fromPosition.y and position.z >= fromPosition.z and position.x <= toPosition.x and position.y <= toPosition.y and position.z <= toPosition.z)
end
 
if your isInRange is equal to mine, try to recopy the spell' script, it should run (it does for me), else I dont know what's the problem :S
 
The script was set correctly, the error persists

[01/09/2010 20:08:01] [Error - Spell Interface]
[01/09/2010 20:08:02] data / spells / scripts / support / Shinra tensei.lua: onCastSpell
[01/09/2010 20:08:02] Description:
[01/09/2010 20:08:02] data / spells / scripts / support / Shinra tensei.lua: 23: attempt to call local 'areaPosition' (a table value)
[01/09/2010 20:08:02] stack traceback:
[01/09/2010 20:08:02] data / spells / scripts / support / Shinra tensei.lua: 23: in function <data/spells/scripts/support/shinra tensei.lua:1>
 
on lib/0.32-position.lua, do you have that function?
Lua:
function getArea(position, x, y)
	local t = {}
	for i = (position.x - x), (position.x + x) do
		for j = (position.y - y), (position.y + y) do
			table.insert(t, {x = i, y = j, z = position.z})
		end
	end

	return t
end
 
now the spell have no errors but when I say the words nothinf happen, nothing in console or anywhere
 
humm... this v. of spell only runs with players not with npc or monsters
 
HAHAHA COOL
~~SHINRA TENSEI~~
[video=youtube;BkMCpZQXuLA]http://www.youtube.com/watch?v=BkMCpZQXuLA[/video]

REP++
 
the spell works? I'm trying but when a player say the words nothing happen, no errors, nothing plz help
 
the spell works for me but no words appear.
there is no return true at the end of the script. im adding it there now, ill let u guys know if it makes the words show up.
 
Back
Top