Commit
Rookgaard Tutorial Island is now done! *Fixed soem bugs in the tutorials! *Added Carlos the last tutorial! *Only left is to fix the outfits of Zirella, Carlos & Santiago! *Also added on startup: http://3.ii.gl/0ZNmVRfE.png
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,13 @@ local config = { | |
[50072] = {storageKey = Storage.RookgaardTutorialIsland.SantiagoNpcGreetStorage, storageValue = 2, text = "This is Santiago's room. Maybe you should talk to him before sniffing around in his house."}, | ||
[50073] = {storageKey = Storage.RookgaardTutorialIsland.SantiagoNpcGreetStorage, storageValue = 5, text = "This is Santiago's cellar. You have no business there yet.", storageValue2 = 6, text2 = "This is Santiago's cellar - and you wouldn't want to go back to this nasty place."}, | ||
[50074] = {storageKey = Storage.RookgaardTutorialIsland.SantiagoNpcGreetStorage, storageValue = 14, text = "You don't have any business there anymore. Continue to the east!"}, | ||
[50080] = {storageKey = Storage.RookgaardTutorialIsland.ZirellaNpcGreetStorage, storageValue = 1, text = "Zirella really needs help, go talk to her.", storageValue3 = 7, text3 = "This is not the way to the forest. You should head southwest first."} | ||
[50080] = {storageKey = Storage.RookgaardTutorialIsland.ZirellaNpcGreetStorage, storageValue = 1, text = "Zirella really needs help, go talk to her.", storageValue3 = 7, text3 = "This is not the way to the forest. You should head southwest first."}, | ||
[50088] = {storageKey = Storage.RookgaardTutorialIsland.tutorialHintsStorage, storageValue = 20, text = "Before you head to the village, dig open that hole with your shovel and climb down. You will find something useful down there."}, | ||
[50089] = {storageKey = Storage.RookgaardTutorialIsland.CarlosQuestLog, storageValue = 7, text = "You are not ready to enter the village of Rookgaard yet. You should talk to Carlos some more.", storageValue2 = 7, text2 = "You have no business anymore on the other side of Rookgaard."} | ||
} | ||
|
||
local allowPass = false | ||
|
||
function onStepIn(cid, item, position, fromPosition) | ||
local player = Player(cid) | ||
if not player then | ||
|
@@ -24,7 +28,16 @@ function onStepIn(cid, item, position, fromPosition) | |
if item.actionid == 50070 then | ||
if player:getStorageValue(Storage.RookgaardTutorialIsland.tutorialHintsStorage) == 5 then | ||
return true | ||
end | ||
end | ||
elseif item.actionid == 50071 then | ||
allowPass = true | ||
elseif item.actionid == 50074 then | ||
if allowPass then | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
conde2
|
||
local playerPos = player:getPosition() | ||
player:teleportTo(Position(playerPos.x + 1, playerPos.y, playerPos.z), false) | ||
allowPass = false | ||
return true | ||
end | ||
end | ||
|
||
if player:getStorageValue(targetTableAid.storageKey) < targetTableAid.storageValue then | ||
|
@@ -49,6 +62,13 @@ function onStepIn(cid, item, position, fromPosition) | |
end | ||
end | ||
|
||
if item.actionid == 50089 then | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosQuestLog, 8) | ||
player:sendTutorial(14) | ||
local playerPos = player:getPosition() | ||
player:teleportTo(Position(playerPos.x, playerPos.y - 1, playerPos.z), true) | ||
end | ||
|
||
if item.itemid == 8595 then | ||
local playerPos = player:getPosition() | ||
player:teleportTo(Position(playerPos.x, playerPos.y, playerPos.z + 1), false) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<npc name="Carlos" script="default.lua" walkinterval="2000" floorchange="0"> | ||
<npc name="Carlos" script="Carlos.lua" walkinterval="2000" floorchange="0"> | ||
<health now="100" max="100" /> | ||
<look type="140" head="60" body="24" legs="38" feet="0" addons="0" /> | ||
</npc> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
local keywordHandler = KeywordHandler:new() | ||
local npcHandler = NpcHandler:new(keywordHandler) | ||
NpcSystem.parseParameters(npcHandler) | ||
|
||
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 | ||
local random_texts = { | ||
"Hmm, we should do something about your outfit.", | ||
"Ah, another adventurer. Let's talk a little.", "Psst! Come over here for a little trade.", | ||
"Hello, hello! Don't be shy, I don't bite.", | ||
"By the way, if you want to look at old hints again, find the 'Help' button near your inventory and select 'Tutorial Hints'." | ||
} | ||
|
||
local rnd_sounds = 0 | ||
function onThink() | ||
if rnd_sounds < os.time() then | ||
rnd_sounds = (os.time() + 10) | ||
if math.random(100) < 20 then | ||
Npc():say(random_texts[math.random(#random_texts)], TALKTYPE_SAY) | ||
end | ||
end | ||
npcHandler:onThink() | ||
end | ||
|
||
local function getTable() | ||
local itemsList = { | ||
{name="meat", id=2666, sell=2}, | ||
{name="ham", id=2671, sell=2}, | ||
} | ||
return itemsList | ||
end | ||
|
||
local storeTalkCid = {} | ||
|
||
local function greetCallback(cid) | ||
local player = Player(cid) | ||
if player:getStorageValue(Storage.RookgaardTutorialIsland.CarlosNpcGreetStorage) < 1 then | ||
npcHandler:setMessage(MESSAGE_GREET, "Be greeted, ".. player:getName() .."! As a tailor and merchant I have to say - we need to do something about your {outfit}, shall we?") | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosNpcGreetStorage, 1) | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosQuestLog, 1) | ||
storeTalkCid[cid] = 1 | ||
elseif player:getStorageValue(Storage.RookgaardTutorialIsland.CarlosNpcGreetStorage) == 1 then | ||
npcHandler:setMessage(MESSAGE_GREET, "Hey, I thought you were going to run away, but luckily you came back. I'll show you how to change your {outfit}, okay?") | ||
storeTalkCid[cid] = 1 | ||
elseif player:getStorageValue(Storage.RookgaardTutorialIsland.CarlosNpcGreetStorage) == 2 then | ||
npcHandler:setMessage(MESSAGE_GREET, "Welcome back! You know, after providing my little outfit service, I like to ask a little favour of you. Can you {help} me?") | ||
storeTalkCid[cid] = 2 | ||
elseif player:getStorageValue(Storage.RookgaardTutorialIsland.CarlosNpcGreetStorage) == 3 then | ||
npcHandler:setMessage(MESSAGE_GREET, "Oh hey ".. player:getName() ..", you didn't answer my question yet - could you help me get some {food}? I'll even give you some gold for it.") | ||
storeTalkCid[cid] = 3 | ||
elseif player:getStorageValue(Storage.RookgaardTutorialIsland.CarlosNpcGreetStorage) == 4 then | ||
npcHandler:setMessage(MESSAGE_GREET, "Welcome back ".. player:getName() ..", I hope you changed your mind and will bring me some {meat}? I'll even give you some gold for it.") | ||
storeTalkCid[cid] = 4 | ||
elseif player:getStorageValue(Storage.RookgaardTutorialIsland.CarlosNpcGreetStorage) == 5 then | ||
npcHandler:setMessage(MESSAGE_GREET, "Welcome back, ".. player:getName() .."! Did you have a successful hunt and carry a piece of {meat} or ham with you?") | ||
storeTalkCid[cid] = 5 | ||
elseif player:getStorageValue(Storage.RookgaardTutorialIsland.CarlosNpcGreetStorage) == 6 then | ||
if player:getItemCount(2666) >= 1 or player:getItemCount(2671) >= 1 then | ||
npcHandler:setMessage(MESSAGE_GREET, "Welcome back, Isleth Eagonst! Do you still have that piece of meat or ham? If so, please ask me for a {trade} and I'll give you some gold for it.") | ||
storeTalkCid[cid] = 6 | ||
else | ||
npcHandler:setMessage(MESSAGE_GREET, "Welcome back, ".. player:getName() .."! Where did you put that delicious piece of food? Did you eat it yourself? Well, if you find another one, please come back.") | ||
npcHandler:releaseFocus(cid) | ||
end | ||
elseif player:getStorageValue(Storage.RookgaardTutorialIsland.CarlosNpcGreetStorage) == 7 then | ||
npcHandler:setMessage(MESSAGE_GREET, "Hey there, ".. player:getName() .."! Well, that's how trading with NPCs like me works. I think you are ready now to cross the bridge to Rookgaard! Take care!") | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosQuestLog, 7) | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosNpcGreetStorage, 8) | ||
npcHandler:releaseFocus(cid) | ||
elseif player:getStorageValue(Storage.RookgaardTutorialIsland.CarlosNpcGreetStorage) == 8 then | ||
npcHandler:setMessage(MESSAGE_GREET, "Hello again, ".. player:getName() .."! What are you still doing here? You should head over the bridge to Rookgaard village now!") | ||
npcHandler:releaseFocus(cid) | ||
end | ||
return true | ||
end | ||
|
||
local function creatureSayCallback(cid, type, msg) | ||
if not npcHandler:isFocused(cid) then | ||
return false | ||
end | ||
|
||
local player = Player(cid) | ||
if msgcontains(msg, "yes") or msgcontains(msg, "ok") or msgcontains(msg, "help") then | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
if storeTalkCid[cid] == 1 then | ||
npcHandler:say("Very well. Just choose an outfit and a colour combination that suits you. You can open this dialogue anytime by right-clicking on yourself and selecting 'Set Outfit'. Just try it and then talk to me again!", cid) | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosNpcGreetStorage, 2) | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosQuestLog, 2) | ||
player:sendTutorial(12) | ||
npcHandler:releaseFocus(cid) | ||
elseif storeTalkCid[cid] == 2 then | ||
npcHandler:say("You see, I'm quite hungry from standing here all day. Could you get me some {food}?", cid) | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosNpcGreetStorage, 3) | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosQuestLog, 3) | ||
storeTalkCid[cid] = 3 | ||
elseif storeTalkCid[cid] == 3 then | ||
npcHandler:say("Thank you! I would do it myself, but I don't have a weapon. Just kill a few rabbits or deer, loot food from them and bring me one piece of {meat} or ham, will you?", cid) | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosNpcGreetStorage, 4) | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosQuestLog, 4) | ||
storeTalkCid[cid] = 4 | ||
elseif storeTalkCid[cid] == 4 then | ||
npcHandler:say("Splendid. I'll be awaiting your return eagerly. Don't forget that you can click on the 'Chase Opponent' button to run after those fast creatures. Good {bye} for now!", cid) | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosNpcGreetStorage, 5) | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosQuestLog, 5) | ||
npcHandler:releaseFocus(cid) | ||
elseif storeTalkCid[cid] == 5 then | ||
if player:getItemCount(2666) >= 1 or player:getItemCount(2671) >= 1 then | ||
npcHandler:say("What's that delicious smell? That must be a piece of meat! Please hurry, simply ask me for a {trade} and I'll give you two gold pieces for it!", cid) | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosQuestLog, 6) | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosNpcGreetStorage, 6) | ||
storeTalkCid[cid] = 6 | ||
else | ||
npcHandler:say("Hmm. No, I don't think you have something with you that I'd like to eat. Please come back once you looted a piece of meat or a piece of ham from a rabbit or deer.", cid) | ||
npcHandler:releaseFocus(cid) | ||
end | ||
elseif storeTalkCid[cid] == 7 then | ||
npcHandler:say("Well, that's how trading with NPCs like me works. I think you are ready now to cross the bridge to Rookgaard, just follow the path to the northwest. Good luck, ".. player:getName() .."! ...", cid) | ||
npcHandler:say("And by the way: if you thought all of this was boring and you'd rather skip the tutorial with your next character, just say 'skip tutorial' to Santiago. ...", cid) | ||
npcHandler:say("Then you'll miss out on those nice items and experience though. Hehehe! It's your choice. Well, take care for now!", cid) | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosQuestLog, 7) | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosNpcGreetStorage, 8) | ||
npcHandler:releaseFocus(cid) | ||
end | ||
elseif msgcontains(msg, "outfit") then | ||
if storeTalkCid[cid] == 1 then | ||
npcHandler:say({"Well, that's how trading with NPCs like me works. I think you are ready now to cross the bridge to Rookgaard, just follow the path to the northwest. Good luck, ".. player:getName() .."! ...", | ||
"And by the way: if you thought all of this was boring and you'd rather skip the tutorial with your next character, just say 'skip tutorial' to Santiago. ...", | ||
"Then you'll miss out on those nice items and experience though. Hehehe! It's your choice. Well, take care for now!" | ||
}, cid, 0, 1, 1) | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosQuestLog, 7) | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosNpcGreetStorage, 8) | ||
addEvent(function(cid) | ||
if not Player(cid) then | ||
return | ||
end | ||
npcHandler:releaseFocus(cid) | ||
end, 1000, cid) | ||
end | ||
elseif msgcontains(msg, "trade") then | ||
if storeTalkCid[cid] == 6 then | ||
npcHandler:say("Very nice! Food for me! Sell it to me, fast! Once you sold your food to me, just say {ready} to let me know you are done.", cid) | ||
player:sendTutorial(13) | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosNpcGreetStorage, 7) | ||
storeTalkCid[cid] = 7 | ||
local items = setNewTradeTable(getTable()) | ||
local function onSell(cid, item, subType, amount, ignoreEquipped) | ||
if items[item].sellPrice then | ||
return | ||
player:removeItem(items[item].itemId, amount, -1, ignoreEquipped) and | ||
player:addMoney(items[item].sellPrice * amount) and | ||
|
||
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You sold '..amount..'x '..items[item].realName..' for '..items[item].sellPrice * amount..' gold coins.') | ||
end | ||
return true | ||
end | ||
openShopWindow(cid, getTable(), onBuy, onSell) | ||
end | ||
elseif msgcontains(msg, "ready") then | ||
if storeTalkCid[cid] == 7 then | ||
npcHandler:say({"Well, that's how trading with NPCs like me works. I think you are ready now to cross the bridge to Rookgaard, just follow the path to the northwest. Good luck, ".. player:getName() .."! ...", | ||
"And by the way: if you thought all of this was boring and you'd rather skip the tutorial with your next character, just say 'skip tutorial' to Santiago. ...", | ||
"Then you'll miss out on those nice items and experience though. Hehehe! It's your choice. Well, take care for now!" | ||
}, cid, 0, 1, 1) | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosQuestLog, 7) | ||
player:setStorageValue(Storage.RookgaardTutorialIsland.CarlosNpcGreetStorage, 8) | ||
addEvent(function(cid) | ||
if not Player(cid) then | ||
return | ||
end | ||
npcHandler:releaseFocus(cid) | ||
end, 5000, cid) | ||
end | ||
end | ||
return true | ||
end | ||
|
||
local function onReleaseFocus(cid) | ||
storeTalkCid[cid] = nil | ||
end | ||
|
||
npcHandler:setCallback(CALLBACK_ONRELEASEFOCUS, onReleaseFocus) | ||
|
||
npcHandler:setCallback(CALLBACK_GREET, greetCallback) | ||
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye |PLAYERNAME|!.") | ||
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye traveller and enjoy your stay on Rookgaard.") | ||
|
||
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) | ||
npcHandler:addModule(FocusModule:new()) |
1 comment
on commit 997f93d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
great 👍