erinsx
Princess of the Internet
- Joined
- Nov 3, 2015
- Messages
- 7
- Reaction score
- 10
In my temples I have monks, who will mark shops and depots and things on the minimap, and if you ask them they will set your home town to the town you are in.
Here is an example, Monk Brevan, who lives in Jorvik
First, Brevan's XML file, goes in /data/npc/
Next, Brevans's LUA, called jorvikmark.lua, goes in /data/npc/scripts/
So obviously to adapt this, you would just change mark coordinates and town IDs and names and things.
And that's it!
Here is an example, Monk Brevan, who lives in Jorvik
First, Brevan's XML file, goes in /data/npc/
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Brevan" script="jorvikmark.lua" walkinterval="0" floorchange="0" speechbubble="1">
<health now="100" max="100"/>
<look type="206" head="17" body="54" legs="114" feet="0" addons="0" />
<parameters>
<parameter key="message_greet" value="Greetings |PLAYERNAME|! I can mark your {map} to help you find you way around! If you want this, just say {map}! I can also make Jorvik your {home} town. If you want this, say {home}."/>
</parameters>
</npc>
Next, Brevans's LUA, called jorvikmark.lua, goes in /data/npc/scripts/
Code:
local marks = {
[1]={{x=0496,y=0172,z=7},"Temple",MAPMARK_TEMPLE},
[2]={{x=0408,y=0203,z=7},"Depot",MAPMARK_LOCK},
[3]={{x=0478,y=0148,z=7},"Weapons and Armor shops",MAPMARK_SWORD},
[4]={{x=0464,y=0208,z=7},"Magic shop",MAPMARK_STAR},
[5]={{x=0476,y=0201,z=7},"Potions shop",MAPMARK_STAR},
[6]={{x=0390,y=0202,z=7},"Bank",MAPMARK_DOLLAR},
[7]={{x=0433,y=0235,z=7},"Adventurer Supplies",MAPMARK_BAG},
[8]={{x=0480,y=0163,z=7},"Mount Seller",MAPMARK_EXCLAMATION},
[9]={{x=0430,y=0210,z=7},"Loot Buyer",MAPMARK_TICK},
}
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local player = Player(cid)
if msg == "map" then
for i = 1, #marks do
player:addMapMark(marks[i][1],marks[i][3],marks[i][2])
end
selfSay('I have marked your map for you, good luck!', cid)
talkState[talkUser] = 0
elseif msg == "home" then
player:setTown(Town(4))
selfSay('It is done! Goodbye.', cid)
talkState[talkUser] = 0
else
selfSay('Okay, goodbye.', cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
So obviously to adapt this, you would just change mark coordinates and town IDs and names and things.
And that's it!