• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Help with spell

Equalizer

New Member
Joined
May 21, 2009
Messages
9
Reaction score
0
Yo all,

Can someone help me with this spell?

I am having a great spell script but I need to change something, but I am not able to do it myself.

This is the spell:
Code:
local arr = {}
 
arr[1] = { 
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, 
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, 
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0}, 
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, 
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, 
{1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1}, 
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, 
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, 
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0}, 
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, 
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, 
} 
 
arr[2] = {
	{0, 0, 0, 0, 1, 0, 0, 0, 0},
	{0, 0, 0, 1, 0, 1, 0, 0, 0},
	{0, 0, 1, 0, 0, 0, 1, 0, 0},
	{0, 1, 0, 0, 0, 0, 0, 1, 0},
	{1, 0, 0, 0, 2, 0, 0, 0, 1},
	{0, 1, 0, 0, 0, 0, 0, 1, 0},
	{0, 0, 1, 0, 0, 0, 1, 0, 0},
	{0, 0, 0, 1, 0, 1, 0, 0, 0},
	{0, 0, 0, 0, 1, 0, 0, 0, 0}
}
 
arr[3] = {
	{0, 0, 0, 1, 0, 0, 0},
	{0, 0, 1, 0, 1, 0, 0},
	{0, 1, 0, 0, 0, 1, 0},
	{1, 0, 0, 2, 0, 0, 1},
	{0, 1, 0, 0, 0, 1, 0},
	{0, 0, 1, 0, 1, 0, 0},
	{0, 0, 0, 1, 0, 0, 0}
}
 
arr[4] = {
	{0, 0, 1, 0, 0},
	{0, 1, 0, 1, 0},
	{1, 0, 2, 0, 1},
	{0, 1, 0, 1, 0},
	{0, 0, 1, 0, 0}
}
 
arr[5] = {
	{0, 1, 0},
	{1, 2, 1},
	{0, 1, 0}
}
 
arr[6] = {
	{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
	{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
	{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
	{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
	{1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1},
	{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
	{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
	{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
	{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}
}
 
local formulas = {
	[6] = {COMBAT_FORMULA_LEVELMAGIC, -11.0, -1900, -10.2, -2000}
}
 
local function onTileComb(cid, pos)
	if(isCreature(cid) == TRUE) then
		doSendDistanceShoot(pos, getThingPos(cid), 3)
	end
end
 
local combats = {}
for i, v in pairs(arr) do
	combats[i] = createCombatObject()
	setCombatParam(combats[i], COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
	if(i < #arr) then
		_G["callback" .. i] = onTileComb --Mwahaha
		setCombatCallback(combats[i], CALLBACK_PARAM_TARGETTILE, "callback" .. i)
	else
		setCombatParam(combats[i], COMBAT_PARAM_EFFECT, 6)
	end
 
	if(formulas[i] ~= nil) then
		setCombatFormula(combats[i], unpack(formulas[i]))
	end
 
	setCombatArea(combats[i], createCombatArea(v))
end
 
local isCharging = {}
local function eventFunc(p)
	local cid = p.cid
	local n = p.n or 1
 
	if(isCreature(cid) == FALSE) then
		isCharging[cid] = false
		return LUA_ERROR
	end
 
	if(isCharging[cid] and n == 1) then
		if(isPlayer(cid) == TRUE) then
			doPlayerSendCancel(cid, "You are already charging it.")
		end
		return LUA_ERROR
	end
 
	isCharging[cid] = (n < #combats)
 
	local pos = getThingPos(cid)
	if(getTilePzInfo(pos) ~= FALSE) then
		isCharging[cid] = false
		return LUA_ERROR
	end
 
	local var = positionToVariant(pos)
	if(doCombat(cid, combats[n], var) == LUA_ERROR) then
		isCharging[cid] = false
		return LUA_ERROR
	end
 
	if(isCharging[cid]) then
		addEvent(eventFunc, 500-n*100, {cid=cid, n=n+1})
	end
	return LUA_NO_ERROR
end
 
function onCastSpell(cid, var)
	return eventFunc({cid=cid})
end

My problem is; the combat formula is now
Code:
{COMBAT_FORMULA_LEVELMAGIC, -11.0, -1900, -10.2, -2000}

But I want to change it to a formula like;
Code:
function onGetFormulaValues(cid, level, maglevel)
	min = -(1200 + maglevel * 10)
	max = -(1200 + maglevel * 15)

	return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

But when I replace it, the script doesn't work.

Please help me :) rep+

Greets,
Equalizer
 
Back
Top