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

Action Magic Wall!(Including Countdown) 95% Easy Configurtion!

Printer

if Printer then print("LUA") end
Senator
Premium User
Joined
Dec 27, 2009
Messages
5,782
Solutions
31
Reaction score
2,284
Location
Sweden?
Hello Everyone!

Ok what does this script do?
When you cast magic wall it will appear a countdown over the magic wall when the magic wall get removed!
Its 95% easy configurable, maybe bit messy but i did my best :(

How did you come up with this idea?
I saw on a few servers, their magic wall got timer over it, so i searched on otland and didnt find any posts :O
So i thougt hmm... i going to make one for fun and train on scripting.

Please Feedback :(

This is my first script using config, i learned it by experimenting.

I love to make scripts easy to edit, so i made it more configurable and it took me time to come up with few ideas i added into the magic wall script :)

Enjoy!

First go to:
Data/Actions/actions.xml
Add this line:
Code:
<action itemid="2293" event="script" value="magicwall.lua" allowfaruse="1" blockwalls="1"/>

Now go into the scripts in the action folder:
Make a new lua and rename it "magicwall"

Open the lua and add paste this code:

Lua:
----------------------------------THIS CODE WAS SCRIPTED BY: Cyko------------------------------------
 
local 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
 
local function doSendAnimatedText2(pos, value, color, player)
    if(not tonumber(value))then
        return error("arg #2 in doSendAnimatedText is not a number")
    end
 
    if(isPlayer(player))then
        doPlayerSendTextMessage(player, MESSAGE_EXPERIENCE, "", value, color, pos)
    else
        for _, v in ipairs(getSpectators(pos, 7, 5, true)) do
            if(isPlayer(v))then
                doPlayerSendTextMessage(v, MESSAGE_EXPERIENCE, "", value, color, pos)
            end
        end
    end
end
 
local version_check = 03 --if you use 0.3.7, then write 037! or if you use 0.3, write 03!
 
local random_txt_onsay = true -- When casting a wall, should the player cast random catch phrases?
 
local cyko = {
	timer = 15, -- How long will the magic wall stay
	cooldown = 1, -- How long to cast another one
    	words = {"I LOVE MAGIC WALL!","HAHA YOU CANT GET ME","BIATCH","BOOM"}, -- Here can you add or edit the catch phrases!
	txt = "END", -- Text when it removes
    	color_on_timer = TEXTCOLOR_BLUE, -- Color on countdown
    	empty_storage = 1000 -- Please set a unused storage
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    	if(getPlayerStorageValue(cid, cyko.empty_storage) > os.time()) then
		return (doPlayerSendCancel(cid, "You are exhausted."))
	end                  
	if (getTileInfo(getThingPos(cid)).protection or getTileInfo(toPosition).protection) then
		return (doPlayerSendCancel(cid, "You can't cast magic wall while your inside protection zone."))
	end
	local function removemw()
		if(getTileItemById(toPosition, 1497).uid > 0) then
			if (version_check == 03) then
				return (doSendAnimatedText(toPosition,cyko.txt, TEXTCOLOR_RED) and doSendMagicEffect(toPosition, CONST_ME_ENERGYHIT) and doRemoveItem(getTileItemById(toPosition, 1497).uid))
			else
				return (doSendMagicEffect(toPosition, CONST_ME_ENERGYHIT) and doRemoveItem(getTileItemById(toPosition, 1497).uid))
			end
		end
	end 
	for mw = 1, cyko.timer do
		local o = cyko.timer - mw
		if (version_check == 03) then
			addEvent(doSendAnimatedText, mw * 1000, toPosition, o > 0 and tostring(o), cyko.color_on_timer)
		else
			addEvent(doSendAnimatedText2, mw * 1000, toPosition, o > 0 and tostring(o), cyko.color_on_timer)
		end
	end 
	if (isWalkable(toPosition, false, false, true, true, true)) then 
		doCreateItem(1497, toPosition)
		setPlayerStorageValue(cid, cyko.storage, os.time() + cyko.cooldown)
		addEvent(removemw, cyko.timer * 1000)
		doSendMagicEffect(toPosition, CONST_ME_ENERGYAREA) 
		if (random_txt_onsay == true) then
			doCreatureSay(cid, cyko.words[math.random(#cyko.words)], TALKTYPE_ORANGE_1)
		end
	else
		doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHROOM)
	end
	return true
end

Enjoy!
 
Last edited:
magic wall time? you can made for spells...

spells > scripts > support

magic wall rune.lua
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1497)
function onCastSpell(cid, var)
function MagicWallTime(pos, delay)
doSendAnimatedText(pos, delay, 145)
if delay ~= 1 then addEvent(MagicWallTime, 1000, pos, delay -1) end
end
local pos,duration = variantToPosition(var),20
MagicWallTime(pos,duration)
return doCombat(cid, combat, var)
end

local pos,duration = variantToPosition(var),20

o 20 how long will the magic wall stay, see in items.xml '-'

fECQD.png
 
I made it at actions because i dont want to hear. Uhh magic wall doesnt remove etc...

Also i wanted just to make a bit advance script, to train :(
 
Agree with otswe. I can easily post 10 theards about magic wall dont remove bla.bla!

@Otswe

The script is very nice and much configurable - maybe bit to much xD

Rep!
 
I love to play with codes :) -- Wanna know why?

For few months back i didnt know how to make any codes, just copy and paste :)

Now its fun to make and play.

Lua:
local otswe = {
love = {"Scarlet Ayleid"},
effect = CONST_ME_HEARTS
}

function inLove(cid)
if(isInArray(otswe.love, getCreatureName(cid))) then
doCreatureSay(cid, "LOVE YA <3")
doSendMagicEffect(getCreaturePosition(cid, otswe.effect)
return true
end
end
 
Will it work with latest distros? if i remember right doSendAnimated~~ didn't work after 8.6 versions.
 
it may work, but only with numbers, so should be ok for counter. Check in 'lua functions', there should be script that make it work on new distros.
 
Try this one:

Lua:
----------------------------------THIS CODE WAS SCRIPTED BY: OTSWE------------------------------------
 
local random_txt_onsay = true -- When casting a wall, should the player cast random catch phrases?
 
local otswe = {
	timer = 15, -- How long will the magic wall stay
	cooldown = 1, -- How long to cast another one
    words = {"I LOVE MAGIC WALL!","HAHA YOU CANT GET ME","BIATCH","BOOM"}, -- Here can you add or edit the catch phrases!
	txt = "END", -- Text when it removes
    color_on_timer = TEXTCOLOR_BLUE, -- Color on countdown
    empty_storage = 1000 -- Please set a unused storage
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(getPlayerStorageValue(cid, otswe.empty_storage) > os.time()) then
		doPlayerSendCancel(cid, "You are exhausted.")
		return true
		end                  
	   if getTileInfo(getPlayerPosition(cid)).protection or  getTileInfo(getThingPos(cid)).optional then
              doPlayerSendCancel(cid, "You can't cast magic wall while your inside protection zone or no-pvp zones.")
                 else	
		local function removemw()
			local magicwall = getTileItemById(toPosition, 1497).uid
			if(magicwall > 0) then
				doRemoveItem(magicwall)
				doSendAnimatedText(toPosition,otswe.txt, TEXTCOLOR_RED)
				doSendMagicEffect(toPosition, CONST_ME_ENERGYHIT)
			end
			return true
		end 
		for mw = 1, otswe.timer do
		local o = otswe.timer - mw
			addEvent(doSendAnimatedText, mw * 1000, toPosition, o > 0 and tostring(o), otswe.color_on_timer)
		end 
		doCreateItem(1497, toPosition)
		setPlayerStorageValue(cid, otswe.storage, os.time() + otswe.cooldown)
		addEvent(removemw, otswe.timer * 1000)
		doSendMagicEffect(toPosition, CONST_ME_ENERGYAREA) 
	end
	if random_txt_onsay == true then
	doCreatureSay(cid, otswe.words[math.random(#otswe.words)], TALKTYPE_ORANGE_1)
	end
	return true
end
 
Last edited:
Do not work..
if you are in pz and use it wont work but if you are outside and use in pz or house it spawns wall

(and sometimes the walls dont go away at all)
 
try now! edited post
 
Can you explain better. You can shoot on pz zones when you are outside?
 
Ill check on this tomorrow, im bussy today. If someone can help him feel free to post. The probelm is that if you stay outside protection zone. You can shoot the wall into pz zones and also into houses.

Also he want to prevent them to shoot on no-pvp tiles to.
 
Back
Top