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

Spell [10.76][TFS 1.1] Old MW sprite + timer

zbizu

Legendary OT User
Joined
Nov 22, 2010
Messages
3,323
Solutions
26
Reaction score
2,694
Location
Poland
this script will change your mw to old sprite and will work same way
in0KLGT.jpg


movements.xml
Code:
<movevent event="StepIn" itemid="8753" script="mwstep.lua"/>

mwstep.lua
Code:
function onStepIn(creature, item, position, fromPosition)
	removeMw(creature:getPosition(), 8753, 1027)
	return true
end

\data\spells\scripts\support\magic wall rune.lua
replace file content to this:
Code:
local id = 8753
local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
combat:setParameter(COMBAT_PARAM_CREATEITEM, id)

function tile_timer(id, pos, delay, color)
	if getTileItemById(pos, id).uid == 0 then
		return true
	end
	
	if delay ~= 1 then
		addEvent(tile_timer, 1000, id, pos, delay - 1, color)
	end
   
	local people = Game.getSpectators(pos, 7, 7, 5, 5, false, true)
	if not people then
		return true
	end
	
	for i = 1, #people do
		people[i]:sendTextMessage(MESSAGE_EXPERIENCE, "Magic wall will disappear in " .. delay .. " second" .. (delay > 1 and "s" or "") .. ".", pos, delay, color)
	end
end

function removeMw(pos, mw, wall)
	local tile = Tile(pos)
	mw = tile:getItemById(mw)
	wall = tile:getItemById(wall)
	if mw then mw:remove() end
	if wall then wall:remove() end
end

function onCastSpell(creature, var, isHotkey)
	local c = combat:execute(creature, var)
	if c then
		local pos = variantToPosition(var)
		local wall = Game.createItem(1027, 1, pos)
		addEvent(removeMw, 20000, pos, id, wall:getId())
		tile_timer(id, pos, 20, TEXTCOLOR_LIGHTBLUE)
	end
	return c
end

optional: timer on wild growth
bPomnnH.jpg

\data\spells\scripts\support\wild growth rune.lua
replace file content to this:
Code:
local id = ITEM_WILDGROWTH
local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH)
combat:setParameter(COMBAT_PARAM_CREATEITEM, id)

function onCastSpell(creature, var, isHotkey)
	local c = combat:execute(creature, var)
	if c then
		local pos = variantToPosition(var)
		addEvent(removeMw, 40000, pos, id)
		tile_timer(id, pos, 40, TEXTCOLOR_LIGHTGREEN)
	end
	return c
end
 
function removeMw(pos, mw, wall) local tile = Tile(pos) mw = tile:getItemById(mw) wall = tile:getItemById(wall) if mw then mw:remove() end if wall then wall:remove() end end
MWs can be destroyed now (onstep thing)?
 
MWs can be destroyed now (onstep thing)?

The movement script destroys the magic wall if a player walks on top of it (ie. going up a staircase where a magic wall is palced)
This is the intended effect for magic walls.

Red
 
@zbizu
do it still block shoots like the original mw? I saw a thread of someone that did it (changed mw id) and was complaining about that
 
and runes? and throwing items? :p if yes then AWESOME!! :D

It works the same as the old magic wall. Zbizu's script places item ID "1027" under the current "Shadow Nexus" sprite and it emulates the old magic wall perfectly.
The clever part of the script is the movement script that removes the wall if you step on it.

To put it another way: "Yes and yes."
Red
 
The Shadow Nexus sprites create a "wall" tile on the minimap.
I can't currently come up with a feasible solution to this.

Red
 
It's probably due to brick wall's id. Just use another(I don't recommend normal mw, it's a bit larger)
 
It's probably due to brick wall's id. Just use another(I don't recommend normal mw, it's a bit larger)

The brick wall ID was my first thought.
It's due to both the brick wall ID and the shadow nexus ID.

Red
 
I'm trying to use the movement on 1.0 tfs and have this error
Code:
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/mwstep.lua:eek:nStepIn
data/movements/scripts/mwstep.lua:2: attempt to index local 'creature' (a number value)
stack traceback:
[C]: in function '__index'
data/movements/scripts/mwstep.lua:2: in function <data/movements/scripts/mwstep.lua:1>

Anyone can help me? Thanks in advance!
 
Why did you add removeTimer :p? Just decay it.
 
Ah Okay, can i suggest something :p?

I would done something like this:

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_MAGICWALL)

local time = 20

local function countDown(cid, position, time)
    local player = Player(cid)
    if not player or time == 0 then
        return
    end
      
    player:say(time, TALKTYPE_MONSTER_SAY, false, 0, position)
    addEvent(countDown, 1000, cid, position, time - 1)
end

function onCastSpell(creature, variant, isHotkey)
    countDown(creature.uid, Variant.getPosition(variant), 20)
    return combat:execute(creature, variant)
end
 
Last edited:
If you use the old mwall type, mwall isen't getting removed by the movement script.
// Using TFS 1.1/1.2

* Basically add all EXCEPT for the movement part described in the first post.

Changed in const.h
Code:
ITEM_MAGICWALL = 1497,
to
Code:
  ITEM_MAGICWALL = 8753,
 
Is it possible to send the delay message without displaying in server log ?
 
Back
Top