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

how to make mw cant be used in some areas??

kimokimo

Kimo
Joined
Jan 25, 2011
Messages
821
Solutions
6
Reaction score
156
GitHub
karimadnan
i want script for my zombie event becuase players use magic wall to block themself beside walls can anyone can anyone tell me how to make magic wall cant be used in the zombie?
 
local pos = variantToPosition(var)
if pos.x >= topleftx and pos.x <= botrightx and pos.y >= toplefty and pos.y <= botrighty and pos.z == zofarea then
return true
end
 
http://otland.net/f16/how-disable-magicwall-specifik-area-rep-117010/#post1152811

this should be halfway legit
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

function onCastSpell(cid, var)
	local pos = variantToPosition(var)
	if getTileInfo(getThingPos(cid)).protection then
		return not doPlayerSendDefaultCancel(cid, RETURNVALUE_ACTIONNOTPERMITTEDINPROTECTIONZONE)
	else
		local s = getTileInfo(pos)
		if s.protection then
			return not doPlayerSendDefaultCancel(cid, RETURNVALUE_ACTIONNOTPERMITTEDINPROTECTIONZONE)
		elseif s.nopvp then
			return not doPlayerSendCancel(cid, 'You can\'t use it here.')
		end
	end

	local v = getTileItemByType(pos, ITEM_TYPE_MAGICFIELD).uid
	if v ~= 0 then
		doRemoveItem(v)
	end

	v = doCreateItemEx(1497)
	if doTileAddItemEx(pos, v) == 1 and getTileItemByType(pos, ITEM_TYPE_MAGICFIELD).uid ~= 0 then
		doDecayItem(v)
		return doCombat(cid, combat, var)
	else
		return not doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHROOM)
	end
end
 
thanks cyko but i found better one with using frompos,topos but the problem is the magic wall dont disapear here is the script


local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1497)
local ctfArena = {
frompos = {x=763, y=2228, z=9},
topos = {x=805, y=2267, z=9},
}
local warArena = {
frompos = {x=638, y=711, z=7},
topos = {x=751, y=780, z=7},
}
local satanQuest = {
frompos = {x=487, y=1782, z=5},
topos = {x=501, y=1792, z=5},
}
function onCastSpell(cid, var)
if not isInArea(getPlayerPosition(cid), ctfArena.frompos, ctfArena.topos) and not isInArea(getPlayerPosition(cid), warArena.frompos, warArena.topos) and not isInArea(getPlayerPosition(cid), satanQuest.frompos, satanQuest.topos) then
return doCombat(cid, combat, var)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You may not use this rune here.")
end
end
 
Last edited:
Same place where your magic wall script is, in spells. You can also look at the function if you are not sure, you can see at function onCastSpell that it's a spell. For other functions, you can also look in the folders to see which function types they use.
 
Back
Top