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

Solved Upgrade spell using storage TFS 1.2

knighters god

Active Member
Joined
Feb 14, 2009
Messages
166
Solutions
1
Reaction score
40
Server version: TFS 1.2

I have a vocation box wich gives knights a storage of
Code:
setPlayerStorageValue(cid, 17301, 3)
.
And with this storage I want to upgrade the spell blood rage. From a percentage of 125 --> 145.

I have tried doing this which I tought would work. But sadly no ;/
Code:
local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_TICKS, 10000)
-- DAMAGE BELOW ME
if getPlayerStorageValue(cid, 17301) == 3 then
    condition:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 145) -- I want this when storage 17301 == 3
elseif getPlayerStorageValue(cid, 17301) ~= 3 then
    condition:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 125) -- I want this when storage 17301 ~= 3
end
-- DAMAGE ABOVE ME
condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 0)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true)

local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setCondition(condition)

function onCastSpell(creature, var)
    return combat:execute(creature, var)
end

Help would be appreciated!
 
If I get it right it should be something like this.
Code:
local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_TICKS, 10000)
condition:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 125)
condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 0)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true)

local condition2 = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_TICKS, 10000)
condition:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 145)
condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 0)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true)

local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setCondition(condition)

local combat = Combat2()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setCondition(condition2)

function onCastSpell(creature, var)
if getPlayerStorageValue(cid, 17301) ~= 3 then
      return combat:execute(creature, var)
elseif getPlayerStorageValue(cid, 17301 == 3 then
     return combat2:execute(creature, var)
end
end
 
If I get it right it should be something like this.
Code:
local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_TICKS, 10000)
condition:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 125)
condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 0)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true)

local condition2 = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_TICKS, 10000)
condition:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 145)
condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 0)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true)

local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setCondition(condition)

local combat = Combat2()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setCondition(condition2)

function onCastSpell(creature, var)
if getPlayerStorageValue(cid, 17301) ~= 3 then
      return combat:execute(creature, var)
elseif getPlayerStorageValue(cid, 17301 == 3 then
     return combat2:execute(creature, var)
end
end
There is no cid, only creature. Use creature:getStorageValue(17301).
local combat = Combat2() this is wrong should "local combat2 = Combat()"

Missing parentheses in getPlayerStorageValue(cid, 17301) == 3 then (but shouldn't be getplayerstoragevalue anyway)
 
There is no cid, only creature. Use creature:getStorageValue(17301).
local combat = Combat2() this is wrong should "local combat2 = Combat()"

Missing parentheses in getPlayerStorageValue(cid, 17301) == 3 then (but shouldn't be getplayerstoragevalue anyway)
I switched some things up as I got from you.

Code:
local combat2 = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setCondition(condition2)

function onCastSpell(creature, var)
if creature:getStorageValue(17301) ~= 3 then
      return combat:execute(creature, var)
elseif creature:getStorageValue(17301) == 3 then
     return combat2:execute(creature, var)
end
end

I have 2 knights where one has the storage and one who does not.
The one who has the storage gets no buff what so ever.
The one who does not have the storage gets combat2 buff instead of combat.
 
I switched some things up as I got from you.

Code:
local combat2 = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setCondition(condition2)

function onCastSpell(creature, var)
if creature:getStorageValue(17301) ~= 3 then
      return combat:execute(creature, var)
elseif creature:getStorageValue(17301) == 3 then
     return combat2:execute(creature, var)
end
end

I have 2 knights where one has the storage and one who does not.
The one who has the storage gets no buff what so ever.
The one who does not have the storage gets combat2 buff instead of combat.
Change:
Code:
local condition2 = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_TICKS, 10000)
condition:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 145)
condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 0)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true)

To:
Code:
local condition2 = Condition(CONDITION_ATTRIBUTES)
condition2:setParameter(CONDITION_PARAM_TICKS, 10000)
condition2:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 145)
condition2:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 0)
condition2:setParameter(CONDITION_PARAM_BUFF_SPELL, true)

Change:
Code:
local combat2 = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setCondition(condition2)

To:
Code:
local combat2 = Combat()
combat2:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat2:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat2:setCondition(condition2)
 
Change:
Code:
local condition2 = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_TICKS, 10000)
condition:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 145)
condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 0)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true)

To:
Code:
local condition2 = Condition(CONDITION_ATTRIBUTES)
condition2:setParameter(CONDITION_PARAM_TICKS, 10000)
condition2:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 145)
condition2:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 0)
condition2:setParameter(CONDITION_PARAM_BUFF_SPELL, true)

Change:
Code:
local combat2 = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setCondition(condition2)

To:
Code:
local combat2 = Combat()
combat2:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat2:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat2:setCondition(condition2)

It works perfectly now. Thank you!
I see exactly what I did wrong. And I feel stupid :p
But thank you so much!


Streamside
And also. Thank you for trying to make me understand!
^^
 
Back
Top