• 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 (Rune) - How to add more 'blocked areas' ?

picachu

Member
Joined
Dec 2, 2007
Messages
970
Reaction score
11
Here's the script:

Lua:
local combat = createCombatObject()setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1492)
 
 
function onCastSpell(cid, var)
	local from, to = {x=, y=, z=}, {x=, y=, z=}
	if not(isInRange(getCreaturePosition(cid), from, to)) then
		return doCombat(cid, combat, var)
	else
		doPlayerSendCancel(cid, "You cannot use this spell in this area.")
		doSendMagicEffect(getCreaturePosition(cid), 2)
	end
end

How can I add more "bloked areas" so players cant throw this rune on more places?
ty
 
add this under function onCastSpell(cid, var)
Lua:
if isInArea(getCreaturePosition(cid), {x=x, y=y, z=z}, {x=x, y=y, z=z}) then
doPlayerSendCancel(cid, "You cannot use this spell in this area.")
doSendMagicEffect(getPlayerPosition(cid), 2)
return true
end
 
Code:
if not(isInRange(getCreaturePosition(cid), {x=, y=, z=}, {x=, y=, z=}) [B][COLOR="#FF0000"]and isInRange(getCreaturePosition(cid), {x=, y=, z=}, {x=, y=, z=})[/COLOR][/B]) then

if you need even more areas, it's simpler to do this:
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1492)

local t = {
	{{x=1, y=1, z=1}, {x=2, y=2, z=2}},
	{{x=1, y=1, z=1}, {x=2, y=2, z=2}},
	{{x=1, y=1, z=1}, {x=2, y=2, z=2}}
}

function onCastSpell(cid, var)
	local pos = getThingPos(cid)
	for i = 1, #t do
		if isInRange(pos, unpack(t[i])) then
			doPlayerSendCancel(cid, "You cannot use this spell in this area.")
			doSendMagicEffect(pos, CONST_ME_POFF)
			return false
		end
	end

	return doCombat(cid, combat, var)
end
 
Last edited:
Back
Top