• 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!

Spell optimizaton

PhoOwned

^_^
Joined
Nov 11, 2010
Messages
375
Reaction score
66
Got any idea how to make this script shorter and faster?
PHP:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 7, 7, 70.4, 75.8, 40, 70)

local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setAttackFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, 7, 7, 70.4, 75.8, 40, 70)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setAttackFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, 7, 7, 70.4, 75.8, 40, 70)

function onCastSpell(cid, var)
	local pos = getCreaturePosition(cid)
	for tx = pos.x-4, pos.x+4 do
		for ty = pos.y-4, pos.y+4 do
			doSendMagicEffect({x=tx,y=ty,z=pos.z}, CONST_ME_ENERGYHIT)
		end
	end
	for i, target in pairs(getSpectators(pos, 4, 4, false)) do
		if(not isPlayer(target)) then
			doCombat(cid, combat, numberToVariant(target))
			doCombat(cid, combat1, numberToVariant(target))
			doCombat(cid, combat2, numberToVariant(target))
		end
	end
	return true
end
It's spell to attack monsters only on pvp server.
 
Back
Top