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

CreatureEvent Mapmark scroll

Limos

Senator
Premium User
Joined
Jun 7, 2010
Messages
10,013
Solutions
8
Reaction score
3,056
Location
Netherlands
Tested with TFS 0.3.6pl1 8.54

creaturescripts.xml
XML:
<event type="textedit" name="Mapmark" event="script" value="mapmark.lua"/>
Add this line to login.lua
Lua:
registerCreatureEvent(cid, "Mapmark")
mapmark.lua
Lua:
-- Mapmark scroll by Limos
local config = {
	["Riona"] = {mark = {x = 1000, y = 1000, z = 7}, type = MAPMARK_TICK, name = "Riona\'s Tool Shop"},	
	["deposit"] = {mark = {x = 1000, y = 1000, z = 7}, type = MAPMARK_TICK, name = "deposit"},
	["boat"] = {mark = {x = 1000, y = 1000, z = 7}, type = MAPMARK_TICK, name = "boat"},
	["rotworms"] = {mark = {x = 1000, y = 1000, z = 7}, type = MAPMARK_TICK, name = "rotworms"},
	["cyclops"] = {mark = {x = 1000, y = 1000, z = 7}, type = MAPMARK_TICK, name = "cyclops"},
	["dragons"] = {mark = {x = 1000, y = 1000, z = 7}, type = MAPMARK_TICK, name = "dragons"},
	["demons"] = {mark = {x = 1000, y = 1000, z = 7}, type = MAPMARK_TICK, name = "demons"}
}
 
function onTextEdit(cid, item, newText)
	if item.itemid == 1949 then
		local x = config[newText]
		if x then
			doPlayerAddMapMark(cid, x.mark,x.type,x.name)
			doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You added a new mapmark for '..newText..' to your minimap.')
		end
 
		local y = isInArray({'location', 'locations'}, newText)
		if y then
		local text = 'Locations\n'
			for i, x in pairs(config) do
				text = text .. "\n" .. i .. ""
			end
			doShowTextDialog(cid, 1949, "" .. text)
		end
 
		if not x and not y then
			doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)    
			return doPlayerSendCancel(cid, "This location doesn\'t exist in this scroll.")
		end
	end
	return true
end


How does it work:

You type a location, and it adds a mapmark there.
EqUHe6p.png

oILDWWi.png


If you type location or locations you see all the locations in the scroll.
O-NgEdC.png


If the location is not in the script, you will receive a message that it doesn't exist.


Let me know if you have any questions or bugs.
 
Last edited:
I've got a suggestion if you're open: Instead of opening up an empty text edit everytime to type in, it's better to open the text edit with the current locations set and there you're able to edit (in terms of remove and/or add new locations).

Good job anyways.
 
You should change this
Lua:
doShowTextDialog(cid, 1949, "Locations\n\nRiona\ndeposit\nboat\nrotworms\ncyclops\ndragons\ndemons")
For
Lua:
			local str = ""
			for key, value in pairs(config) do
				str = "\n" .. value
			end
			doShowTextDialog(cid, 1949, "Locations\n" .. str)
It is of course example (not tested).
 
Added, thanks for the comments.
 
Last edited:
How can adding a mapmark help you escape from pking?
 
Please optimize this:
Code:
	["Riona"] = {mark = {x = 1000, y = 1000, z = 7}, type = MAPMARK_TICK, name = "Riona\'s Tool Shop"},
Remove the type, it's all the same and it's just using more memory.
 
I used the type in config as example. I made it like this incase people want to change the mapmark type.
Thanks for your suggestion anyway.
 
Last edited:
Back
Top