• 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] Not allowing to use runes on a certain area - $5 USD

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,764
Solutions
1
Reaction score
227
Location
Chile, Santiago
Hi, I need an script that does not allow you to use runes on a certain area.

PM me with the script and your e-mail address to pay you.
 
I think it's easier to do by editing a single file, spells.cpp, than all rune scripts.
[cpp]bool Spell::playerRuneSpellCheck(Player* player, const Position& toPos)
{
if(!playerSpellCheck(player))
return false;

if(toPos.x == 0xFFFF)
return true;

const Position& playerPos = player->getPosition();
if(playerPos.x >= 100 && playerPos.x <= 200 && playerPos.y >= 150 && playerPos.y <= 250 && playerPos.z == 7)
player->sendCancel("You cannot use runes here.");
g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
return false;
}[/cpp]
 
I need a lua edit...

PhoOwned tried this:

LUA:
local fromPosition = {x = 32009, y = 32158, z = 7}
local toPosition = {x = 32119, y = 32208, z = 7}

function onCast(cid, target)
	return not (target and isInRange(getThingPosition(cid), fromPosition, toPosition) and not isCreature(target))
end

but doesn't work (creature event type="cast").
 
will that even work?

LUA:
local fromPosition = {x = 32009, y = 32158, z = 7}
local toPosition = {x = 32119, y = 32208, z = 7}
 
function onCast(cid, target)
    if isInArea(getThingPos(cid), fromPosition, toPosition) then
        return false, doPlayerSendCancel(cid, "You're not allowed to use any rune here.")
    end
    return true
end
 
CyberM it doesn't work, people can still use magic walls here...
Maybe to make a fix on the wild growth rune and magic wall rune script that check if player is in area, if it is so, it should cancel the rune and give an error message.
 
Well I got the base of the scrips you and I gathered there thought about putting the right rune to block only a certain area, it worked good :)

This script for my magic wall rune.lua

Code:
local combat = createCombatObject() 
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) 
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1497) 
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false) 
 
function onCastSpell(cid, var) 
 local fromPosition = {x = 32368, y = 31873, z = 7} -- top left cornor of the playground
 local toPosition = {x = 32394, y = 31895, z = 7	} -- bottom right cornor of the playground
  if isInArea(getThingPosition(cid), fromPosition, toPosition) then
          return false, doPlayerSendCancel(cid, "You're not allowed to use any rune here.")
 end
        return doCombat(cid, combat, var) 
end


And now Wild Growth Rune.lua
Code:
local combat = createCombatObject() 
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH) 
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1499)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false) 
 
function onCastSpell(cid, var) 
 local fromPosition = {x = 32368, y = 31873, z = 7} -- top left cornor of the playground
 local toPosition = {x = 32394, y = 31895, z = 7	} -- bottom right cornor of the playground
  if isInArea(getThingPosition(cid), fromPosition, toPosition) then
          return false, doPlayerSendCancel(cid, "You're not allowed to use any rune here.")
 end

        return doCombat(cid, combat, var) 
end
 
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIRE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1.2, 0, -2.0, 0)

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

local lock = {
	Position(1145, 815, 7), -- Nw Pos.
	Position(1180, 850, 7) -- Se Pos.
}

function onCastSpell(cid, var)
	if isInRange(getCreaturePosition(cid), lock[1], lock[2]) then
		doPlayerSendCancel(cid, 'You can\'t use this spell here.')
		return false
	end
	return doCombat(cid, combat, var)
end

100% credits to ChojraK
Red
 
Back
Top