Heroid
Active Member
- Joined
- Mar 7, 2011
- Messages
- 332
- Solutions
- 11
- Reaction score
- 34
I need some help making a spell that will toggle Magic Shield on/off.
This is what I've got so far but it's really messy and I don't really know what I'm doing no more because I've been trying to get it to work by doing all kind of different things.
TFS 1.2
This is what I've got so far but it's really messy and I don't really know what I'm doing no more because I've been trying to get it to work by doing all kind of different things.
TFS 1.2
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
local condition = Condition(CONDITION_MANASHIELD, CONDITIONID_DEFAULT)
condition:setParameter(CONDITION_PARAM_TICKS, 9999)
condition:setParameter(CONDITION_PARAM_SUBID, 103)
combat:setCondition(condition)
function onCastSpell(creature, variant)
local player = creature:getPlayer()
local pos = player:getPosition()
if not player:getCondition(CONDITION_MANASHIELD, CONDITIONID_DEFAULT, 103) then
player:addCondition(condition)
pos:sendMagicEffect(13)
player:say("[ON]", TALKTYPE_MONSTER_SAY)
elseif player:getCondition(CONDITION_MANASHIELD, CONDITIONID_DEFAULT, 103) then
player:removeCondition(CONDITION_MANASHIELD, CONDITIONID_DEFAULT, 103)
pos:sendMagicEffect(14)
player:say("[OFF]", TALKTYPE_MONSTER_SAY)
end
return true
end
Last edited: