if player:getStorageValue(xxxxx) == 1 then
player:setExhaustion(xxxxx, 5)
else
player:setExhaustion(xxxxx, 10)
end
i literally told you the solution
what are you needing exhaust in sources for
dont tell me "the code is 1.2" that i posted cause its not hard to downgrade it
Those scripts creates a separate exhaust system, not alter the existing one?
I think he wants to create a rune that works by reducing all spell cooldowns by 25% or something. We would need a way to fetch spells.xml cooldown attribute, and temporarily reduce them while the rune effect duration is active.
How would you suggest doing that in LUA?
@Hernest Perhaps look up ConditionSpellCooldown in condition.cpp (Not sure if the name is identical on TFS 0.4)
local exhaust = 10
if player:getStorageValue(xxxxx) == 1 then
exhaust = exhaust * 0.75
end
player:setExhaustion(xxxxx, exhaust)
Unless you mean reducing an existing exhaust condition on a player when the rune is used?LUA:local exhaust = 10 if player:getStorageValue(xxxxx) == 1 then exhaust = exhaust * 0.75 end player:setExhaustion(xxxxx, exhaust)
I believe both methods should work, I just don't understand why this lua method would not work.
- edit, minor changes in sentence structure.
<instant group="attack" spellid="155" name="Ultimate Energy Strike" words="exori max vis" lvl="100" mana="100" prem="1" range="3" casterTargetOrDirection="1" blockwalls="1"
cooldown="30000" groupcooldown="4000"
needlearn="0" script="attack/ultimate_energy_strike.lua">
<vocation name="Sorcerer" />
<vocation name="Master Sorcerer" />
</instant>
<instant group="attack" spellid="23" name="Great Energy Beam" words="exevo gran vis lux" lvl="29" mana="110" direction="1"
cooldown="6000" groupcooldown="2000"
needlearn="0" script="attack/great_energy_beam.lua">
<vocation name="Sorcerer" />
<vocation name="Master Sorcerer" />
</instant>
-- This is a mockup function, and does not actually exist.
function onCastAnySpell(cid, spellid, lvl, cooldown, groupcooldown, mana)
if (isPlayer(cid)) then
local player = Player(cid)
-- If player have 25% reduced cooldown
if player:getStorageValue(xxxxx) == 1 then
cooldown = cooldown * 0.75
groupcooldown = groupcooldown * 0.75
end
-- If player have 25% lower mana cost
if player:getStorageValue(yyyy) == 1 then
mana = mana * 0.75
end
-- If player have Witch Hat (10570) and spell id is 9 (Summon Creature / utevo res)
local item = Item(player:getSlotItem(SLOT_HELMET))
if (item.getId() == 10570 AND spellid == 9) then
-- 20% less summon creature spell cost, where the mana cost varies depending on monster
mana = mana * 0.8
end
else
local creature = Creature(cid)
-- Do something cool with monster spells?
end
return cid, spellid, lvl, cooldown, groupcooldown, mana
end