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

TFS 0.X How to set setPlayerStorageValue and doPlayerSetExtraAttackSpeed temporally?

samandriel

Active Member
Joined
Oct 19, 2016
Messages
242
Solutions
1
Reaction score
46
How to set setPlayerStorageValue and doPlayerSetExtraAttackSpeed temporally?

I want to set 2 stats temporally like utito tempo.lua
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10000)
setConditionParam(condition, CONDITION_PARAM_SKILL_MELEEPERCENT, 135)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELDPERCENT, -100)
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setCombatCondition(combat, condition)

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end

1) +atk speed (Lua Function - doPlayerSetExtraAttackSpeed(cid, speed) (https://otland.net/threads/doplayersetextraattackspeed-cid-speed.58945/))
doPlayerSetExtraAttackSpeed(cid, 400) -- atk speed = 500-400=100

to remove extra atk speed:
doPlayerSetExtraAttackSpeed(cid, 0) -- back to normal

2) set storage
setPlayerStorageValue(cid, 100)

How to set it as a buff, temporally like utito tempo, utani hur, utamo tempo...
After some time it stops and if player logout or something this not save?
 
Solution
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10000)
setConditionParam(condition, CONDITION_PARAM_SUBID, 69)
setConditionParam(condition, CONDITION_PARAM_SKILL_MELEEPERCENT, 135)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELDPERCENT, -100)
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setCombatCondition(combat, condition)

local function checking(cid)
    if isPlayer(cid) then
        if not getCreatureCondition(cid, CONDITION_ATTRIBUTES, 69) then
            return...
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10000)
setConditionParam(condition, CONDITION_PARAM_SUBID, 69)
setConditionParam(condition, CONDITION_PARAM_SKILL_MELEEPERCENT, 135)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELDPERCENT, -100)
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setCombatCondition(combat, condition)

local function checking(cid)
    if isPlayer(cid) then
        if not getCreatureCondition(cid, CONDITION_ATTRIBUTES, 69) then
            return doPlayerSetExtraAttackSpeed(cid, 0) and setPlayerStorageValue(cid, 100, -1) and false
        end
        addEvent(checking, 500, cid)
    end
end

function onCastSpell(cid, var)
    doCombat(cid, combat, var)
    checking(cid)
    doPlayerSetExtraAttackSpeed(cid, 400)
    setPlayerStorageValue(cid, 100, 1)
    return true
end

and somewhere in function onLogin
Code:
if not getCreatureCondition(cid, CONDITION_ATTRIBUTES, 69) then
    doPlayerSetExtraAttackSpeed(cid, 0)
    setPlayerStorageValue(cid, 100, -1)
end
 
Solution
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10000)
setConditionParam(condition, CONDITION_PARAM_SUBID, 69)
setConditionParam(condition, CONDITION_PARAM_SKILL_MELEEPERCENT, 135)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELDPERCENT, -100)
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setCombatCondition(combat, condition)

local function checking(cid)
    if isPlayer(cid) then
        if not getCreatureCondition(cid, CONDITION_ATTRIBUTES, 69) then
            return doPlayerSetExtraAttackSpeed(cid, 0) and setPlayerStorageValue(cid, 100, -1) and false
        end
        addEvent(checking, 500, cid)
    end
end

function onCastSpell(cid, var)
    doCombat(cid, combat, var)
    checking(cid)
    doPlayerSetExtraAttackSpeed(cid, 400)
    setPlayerStorageValue(cid, 100, 1)
    return true
end

and somewhere in function onLogin
Code:
if not getCreatureCondition(cid, CONDITION_ATTRIBUTES, 69) then
    doPlayerSetExtraAttackSpeed(cid, 0)
    setPlayerStorageValue(cid, 100, -1)
end

I love you
 
Use other subid for each spell ~~

setConditionParam(condition, CONDITION_PARAM_SUBID, 69)

getCreatureCondition(cid, CONDITION_ATTRIBUTES, 69)
 
Back
Top