• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Please help me with this spell!

mikkas70

Owner and Developer of omegaservers.org
Joined
Jan 6, 2009
Messages
42
Reaction score
8
I'd like to have this spell in my server:

Player uses spell and transforms into a certain looktype, it gives stats (example, 5 sword fighting) this is the easy part.

The hard part: The spell has exacly 100 seconds cooldown, and each time you try to use the spell when it is on cooldown it says: "Sorry, your power is only at x%"

x being the number of seconds that has past that past since you used your spell.

Example:
00:00:00 - Player uses spell.
00:00:30 - Player tries to use spell. message "I'm sorry, your power is only at 30%"


TFS:0.4
 
Last edited:
Code:
local storage = 53857

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, 10 * 1000)
setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, 5)
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setCombatCondition(combat, condition)

function onCastSpell(cid, var)
     if exhaustion.check(cid, storage) then
         doPlayerSendCancel(cid, "Sorry, your power is only at "..(100 - exhaustion.get(cid, storage)).."%")
         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         return false
     end
     local outfit = getCreatureOutfit(cid)
     outfit.lookType = 274
     doSetCreatureOutfit(cid, outfit, 10 * 1000)
     exhaustion.set(cid, storage, 100)
     doCombat(cid, combat, var)
     return true
end
 
Code:
local storage = 53857

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, 10 * 1000)
setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, 5)
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setCombatCondition(combat, condition)

function onCastSpell(cid, var)
     if exhaustion.check(cid, storage) then
         doPlayerSendCancel(cid, "Sorry, your power is only at "..(100 - exhaustion.get(cid, storage)).."%")
         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         return false
     end
     local outfit = getCreatureOutfit(cid)
     outfit.lookType = 274
     doSetCreatureOutfit(cid, outfit, 10 * 1000)
     exhaustion.set(cid, storage, 100)
     doCombat(cid, combat, var)
     return true
end


For some reason, the spell is not adding the desired effect, the cooldown is alright, it shows the message and everything, however, the sword fighting is noe being added and when you cast the spell, the effect goes in front of the character instead of his position.
 
Make sure you have this in spells.xml
Code:
selftarget="1"
Remove anything else related to target.

It worked perfectly indeed. Thank you so much.

Now one question, since it adds it into a storage value, can I create another spell that will check if the 100 seconds cooldown is gone to be able to cast the other "related" spell?

(sorry if this is a stupid question, still learning...)
 
Back
Top