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

Spell Storm of the Century

Scarlet Ayleid

Advanced OT User
Senator
Joined
Jul 7, 2007
Messages
4,049
Reaction score
238
Hey
I always try to make unique stuff, some may be useful, some may not, I am doing this mostly to think of new unique ideas, so here goes a new one :)
I am here to show my newest spell, which I have called "Storm of the Century"


Youtube Video:

"Okay, that was weird" is what you may be thinking, allow me to explain:

This spell has no fixed area, the spell's area is calculated during the casting of the spell, which means that every time a player uses this spell, a different area is affected, some tiles might even get hit more then once!

Code:
local config = {
    minAttacks = 100,                                    --Change the minimum number of attacks here
    maxAttacks = 300,                                    --Change the maximum number of attacks here
    expansionInterval = 300,                    --Change here how many ms it takes at max between expansions(it can be a random value between 0 and this value)
    spreadPercent = 20,                                --Change here the expansion %
    combatType = COMBAT_ENERGYDAMAGE,    --Change here the combat type
    effectType = { {90, 10}, {CONST_ME_ENERGYHIT, CONST_ME_BIGCLOUDS} }    --Change here the effect types, in the first table you set the chance of each effect to happen(must always sum to 100) and in the second table you set what effects appear
}


local function damageFormula(cid)
    local minDmg = (getPlayerLevel(cid) / -5 + getPlayerMagLevel(cid) * 1) * -5 + -5
    local maxDmg = (getPlayerLevel(cid) / -5 + getPlayerMagLevel(cid) * 1) * -5 + -12
    return {min = minDmg, max = maxDmg}
end


local function stormSpreads(cid, pos, remainingArea)
    if remainingArea[1] <= 0 or not isCreature(cid) then
        return false
    end
    remainingArea[1] = remainingArea[1] - 1
    local dmg = damageFormula(cid)
    --Random effect calculation
    local eff = config.effectType[2][1]
    local efc = math.random(1, 100)
    for i = 1, #config.effectType[1] do
        if(efc < config.effectType[1]) then
            eff = config.effectType[2]
            break
        else
            efc = efc - config.effectType[1]
        end
    end
    --/Random effect calculation
    doCombatAreaHealth(cid, config.combatType, pos, nil, dmg.min, dmg.max, eff)
    --Random area calculations
    local posArray = {
        [1] = {{x = pos.x, y = pos.y - 1, z = pos.z}, {2,4}}, --North
        [2] = {{x = pos.x - 1, y = pos.y, z = pos.z}, {1,3}}, --East
        [3] = {{x = pos.x, y = pos.y + 1, z = pos.z}, {2,4}}, --South
        [4] = {{x = pos.x + 1, y = pos.y, z = pos.z}, {1,3}}  --West
    }
    local i = math.random(1, 4)
    addEvent(stormSpreads, config.expansionInterval, cid, posArray[1], remainingArea, i)
    if math.random(1, 100) <= config.spreadPercent then
        if isSightClear(pos, posArray[posArray[2][1]][1], true) then
            addEvent(stormSpreads, math.random(0, config.expansionInterval), cid, posArray[posArray[2][1]][1], remainingArea, i)
        end
    end
    if math.random(1, 100) <= config.spreadPercent then
        if isSightClear(pos, posArray[posArray[2][2]][1], true) then
            addEvent(stormSpreads, math.random(0, config.expansionInterval), cid, posArray[posArray[2][2]][1], remainingArea, i)
        end
    end
    --/Random area calculations
    return true
end


function onCastSpell(cid, var)
    return stormSpreads(cid, getCreaturePosition(cid), {math.random(config.minAttacks, config.maxAttacks)})
end
This was tested in TFS 0.4, but it should work on TFS 0.3.7 also, not sure about TFS 0.2, if someone could try it and let me know if it works I'd be grateful :)
 
Last edited by a moderator:
First!~~

Anyway its pretty cool! Although would look sweet if you maybe randomized some storm clouds in as well just for show to make it look like a storm~ nice work anyway though, SUPER REP++++++++ xD!!
 
First!~~

Anyway its pretty cool! Although would look sweet if you maybe randomized some storm clouds in as well just for show to make it look like a storm~ nice work anyway though, SUPER REP++++++++ xD!!
That's pretty easy to do, I'll change it in a minute or 2
i suggest u to make the spell move with the caster i will be awesome :)
That's not really how the spell works, the spell is recursive, meaning that the spell itself knows where to go, unlike the "bad" animated spells that move around with the player
I thought this was gonna be about Hurricane Sandy xD
Looks like a cool spell, I love how it's randomized :D
That'd be bad taste for now xD
thanks :p
 
I thought this was gonna be about Hurricane Sandy xD
Looks like a cool spell, I love how it's randomized :D

i also thought the same thing

That's not really how the spell works, the spell is recursive, meaning that the spell itself knows where to go, unlike the "bad" animated spells that move around with the player

Ah ok, i was only saying
 
First!~~

Anyway its pretty cool! Although would look sweet if you maybe randomized some storm clouds in as well just for show to make it look like a storm~ nice work anyway though, SUPER REP++++++++ xD!!
Updated to support that :)
 
When I clicked on this thread I thought it's about the storm "Sandy" :/
 
Delicious spell.
Looks cool, had a similiar talkaction posted somewhere years ago. I was fascinated by the look of random spread.
 
thanks :)
I'll be releasing scripts every now and then whenever I get cool ideas, I'm almost done with a pretty cool and simple Trap System, which I'll upload later today or tomorrow depending on when I make the video :p
 
Uploaded video & code with the new changes, now it supports multiple effects to make a more awesome effect!

- - - Updated - - -

also showed an increase in number of attacks after the message(from 100..300 to 1000..3000)
 
Uploaded video & code with the new changes, now it supports multiple effects to make a more awesome effect!

- - - Updated - - -

also showed an increase in number of attacks after the message(from 100..300 to 1000..3000)

Over 9000? :3
 
It seems to be a cool thing! It maybe looks a bit odd when the rays start to deviate to a specific direction avoiding the others..

I don't know if I've explained myself well enough.. I mean: If for example you are in pos (0,0) and you want to hit someone who is in pos (-5,-5) but the rays go more likely around pos (5,5), you will not reach him and you will become angry :(
 
that's totally random and up to the spell, its the problem with random areas, they can either totally miss or hit the position you want 3 or 4 times
 
Back
Top