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

MoveEvent Map marks

slaw

Software Developer
Joined
Aug 27, 2007
Messages
3,657
Solutions
125
Reaction score
1,103
Location
Germany
GitHub
slawkens
When player step on tile, he receive map marks :D

mapmarksexample.jpg


Works with any distro, including OTServ, TFS 0.2, TFS 0.3 and TFS 0.4!

~~ INSTALLATION ~~

Create new file:
movements/scripts/mapmarks.lua
Code:
local config = {
	storage = 9432,
	version = 1, -- Increase this value after adding new marks, so player can step again and receive new map marks
	marks = {
		{mark = 5, pos = {x = 166, y = 439, z = 7}, desc = "Main City Temple"},
		{mark = 7, pos = {x = 300, y = 200, z = 7}, desc = "NPC with tools!"},
		{mark = 1, pos = {x = 666, y = 666, z = 6}}
	}
}

local f_addMark = doPlayerAddMapMark
if(not f_addMark) then f_addMark = doAddMapMark end

function onStepIn(cid, item, position, fromPosition)
	if(isPlayer(cid) ~= TRUE or getPlayerStorageValue(cid, config.storage) == config.version) then
		return
	end

	for _, m  in pairs(config.marks) do
		f_addMark(cid, m.pos, m.mark, m.desc ~= nil and m.desc or "")
	end
	setPlayerStorageValue(cid, config.storage, config.version)
	return TRUE
end

Add new line to:
movements/movements.xml

* TFS 0.2
Code:
<movevent event="StepIn" actionid="YOUR_ACTION_ID" script="mapmarks.lua"/>

* TFS 0.3+
Code:
<movevent type="StepIn" actionid="YOUR_ACTION_ID" event="script" value="mapmarks.lua"/>

UPDATE:
Available as mod: http://tfs-mods.googlecode.com/svn/trunk/map-marks.xml

List of map marks in game: (by orzeleagle)
mapmarks.png
 
Last edited:
This is what I have in movements/scripts

Code:
local config = {
	storage = 9432,
	version = 1, -- Increase this value after adding new marks, so player can step again and receive new map marks
	marks = {
		{mark = MAPMARK_TEMPLE,		pos = {x = 95, y = 117, z = 7},	desc = "Main City Temple"},
		{mark = MAPMARK_SHOVEL,		pos = {x = 116, y = 151, z = 7},	desc = "Toolshop"},
		{mark = MAPMARK_DEPOT,	pos = {x = 49, y = 143, z = 7},        desc = "Depot"},
	}
}

local f_addMark = doPlayerAddMapMark
if(not f_addMark) then f_addMark = doAddMapMark end

function onStepIn(cid, item, position, fromPosition)
	if(isPlayer(cid) ~= TRUE or getPlayerStorageValue(cid, config.storage) == config.version) then
		return
	end

	for _, m  in pairs(t) do
		f_addMark(cid, m.pos, m.mark, m.desc ~= nil and m.desc or "")
	end
	setPlayerStorageValue(cid, config.storage, config.version)
	return TRUE
end

And this is the error :

Code:
[20/06/2009 19:25:00] Lua Script Error: [MoveEvents Interface] 
[20/06/2009 19:25:00] data/movements/scripts/mapmarks.lua:onStepIn

[20/06/2009 19:25:00] data/movements/scripts/mapmarks.lua:19: bad argument #1 to 'pairs' (table expected, got nil)
[20/06/2009 19:25:00] stack traceback:
[20/06/2009 19:25:00] 	[C]: in function 'pairs'
[20/06/2009 19:25:00] 	data/movements/scripts/mapmarks.lua:19: in function <data/movements/scripts/mapmarks.lua:14>

What's wrong :eek:?
 
This is what I have in movements/scripts

Code:
local config = {
	storage = 9432,
	version = 1, -- Increase this value after adding new marks, so player can step again and receive new map marks
	marks = {
		{mark = MAPMARK_TEMPLE,		pos = {x = 95, y = 117, z = 7},	desc = "Main City Temple"},
		{mark = MAPMARK_SHOVEL,		pos = {x = 116, y = 151, z = 7},	desc = "Toolshop"},
		{mark = MAPMARK_DEPOT,	pos = {x = 49, y = 143, z = 7},        desc = "Depot"},
	}
}

local f_addMark = doPlayerAddMapMark
if(not f_addMark) then f_addMark = doAddMapMark end

function onStepIn(cid, item, position, fromPosition)
	if(isPlayer(cid) ~= TRUE or getPlayerStorageValue(cid, config.storage) == config.version) then
		return
	end

	for _, m  in pairs(t) do
		f_addMark(cid, m.pos, m.mark, m.desc ~= nil and m.desc or "")
	end
	setPlayerStorageValue(cid, config.storage, config.version)
	return TRUE
end

And this is the error :

Code:
[20/06/2009 19:25:00] Lua Script Error: [MoveEvents Interface] 
[20/06/2009 19:25:00] data/movements/scripts/mapmarks.lua:onStepIn

[20/06/2009 19:25:00] data/movements/scripts/mapmarks.lua:19: bad argument #1 to 'pairs' (table expected, got nil)
[20/06/2009 19:25:00] stack traceback:
[20/06/2009 19:25:00] 	[C]: in function 'pairs'
[20/06/2009 19:25:00] 	data/movements/scripts/mapmarks.lua:19: in function <data/movements/scripts/mapmarks.lua:14>

What's wrong :eek:?

Oh, fixed! :)
 
Ah yes, i remeber Old Gred had this for his server but it was it added a Mark where the player was when you exiva'd him buts its sorta lame cause theres no function to remove the Map Mark. But anyways nice job on your script
 
maybe add blue arrow?

What you mean? You can modify/add more yourself.

For 0.2 users, you need to use numbers from 0-19 as mark, because 0.2 don't have constant defined (You can copy it from 0.3 constant.lua file - MAPMARK_*)
Anyway, edited first post (Changed mark to numbers)
 
Really good, I'll be surely using this :)
rep from me since you really deserve it for this :D

kind regards, Evil Hero
 
What you mean? You can modify/add more yourself.

For 0.2 users, you need to use numbers from 0-19 as mark, because 0.2 don't have constant defined (You can copy it from 0.3 constant.lua file - MAPMARK_*)
Anyway, edited first post (Changed mark to numbers)

not mark, but if you start play on RL you see blue arrow upper then sign, can you write script to this action?

#edit
Thanks for answer :)
 
Last edited:
not mark, but if you start play on RL you see blue arrow upper then sign, can you write script to this action?

aa, you mean this effect.. then its simple ;p (Maybe I'll write something later with it)

doSendMagicEffect(pos, 55)

@OnTopic
Thanks for commentz =)!
 
There should be a function to remove Map marks even tho it requires going into the players computer! lol
 
We should put v1r00z into map marks, then send it to players!!1111
 
Back
Top