• 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 Apocalypse Spells

Singed

New Member
Joined
Apr 20, 2009
Messages
112
Solutions
1
Reaction score
2
So i have a problem.

I modified the Apocalypse spell that comes with T.F.S. i'm running 0.3.5 and if the person that cast the spell dies before the spell is over it creates an infinite loop of errors to the point where you have to kill the server and start it over.

Any ideas how to fix this?

I'll appreciate the help, and reputation will be giving
for those nice enough to help.
 
ofc theres something wrong it wouldnt do what it did if there wasnt a thing wrong:blink:



No need to be an ass lol

and here is the spell
PHP:
local combat = createCombatObject()

arr = {
{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},
}

local area = createCombatArea(arr)
setCombatArea(combat, area)

local function spellCallback(param)
	if param.count > 0 or math.random(0, 1) == 1 then
		doSendMagicEffect(param.pos, CONST_ME_FIREATTACK)
		doAreaCombatHealth(param.cid, COMBAT_HOLYDAMAGE, param.pos, 0, -5000, -5000, CONST_ME_STONES)
	end

	if(param.count < 5) then
		param.count = param.count + 1
		addEvent(spellCallback, math.random(1000, 4000), param)
	end
end

function onTargetTile(cid, pos)
	local param = {}
	param.cid = cid
	param.pos = pos
	param.count = 0
	spellCallback(param)
end

setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end
 
Code:
local combat = createCombatObject()

local arr = {
	{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},
}
setCombatArea(combat, createCombatArea(arr))

local function spellCallback(param)
	if param.count > 0 or math.random(0, 1) == 1 then
		doSendMagicEffect(param.pos, CONST_ME_FIREATTACK)
		doAreaCombatHealth(param.cid, COMBAT_HOLYDAMAGE, param.pos, 0, -5000, -5000, CONST_ME_STONES)
	end

	if(param.count < 5) then
		param.count = param.count + 1
		addEvent(spellCallback, math.random(1000, 4000), param)
	end
end

function onTargetTile(cid, pos)
	if isPlayer(cid) then
		local param = {cid=cid, pos=pos, count=0}
		spellCallback(param)
	end
end

setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end
 
i can do that, and just be able to re do it, or i can
try and learn and understand why he did it.
 
Either way, the spell isn't fixed, it sstill ccrash the
server if you die before it finishes casting
 
Back
Top