Aleada
Unknown Member
- Joined
- Mar 14, 2013
- Messages
- 231
- Reaction score
- 7
Heya everyone, I've made a "Charge" spell like World of Warcraft and it works fine but sometimes I get random errors when the monster dies since the server can't find it when trying to send a magic effect or something... and does anyone have any ideas on how to make it better?
And here's the errors when the monster dies:
Anyways, thank you everyone!
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_STUN)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EXPLOSION)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)
function onGetFormulaValues(cid, level, skill, attack, factor)
local skillTotal, levelTotal = skill + attack * 3, level / 5 * 3
return -(skillTotal / 5 + levelTotal), -(skillTotal / 4 + levelTotal)
end
t1 = 1000
t2 = 2000
function effect(cid)
local targ = getCreatureTarget(cid)
doSendMagicEffect(getThingPos(targ), CONST_ME_SLEEP)
end
local paralyze = createConditionObject(CONDITION_PARALYZE)
setConditionParam(paralyze, CONDITION_PARAM_TICKS, 2000)
local muted = createConditionObject(CONDITION_MUTED)
setConditionParam(muted, CONDITION_PARAM_TICKS, 2000)
local pacified = createConditionObject(CONDITION_PACIFIED)
setConditionParam(pacified, CONDITION_PARAM_TICKS, 2000)
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 2000)
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
local target = getCreatureTarget(cid)
local speed = getCreatureSpeed(target)
local selfspeed = getCreatureSpeed(target)
local pos = getThingPos(target)
doChangeSpeed(cid, 5000)
doSteerCreature(cid, pos)
doChangeSpeed(target, -speed)
doAddCondition(target, paralyze)
doAddCondition(target, muted)
doAddCondition(target, pacified)
doAddCondition(target, exhaust)
addEvent(doChangeSpeed, 2000, target, speed)
addEvent(doChangeSpeed, 1000, cid, -5000)
addEvent(effect,t1,cid)
addEvent(effect,t2,cid)
return doCombat(cid, combat, var)
end
And here's the errors when the monster dies:
Code:
[31/7/2013 11:15:33] [Error - Spell Interface]
[31/7/2013 11:15:33] In a timer event called from:
[31/7/2013 11:15:33] data/spells/scripts/Warrior/attack/Charge.lua:onCastSpell
[31/7/2013 11:15:33] Description:
[31/7/2013 11:15:33] (LuaInterface::luaDoChangeSpeed) Creature not found
[31/7/2013 11:15:33] [Error - Spell Interface]
[31/7/2013 11:15:33] In a timer event called from:
[31/7/2013 11:15:33] data/spells/scripts/Warrior/attack/Charge.lua:onCastSpell
[31/7/2013 11:15:33] Description:
[31/7/2013 11:15:33] (LuaInterface::luaGetThingPosition) Thing not found
Anyways, thank you everyone!
Last edited: