Kod :
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, FALSE)
local condition = createConditionObject(CONDITION_LIGHT)
setConditionParam(condition, CONDITION_PARAM_LIGHT_LEVEL, 10)
function onBeginCast(cid, var)
if getPlayerMagLevel > 40 then
setConditionParam(condition, CONDITION_PARAM_LIGHT_COLOR, 195) -- red
elseif getPlayerMagLevel(cid) <= 40 then
setConditionParam(condition, CONDITION_PARAM_LIGHT_COLOR, 176) -- green
elseif getPlayerMagLevel(cid) <= 20 then
setConditionParam(condition, CONDITION_PARAM_LIGHT_COLOR, 267) -- yellow
elseif getPlayerMagLevel(cid) <= 6 then
setConditionParam(condition, CONDITION_PARAM_LIGHT_COLOR, 215) -- white
else
setConditionParam(condition, CONDITION_PARAM_LIGHT+COLOR, 215) -- white again
end
end
setConditionParam(condition, CONDITION_PARAM_TICKS, (6*60)*1000) --time
setCombatCondition(combat, condition)
function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end
Kod :
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, FALSE)
function onBeginCast(cid, var)
if getPlayerMagLevel > 40 then
local color = 195 -- red?
elseif getPlayerMagLevel(cid) <= 40 then
local color = 176 -- green?
elseif getPlayerMagLevel(cid) <= 20 then
local color = 167 -- yellow
elseif getPlayerMagLevel(cid) <= 6 then
local color = 215 -- white
end
end
local condition = createConditionObject(CONDITION_LIGHT)
setConditionParam(condition, CONDITION_PARAM_LIGHT_LEVEL, 6)
setConditionParam(condition, CONDITION_PARAM_LIGHT_COLOR, color)
setConditionParam(condition, CONDITION_PARAM_TICKS, ((6*60)+10)*1000) --3 minutes and 10 seconds(time in ms)
setCombatCondition(combat, condition)
function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end
Silnik Avesta 0.6.1, kompilacja z Jul 31 2010.
Zakładki