Jaed Le Raep
★Gaeming★
- Joined
- Sep 3, 2007
- Messages
- 1,296
- Reaction score
- 441
Could someone please optimize my Stone Herb script that turns it into an item with a 15 second cooldown but cures poison? It's important to keep the exhaust identity the same as it shares cooldown with other herbs.
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST_HEAL)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000)
local antidote = createCombatObject()
setCombatParam(antidote, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(antidote, COMBAT_PARAM_AGGRESSIVE, 0)
setCombatParam(antidote, COMBAT_PARAM_DISPEL, CONDITION_POISON)
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == false then
doAddCondition(cid, exhaust)
doRemoveItem(item.uid, 1)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
return doCombat(cid, antidote, numberToVariant(cid))
else
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
doPlayerSendCancel(cid, "You cannot eat another herb yet.")
return true
end
end
Last edited: