• 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] Select different effects with saving

henkas

Well-Known Member
Joined
Jul 8, 2015
Messages
993
Solutions
5
Reaction score
55
Hi
maybe someone have system that works like this. Lets say you create floors that looks like this
Untitled.png

So Red floor - has unique id lets say 1000,
Orange floor - id is 1001
So when you walk on these floor you you get teleported to x,y,z and you get custome MagicEffect which should be saved on database probably these effects should contain variables because later it would be nice to use it as spell like you type lets say "power up" and it applies that custome effect you selected from floor. Sorry if i'm asking to much.

Using TFS 1.2
Client 8.60
 
Solution
here the solution with utevo lux spell!
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)

local condition = Condition(CONDITION_LIGHT)
condition:setParameter(CONDITION_PARAM_LIGHT_LEVEL, 6)
condition:setParameter(CONDITION_PARAM_LIGHT_COLOR, 215)
condition:setParameter(CONDITION_PARAM_TICKS, (6 * 60 + 10) * 1000)
combat:setCondition(condition)

local storageLoadEffect = 66655
function onCastSpell(creature, variant)
    if combat:execute(creature, variant) then
        local loadEffect = math.max(1, creature:getStorageValue(storageLoadEffect))
        creature:getPosition():sendMagicEffect(loadEffect)
        return true
    end
    return false
end

---# Movement script
local effects = {
    [9000] =...
I dont get any error with previous script, Vulcan_ already said the solution for that error. Now the whole point is that this system is not showing effect
  1. local config = {
  2. [9000] = 10, -- [uniqueid] = magiceffect
  3. [9001] = 20
  4. }
All it does is just applies random effect, its pretty far way to working. Technically it should get effect with id 10 thats what it says in config but when you type aura you get random effect not a effect from local config

Bro it looks like I can't help you anymore :/
Know your OT and try doing it yourself. With the first steps I gave you it will be easy.
I recommend you to go and read about storage functions.
Cya. Good luck
 
Bro it looks like I can't help you anymore :/
Know your OT and try doing it yourself. With the first steps I gave you it will be easy.
I recommend you to go and read about storage functions.
Cya. Good luck
But thats why i made thread in requests section. Yea i looked around otland and found information about storages but its not enough that you could make script like this.
"This section should only be used for requests of, for an example scripts you are unable to create or find."
 
henkas test this! the spell is exori san
Code:
---# Spell script " divine missile example "
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 1.9) + 8
    local max = (level / 5) + (maglevel * 3) + 18
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local storageLoadEffect = 66655
function onCastSpell(creature, variant)
    local player = creature:getPlayer()
    if player then
        local loadEffect = math.max(1, player:getStorageValue(storageLoadEffect))
        if combat:execute(player, variant) then
            player:getPosition():sendDistanceEffect(player:getTarget():getPosition(), loadEffect) -- only spell with target
            player:getTarget():getPosition():sendMagicEffect(CONST_ME_HOLYDAMAGE) -- loadEffect if spell is without target
            return true
        end
    end
    return false
end


---# Movement script
local effects = {
    [9000] = CONST_ANI_SMALLHOLY,
    [9001] = CONST_ANI_ARROW
}

function onStepIn(creature, item)
    local player = creature:getPlayer()
    if not player then
        return true
    end

    if not item:hasAttribute(ITEM_ATTRIBUTE_UNIQUEID) then
        return true
    end

    local loadEffect = effects[item.uid]
    if loadEffect then
        player:setStorageValue(66655, loadEffect)
    end
    return true
end
 
Last edited:
henkas test this! the spell is exori san
Code:
---# Spell script " divine missile example "
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 1.9) + 8
    local max = (level / 5) + (maglevel * 3) + 18
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local storageLoadEffect = 66655
function onCastSpell(creature, variant)
    local player = creature:getPlayer()
    if player then
        local loadEffect = math.max(1, player:getStorageValue(storageLoadEffect))
        if combat:execute(player, variant) then
            player:getPosition():sendDistanceEffect(target:getPosition(), loadEffect) -- only spell with target
            target:getPosition():sendMagicEffect(CONST_ME_HOLYDAMAGE) -- loadEffect if spell is without target
            return true
        end
    end
    return false
end


---# Movement script
local effects = {
    [9000] = CONST_ANI_SMALLHOLY,
    [9001] = CONST_ANI_ARROW
}

function onStepIn(creature, item)
    local player = creature:getPlayer()
    if not player then
        return true
    end

    if not item:hasAttribute(ITEM_ATTRIBUTE_UNIQUEID) then
        return true
    end

    local loadEffect = effects[item.uid]
    if loadEffect then
        player:setStorageValue(66655, loadEffect)
        player:getPosition():sendMagicEffect(loadEffect)
    end
    return true
end
Untitled.png
 
Yes changed! relogout with F5 the page.
here:
Code:
---# Spell script " divine missile example "
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 1.9) + 8
    local max = (level / 5) + (maglevel * 3) + 18
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local storageLoadEffect = 66655
function onCastSpell(creature, variant)
    local player = creature:getPlayer()
    if player then
        local loadEffect = math.max(1, player:getStorageValue(storageLoadEffect))
        if combat:execute(player, variant) then
            player:getPosition():sendDistanceEffect(player:getTarget():getPosition(), loadEffect) -- only spell with target
            player:getTarget():getPosition():sendMagicEffect(CONST_ME_HOLYDAMAGE) -- loadEffect if spell is without target
            return true
        end
    end
    return false
end
 
the example is with spell divine missible, if you want other spell, send me the spell code best plix!
? Well as i mentioned before, this spell is just a simple light spell that makes around you everything lighter but the whole point is to send storaged effec so basically i dont need a spell that do something i just need to make that it sends effect from storage thats it. You choose a floor you get a effect you send that effect to spell, thats it. Because now is just a miss communication
 
here the solution with utevo lux spell!
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)

local condition = Condition(CONDITION_LIGHT)
condition:setParameter(CONDITION_PARAM_LIGHT_LEVEL, 6)
condition:setParameter(CONDITION_PARAM_LIGHT_COLOR, 215)
condition:setParameter(CONDITION_PARAM_TICKS, (6 * 60 + 10) * 1000)
combat:setCondition(condition)

local storageLoadEffect = 66655
function onCastSpell(creature, variant)
    if combat:execute(creature, variant) then
        local loadEffect = math.max(1, creature:getStorageValue(storageLoadEffect))
        creature:getPosition():sendMagicEffect(loadEffect)
        return true
    end
    return false
end

---# Movement script
local effects = {
    [9000] = CONST_ME_CAKE,
    [9001] = CONST_ME_ASSASSIN
}

function onStepIn(creature, item)

    if not creature:isPlayer() then
        return true
    end

    local loadEffect = effects[item.uid]
    if loadEffect then
        creature:setStorageValue(66655, loadEffect)
    end
    return true
end
 
Solution
Back
Top