Action Minimap locations

GhostX

Mapping Board Moderator
Staff member
Board Moderator
Joined
Nov 2, 2011
Messages
5,787
Best answers
0
Reaction score
1,114
Location
United Kingdom
Okay, so this is my first serious script i have ever made.

It's function: When you use "x" item (i use the hangable minimap or the writable map) You receive x marks/locations on your minimap.

Insert this into actions -> scripts -> chosen location

Lua:
  --[[ Script by Ghostx... 
  Use a map recieve map marks/locations on minimap
  Any issues and/or questions do contact me on otland.
]]--
 function onUse(cid, item, fromPosition, itemEx, toPosition)
 
 local Mark = {
  [1]={{x=0000,y=0000,z=7},"name",MAPMARK_TEMPLE}, -- Edit the locations to the position to mark
  [2]={{x=0000,y=0000,z=7},"name",MAPMARK_LOCK},  -- Where it says 'name' change it to the place
  [3]={{x=0000,y=0000,z=7},"name",MAPMARK_SWORD},  -- You can change the icon after the mapmark_
  [4]={{x=0000,y=0000,z=7},"name",MAPMARK_STAR},  -- You can add or reduce locations just by
  [5]={{x=0000,y=0000,z=7},"name",MAPMARK_FLAG},  -- adding/deleteing a line
  [6]={{x=0000,y=0000,z=7},"name",MAPMARK_TICK},  -- Make sure to follow the [1], [2] order rule.
  [7]={{x=0000,y=0000,z=7},"name",MAPMARK_REDWEST},
  [8]={{x=0000,y=0000,z=7},"name",MAPMARK_BAG}
}
  for i = 1, #mark do
            doPlayerAddMark(cid, Mark[i][1], Mark[i][3], Mark[i][2]) 
     end
  doPlayerSendTextMessage(cid, 21, "You now have locations marked on your map")
 return true
end

if you're using 0.2, use this function instead:
Lua:
doAddMapMark(cid, pos, type, <optional> description)


Useful information -> Different marks you can add for the icons
XML:
MAPMARK_TICK
MAPMARK_QUESTION
MAPMARK_EXCLAMATION
MAPMARK_STAR
MAPMARK_CROSS
MAPMARK_TEMPLE
MAPMARK_KISS
MAPMARK_SHOVEL
MAPMARK_SWORD
MAPMARK_FLAG
MAPMARK_LOCK
MAPMARK_BAG
MAPMARK_SKULL
MAPMARK_DOLLAR
MAPMARK_REDNORTH
MAPMARK_REDSOUTH
MAPMARK_REDEAST
MAPMARK_REDWEST
MAPMARK_GREENNORTH
MAPMARK_GREENSOUTH
You could probably edit it like this in order to make it compatible to both 0.2 and 0.3.
Also, you should use constants instead of 21 in text message.

Lua:
 --[[ Script by Ghostx... 
    Use a map recieve map marks/locations on minimap
    Any issues and/or questions do contact me on otland.
]]--

local marks = {
    [1]={{x=0000,y=0000,z=7}, "name", MAPMARK_TEMPLE}, -- Edit the locations to the position to mark
    [2]={{x=0000,y=0000,z=7}, "name", MAPMARK_LOCK}, -- Where it says 'name' change it to the place
    [3]={{x=0000,y=0000,z=7}, "name", MAPMARK_SWORD}, -- You can change the icon after the mapmark_
    [4]={{x=0000,y=0000,z=7}, "name", MAPMARK_STAR}, -- You can add or reduce locations just by
    [5]={{x=0000,y=0000,z=7}, "name", MAPMARK_FLAG}, -- adding/deleteing a line
    [6]={{x=0000,y=0000,z=7}, "name", MAPMARK_TICK}, -- Make sure to follow the [1], [2] order rule.
    [7]={{x=0000,y=0000,z=7}, "name", MAPMARK_REDWEST},
    [8]={{x=0000,y=0000,z=7}, "name", MAPMARK_BAG}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    for i = 1, #marks do
        if doAddMapMark then
            doAddMapMark(cid, marks[i][1], marks[i][3], marks[i][2])
        else
            doPlayerAddMark(cid, marks[i][1], marks[i][3], marks[i][2]) 
        end
    end
    doPlayerSendTextMessage(cid, 21, "You now have locations marked on your map")
    return true
end

Regards
 
Last edited:

Evan

A splendid one to behold
Premium User
Joined
May 6, 2009
Messages
7,017
Best answers
1
Reaction score
942
Location
United States
Very nice!

Remember, if you're using 0.2, use this function instead:
Lua:
doAddMapMark(cid, pos, type, <optional> description)
 

Limos

Premium User
Joined
Jun 7, 2010
Messages
10,018
Best answers
7
Reaction score
2,958
Location
Netherlands
Nice and usefull script, thanks for the release.
 
OP
GhostX

GhostX

Mapping Board Moderator
Staff member
Board Moderator
Joined
Nov 2, 2011
Messages
5,787
Best answers
0
Reaction score
1,114
Location
United Kingdom
Thanks guys, main reason why i am learning scripting is because it seems the only true way to provide "support". feedback to improve maps/sprites is purely subjective of the judging member. Scripting is generally a definate article, it is useful or it isn't.

Hopefully in the future when i am experienced i can provide script-wise support. I guess it's also a handy skill to learn in real life.

If anyone wishes to learn, check out lua.org (recommended to me by Fallen), aswell as otland tutorials to learn tibia's functions.
 

Wavoz

Oldschooler
Joined
Jul 10, 2011
Messages
980
Best answers
0
Reaction score
52
So you finally got it to work. Good for you.
 

Fallen

Freelancer
Joined
Aug 21, 2009
Messages
3,713
Best answers
0
Reaction score
247
Location
Egypt
@Wavoz and your point is?

@Thread This script would be even better if you have made it an onLogin for newcomers to help them find places... However, A+ for learning scripting in 1 day and making this same day.
 

Wavoz

Oldschooler
Joined
Jul 10, 2011
Messages
980
Best answers
0
Reaction score
52
@Wavoz and your point is?
He had some trouble getting it to work earlier and i was trying to help him.

Btw now that it is working u can make it bit more advanced and make it usable only for once.
 

SpiderOT

™ツʂριԃҽɾσƚ➽ ٩(•‿•)۶★彡
Joined
Sep 29, 2008
Messages
1,038
Best answers
8
Reaction score
159
Location
Egypt/cairo
you should take out "doPlayerSendTextMessage(cid,21,"You now have locations marked on your map")" from the loop
other than that great work ;)
 
Last edited:
OP
GhostX

GhostX

Mapping Board Moderator
Staff member
Board Moderator
Joined
Nov 2, 2011
Messages
5,787
Best answers
0
Reaction score
1,114
Location
United Kingdom
Wavoz, if it worked once and player removed marks and wanted back another day, he couldnt.. So i chose to directly make it looped each time. If you get me..

I only make scripts i need atm. So yh :) i'll release all i make tho


Thanks for feedback
 

Santi

Theres no way im stopping
Joined
Aug 29, 2010
Messages
1,975
Best answers
0
Reaction score
149
Location
00
Take the message from the loop.
Looks good :)
 

Amiroslo

Excellent OT User
Joined
Jul 28, 2009
Messages
6,694
Best answers
5
Reaction score
694
@Wavoz and your point is?

@Thread This script would be even better if you have made it an onLogin for newcomers to help them find places... However, A+ for learning scripting in 1 day and making this same day.
Lua:
function onLogin(cid)
 
 local Mark = {
  [1]={{x=1000,y=1000,z=7},"Temple",MAPMARK_TEMPLE}, -- Edit the locations to the position to mark
}
  for i = 1, #mark do
            doPlayerAddMark(cid, Mark[i][1], Mark[i][3], Mark[i][2]) 
     end
  doPlayerSendTextMessage(cid, 21, "Temple way is located on your map!")
 return true
end
would this work?
and add some storage to check if he got x storage, if he have x storage then it doesnt show ?
 
Top