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

A sequence generator

Build it?

  • Yes!

    Votes: 4 100.0%
  • No!

    Votes: 0 0.0%
  • I dont like animations :(

    Votes: 0 0.0%

  • Total voters
    4

bayview

Banned User
Joined
Jan 25, 2018
Messages
611
Solutions
25
Reaction score
324
Some time ago I wrote an animated spell which is similar to one I seen on Deathzot called The Circle of Healing.

This spell took me some time to make because I had to find the best possible way to create an animation of effects that surrounded the player in a circle.

This was my 1st attempt at the spell

And then this was my second attempt at the spell where i cleaned it up a bit and removed the inner animation and made some configuration adjustments.

I think normally most of us use spell creator to at least create the effects of a spell and then maybe even re-write everything in whatever distribution we are using.

The animation is really what takes up most of our time when making spells or special effects. So I made a sequence generator which is pretty primitive right now and is built on a completely different framework but its base language is lua.

The sequence generator allows a developer to make simple animation sequences. Here is a video of this in action.

That table can then be given to this script.
Lua:
local grid =
{
    --   1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, -- 1
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, -- 2
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, -- 3
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, -- 4
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, -- 5
        {0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0}, -- 6
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, -- 7
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, -- 8
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, -- 9
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, -- 10
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, -- 11
}

function deepcopy(orig)
    local orig_type = type(orig)
    local copy
    if orig_type == 'table' then
        copy = {}
        for orig_key, orig_value in next, orig, nil do
            copy[deepcopy(orig_key)] = deepcopy(orig_value)
        end
        setmetatable(copy, deepcopy(getmetatable(orig)))
    else -- number, string, boolean, etc
        copy = orig
    end
    return copy
end

function setSequence(t, d)
    local x = {}
    for n = 1, #d do
        x[n] = deepcopy(t)
    end
    for i = 1, #x do
        x[i][d[i][1]][d[i][2]] = 1
    end
    return x
end

Which can then be called by this script
Lua:
local areaSequence = setSequence(grid, animation)
local combat = {}

for x = 1, #areaSequence do
    combat[x] = Combat()
    combat[x]:setParameter(COMBAT_PARAM_TYPE, COMBAT_NONE)
    combat[x]:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
    combat[x]:setArea(createCombatArea(areaSequence[x]))
end

local int = 1000
local xcute, xtime = 10, 500

function onCastSpell(creature, variant, isHotkey)
    for f = 1, xcute do
        addEvent(function()
            for n = 1, #areaSequence do
                addEvent(function(cid, var, i)
                    local c = Creature(cid)
                    if c then
                        if combat[i] then
                            combat[i]:execute(c, var)
                        end
                    end
                end, n * int, creature:getId(), variant, n
                )
            end
        end, f * xtime)
    end
    return true
end
Which can produce a similar effect to the circle of healing.

I was thinking that this test code & its tool could very well be the grounds for a new type of spell animation creator.

Since the base language is lua integrating specific methods or writing a library which would be compatible with all versions of the TFS framework...

What are your thoughts?
 
Back
Top