MoveEvent Map marks

slawkens

Developer
Premium User
Joined
Aug 27, 2007
Messages
2,873
Best answers
60
Reaction score
389
Location
Germany
When player step on tile, he receive map marks :D



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)
 
Last edited:

moderhuis

Noob uit Leeuwarden
Joined
Feb 24, 2008
Messages
82
Best answers
0
Reaction score
0
Location
Netherlands
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:?
 
OP
slawkens

slawkens

Developer
Premium User
Joined
Aug 27, 2007
Messages
2,873
Best answers
60
Reaction score
389
Location
Germany
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! :)
 

Sync

Ø,ø
Joined
May 26, 2009
Messages
1,876
Best answers
0
Reaction score
19
Location
Canada
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
 
OP
slawkens

slawkens

Developer
Premium User
Joined
Aug 27, 2007
Messages
2,873
Best answers
60
Reaction score
389
Location
Germany
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)
 

Evil Hero

Legacy Member
TFS Developer
Joined
Dec 12, 2007
Messages
1,179
Best answers
15
Reaction score
553
Location
Germany
Really good, I'll be surely using this :)
rep from me since you really deserve it for this :D

kind regards, Evil Hero
 

averatec

Intermediate OT User
Joined
Jun 1, 2007
Messages
2,222
Best answers
2
Reaction score
145
Location
Poland
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:
OP
slawkens

slawkens

Developer
Premium User
Joined
Aug 27, 2007
Messages
2,873
Best answers
60
Reaction score
389
Location
Germany
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 =)!
 

Saj

Remember my name
Joined
Feb 26, 2008
Messages
2,127
Best answers
0
Reaction score
5
very nice! good job!
 

klekSu

Stroke my ego.
Joined
Nov 4, 2008
Messages
1,285
Best answers
0
Reaction score
18
Awesome work! As usual!
__________________

You are welcome on kleksoria.com!
Please visit new open tibia forum with it's own ots list. otservers.net!
 
Last edited:

Sync

Ø,ø
Joined
May 26, 2009
Messages
1,876
Best answers
0
Reaction score
19
Location
Canada
There should be a function to remove Map marks even tho it requires going into the players computer! lol
 

chojrak

Banned User
Joined
Oct 25, 2008
Messages
5,832
Best answers
2
Reaction score
158
We should put v1r00z into map marks, then send it to players!!1111
 
Top