• 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 adding isWalkable function into a spell

luigilc

Lua Learner
Joined
Mar 24, 2010
Messages
863
Reaction score
37
Location
A music box
How can I check the function isWalkable:
LUA:
function isWalkable(pos, creature, proj, pz)-- by Nord
	if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
	if getTopCreature(pos).uid > 0 and creature then return false end
	if getTileInfo(pos).protection and pz then return false, true end
	local n = not proj and 3 or 2
	for i = 0, 255 do
		pos.stackpos = i
		local tile = getTileThingByPos(pos)
		if tile.itemid ~= 0 and not isCreature(tile.uid) then
			if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
				return false
			end
		end
	end
	return true
end
into this script:
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)

function onGetFormulaValues(cid, level, maglevel)
	min = ((level + maglevel) * getPlayerMana(cid) / getPlayerMaxMana(cid)) * 2.9
	max = ((level + maglevel) * getPlayerMana(cid) / getPlayerMaxMana(cid)) * 3.2
	return reduceSpellDamage(cid, min, max)
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
	if(math.random(1, 2) == 1) then
		time = -1000
		for i = 1, 5 do
			addEvent(doMoveCreature, time + 1000, variantToNumber(var), math.random(0, 3))
			time = time + 1000
		end
		doCombat(cid, combat, var)
	else
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
		doCreatureSay(cid, "The spell cast has failed.", TALKTYPE_ORANGE_1)
	end
	return true
end
cuz rght now, it is sending monsters inside the temple and beyond the map borders
 
Back
Top