This is my script, I've commented on which does what and if they work or not: (It is based on the paralyze rune script)
As the name suggest, when cast upon a target, the target should autoheal, lose haste, get a random outfit from the ones designated, get exhausted and muted so it can not heal, attack, use runes or items.
More or less just prevent target from doing anything at all, except moving unhasted.
If you decide to give me finished code. Please tell me why mine isn't working and why yours is, I would appreciate it since I am trying to improve in LUA.
Thanks!
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_POFF)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_HASTE) --Manashield takes priority so haste is not removed (Does not work)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_MANASHIELD)
local animals = {
276, -- cat
111, -- chicken
32, -- dog
212, -- flamingo
224, -- frog
60, -- pig
21, -- rat
14, -- sheep
197, -- tortoise
28 -- snake
}
local animal = animals[math.random(#animals)]
local condition1 = Condition(CONDITION_OUTFIT) --Outfit (Does not work)
condition1:setParameter(CONDITION_PARAM_TICKS, 10000)
condition1:setOutfit(animal)
combat:setCondition(condition1)
local condition2 = Condition(CONDITION_MUTED) --Muted
condition2:setParameter(CONDITION_PARAM_TICKS, 10000)
combat:setCondition(condition2)
local condition3 = Condition(CONDITION_EXHAUST_COMBAT) --Exhaust Offensive Runes (Does not work)
condition3:setParameter(CONDITION_PARAM_TICKS, 10000)
combat:setCondition(condition3)
local condition4 = Condition(CONDITION_EXHAUST_HEAL) --Exhaust Defensive Runes (Does not work)
condition4:setParameter(CONDITION_PARAM_TICKS, 10000)
combat:setCondition(condition4)
local condition5 = Condition(CONDITION_REGENERATION) --Regen
condition5:setParameter(CONDITION_PARAM_SUBID, 1)
condition5:setParameter(CONDITION_PARAM_TICKS, 10 * 1000)
condition5:setParameter(CONDITION_PARAM_HEALTHGAIN, 999999999)
condition5:setParameter(CONDITION_PARAM_HEALTHTICKS, 1000)
condition5:setParameter(CONDITION_PARAM_BUFF_SPELL, true)
combat:setCondition(condition5)
function onCastSpell(creature, variant, isHotkey)
if not combat:execute(creature, variant) then
return false
end
creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
return true
end
More or less just prevent target from doing anything at all, except moving unhasted.
If you decide to give me finished code. Please tell me why mine isn't working and why yours is, I would appreciate it since I am trying to improve in LUA.
Thanks!
Last edited: