potinho
Advanced OT User
Hello guys, Im creating a monster who will explode, generating a huge damage and killing itself. Im searching for codes but found nothing. I've got this one but dont work (monster dont do damage, just die and spell animation dont appear). Can u guys please help me to fix or create a new one?
LUA:
local combat_arr = {
[1] = AREA_CROSS1X1,
[2] = AREA_CIRCLE2X2,
[3] = AREA_CIRCLE3X3
}
local dmin, dmax = 3000, 5000
local combat = {} -- keep empty
local monsters = true -- true or false
local suicide = true -- true or false
function onGetFormulaValues()
return - math.random(dmin, dmax)
end
for i = 1, 3 do
combat[i] = createCombatObject()
setCombatParam(combat[i], COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat[i], COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
setCombatCallback(combat[i], CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
area = createCombatArea(combat_arr[i])
setCombatArea(combat[i], area)
end
local function newCombat(uid, combat, var)
if isPlayer(uid) then
if not isPlayer(getThingFromPos(var.pos)) and not monsters then
dmin, dmax = 0, 0
end
var.pos = getThingPos(uid)
doCombat(uid, combat, var)
end
return true
end
function onCastSpell(cid, var)
newCombat(cid, combat[1], var)
addEvent(500, newCombat, cid, combat[2], var)
addEvent(1000, newCombat, cid, combat[3], var)
if suicide then
addEvent(10001, doCreatureAddHealth, cid, -getCreatureHealth(cid))
end
return true
end