Skip to content

Commit

Permalink
Rookgaard Tutorial Island Fully Added!
Browse files Browse the repository at this point in the history
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
PrinterLUA committed Jul 18, 2014
1 parent f99ad83 commit 997f93d
Show file tree
Hide file tree
Showing 12 changed files with 240 additions and 8 deletions.
8 changes: 6 additions & 2 deletions data/Storages-Aid-Uid Used.txt
@@ -1,6 +1,6 @@
---//////////////////////////////////////////----
Last Used Storage = 50096
Last Used Aid = 50087
Last Used Storage = 50098
Last Used Aid = 50089
Last Used Uid = 50106
---//////////////////////////////////////////----
---//////////////////Storages////////////////////////----
Expand Down Expand Up @@ -160,3 +160,7 @@ Rook cockroach Legs Msg Storage = 50089
Rook cockroach Body Msg Storage = 50090
Rook Zirella greet Storage = 50091
Rook Zirella questlog Storage = 50092
Rook Carlos greet Storage = 50097
Rook Carlos Questlog Storage = 50098
Rook Try skipping rope & shovel tutorial aid = 50088
Rook Step Into First Time Rookaard tiles aid = 50089
10 changes: 10 additions & 0 deletions data/XML/quests.xml
Expand Up @@ -709,5 +709,15 @@
<missionstate id="7" description="You have brought a branch to Zirella, congratulations! You should talk to her again for your reward."/>
<missionstate id="8" description="You have helped Zirella by collecting wood for her. The reward can be found in her house."/>
</mission>
<mission name="A Hungry Tailor" storageid="50098" startvalue="1" endvalue="8">
<missionstate id="1" description="You found another person named Carlos. You should talk to him learn how to change your outfit."/>
<missionstate id="2" description="Carlos taught you how to change your outfit. Now he seems to be wanting a small favour from you. Talk to him again to learn more."/>
<missionstate id="3" description="Carlos asked you whether you could bring him some food. Talk to him again to learn how to find food here."/>
<missionstate id="4" description="Carlos asked you to hunt some deer and rabbits and loot them to find a piece of ham or meat. However you haven't agreed yet, so you should tell him that you'll do it."/>
<missionstate id="5" description="You agreed to bring Carlos some food. Hunt some deer or rabbit until you find a piece of meat or ham talk to Carlos again."/>
<missionstate id="6" description="To sell the meat or ham to Carlos, talk to him and ask him for a 'trade'."/>
<missionstate id="7" description="You sucessfully learnt how to change your outfit and how to trade with NPCs. Time to head over the bridge to Rookgaard!"/>
<missionstate id="8" description="You have passed the bridge to Rookgaard and have sucessfully completed the Tutorial. If you want to skip the tutorial in the future with a new character, simply say 'skip tutorial' to Santiago."/>
</mission>
</quest>
</quests>
2 changes: 1 addition & 1 deletion data/actions/scripts/tools/shovel.lua
Expand Up @@ -16,7 +16,7 @@ function onUse(cid, item, fromPosition, itemEx, toPosition)
Game.createMonster("Scarab", toPosition)
end
toPosition:sendMagicEffect(CONST_ME_POFF)
elseif itemEx.itemid == 8579 and player:getStorageValue(Storage.RookgaardTutorialIsland.tutorialHintsStorage) < 19 then
elseif itemEx.itemid == 8579 and player:getStorageValue(Storage.RookgaardTutorialIsland.tutorialHintsStorage) < 20 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You dug a hole! Walk onto it as long as it is open to jump down into the forest cave.')
player:setStorageValue(Storage.RookgaardTutorialIsland.tutorialHintsStorage, 19)
Position(32070, 32266, 7):sendMagicEffect(CONST_ME_TUTORIALARROW)
Expand Down
2 changes: 2 additions & 0 deletions data/globalevents/scripts/startup.lua
Expand Up @@ -37,6 +37,8 @@ local yasirEnabled = false
local yasirChance = 20

function onStartup()
print(">> Loaded "..Game.getNpcCount().." npcs, spawned "..Game.getMonsterCount().." monsters.")

This comment has been minimized.

Copy link
@EPuncker

EPuncker Jul 19, 2014

Contributor

great 👍


db.query("TRUNCATE TABLE `players_online`")
db.query("DELETE FROM `guild_wars` WHERE `status` = 0")
db.query("DELETE FROM `players` WHERE `deletion` != 0 AND `deletion` < " .. os.time())
Expand Down
4 changes: 3 additions & 1 deletion data/lib/StorageTables.lua
Expand Up @@ -219,7 +219,9 @@ Storage = {
cockroachLegsMsgStorage = 50089,
cockroachBodyMsgStorage = 50090,
ZirellaNpcGreetStorage = 50091,
ZirellaQuestLog = 50092
ZirellaQuestLog = 50092,
CarlosNpcGreetStorage = 50097,
CarlosQuestLog = 50098
},
DeeperBanuta = {
Shortcut = 50095
Expand Down
1 change: 1 addition & 0 deletions data/movements/movements.xml
Expand Up @@ -7,6 +7,7 @@
<movevent event="StepIn" fromaid="50070" toaid = "50074" script="rookgaard/rookgaard tutorial island/rookgaardTutorialIslandTutorialStopTiles.lua"/>
<movevent event="StepIn" itemid="8596" script="rookgaard/rookgaard tutorial island/rookgaardTutorialIslandTutorialStopTiles.lua"/>
<movevent event="StepIn" actionid="50080" script="rookgaard/rookgaard tutorial island/rookgaardTutorialIslandTutorialStopTiles.lua"/>
<movevent event="StepIn" fromaid="50088" toaid = "50089" script="rookgaard/rookgaard tutorial island/rookgaardTutorialIslandTutorialStopTiles.lua"/>

<!-- Waterfall Quest (Port Hope) -->
<movevent event="StepIn" actionid="50022" script="others/waterfallquest.lua"/>
Expand Down
Expand Up @@ -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
Expand All @@ -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.

Copy link
@TheSumm

TheSumm Jul 19, 2014

Collaborator

I doubt that this works with multiple players.

This comment has been minimized.

Copy link
@conde2

conde2 Jul 19, 2014

@TheSumm is right this will not work for multiple players, you should create an array.
allowPass = {}

allowPass[cid] = true
instead of
allowPass = true

if allowPass[cid] then
instead of
if allowPass then

This comment has been minimized.

Copy link
@PrinterLUA

PrinterLUA Jul 19, 2014

Author Collaborator

You totally forgot about multiple players ^^

Thank you guys for notice.

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
Expand All @@ -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)
Expand Down
Expand Up @@ -56,11 +56,15 @@ function onStepIn(cid, item, position, fromPosition)
end

if item.actionid == 50078 then
if player:getStorageValue(50093) < 1 and player:getStorageValue(Storage.RookgaardTutorialIsland.tutorialHintsStorage) < targetTableAid.storageValue then
if player:getStorageValue(50093) < 1 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have not claimed your reward from Zirella house.')
player:teleportTo(fromPosition, true)
return
end
elseif item.actionid == 50069 then
if player:getStorageValue(Storage.RookgaardTutorialIsland.SantiagoNpcGreetStorage) < 6 then
return true
end
end

if player:getStorageValue(Storage.RookgaardTutorialIsland.tutorialHintsStorage) < targetTableAid.storageValue then
Expand Down
2 changes: 1 addition & 1 deletion data/npc/Carlos.xml
@@ -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>
188 changes: 188 additions & 0 deletions data/npc/scripts/Carlos.lua
@@ -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.

Copy link
@EPuncker

EPuncker Jul 19, 2014

Contributor

use isInArray :P
same with other npcs I guess

This comment has been minimized.

Copy link
@PrinterLUA

PrinterLUA Jul 19, 2014

Author Collaborator

Yup, thanks.

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

@Royalot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.