Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • Cole1497: this shout box is diarrhetic
      July 15, 2019, 04:53:27 PM
    • PavSwag: autoscape,0rg free ultra M box today (twisted bow??)
      July 13, 2019, 04:54:43 PM
    • PavSwag: autoscape,0rg free ultra M box today (twisted bow??)
      July 13, 2019, 04:34:05 PM
    • rune-list:[link] RuneScape Private Servers List & Community.
      July 12, 2019, 12:25:23 AM
    • ragnoroker: Join PoonScape today! amazing new server - growing fast! [link]
      July 11, 2019, 10:31:15 AM
    • ragnoroker: Join PoonScape today! amazing new server - growing fast! [link]
      July 11, 2019, 10:31:11 AM
    • PavSwag: autoscape,0rg free ultra M box today (twisted bow??)
      July 10, 2019, 05:27:05 AM
    • PavSwag: autoscape,0rg free ultra M box today (twisted bow??)
      July 10, 2019, 05:10:40 AM
    • PavSwag: autoscape,0rg free ultra M box today (twisted bow??)
      July 10, 2019, 04:43:07 AM
    • ArtexAdv: Artex-rsps,com [link] (BRAND NEW SERVER)
      July 08, 2019, 07:59:48 PM
    • ArtexAdv:[link] (BRAND NEW SERVER)
      July 08, 2019, 07:59:31 PM
    • PavSwag: autoscape,0rg free ultra M box today (twisted bow??)
      July 08, 2019, 07:03:33 PM
    • PavSwag: autoscape,0rg free ultra M box today (twisted bow??)
      July 08, 2019, 07:03:16 PM
    • PavSwag: autoscape,0rg free ultra M box today (twisted bow??)
      July 08, 2019, 06:59:50 PM
    • dan v jad: guys join PkOwnage today!! Great new server, raids, eco, PK! Discord [link] homepage [link]
      July 07, 2019, 10:59:48 AM
    • ragnoroker: Join PoonScape today! amazing new server - growing fast! - [link]
      July 07, 2019, 08:19:24 AM
    • ragnoroker: Join PoonScape today! amazing new server - growing fast! - [link]
      July 07, 2019, 08:19:04 AM
    • PavSwag: autoscape,0rg free ultra M box today (twisted bow??)
      July 05, 2019, 04:22:44 PM
    • PavSwag: autoscape,0rg
      July 05, 2019, 04:22:32 PM
    • PavSwag: #AS [link] is 317 Oldschool RuneScape Private Server emulating core factors of the game with a strong economy and balance of experience to bossing and prestiging - Lumbridge remade - Login with a starter set of armour and items - PK District - Preloading sets - GE PVP - Clan Wars Safe PK - PVP Tournaments - Activity points for training - All Skills Working, Skilling Island, Skilling Pets, Skilling Rewards - All Working Max Capes - 25+ Bosses with Pets - Superior Slayer Encounters - Clue Scrolls & Imbue Scrolls - Player Profiles - Player Owned Shops - Minigames, Construction, Sawmill, Warriors Guild, Pest Control, Barrows (with pets), Fight Caves, Inferno Caves, Chambers of Xeric, Custom Raids - QoL Updates: Keybinds, Skill Guides,
      July 05, 2019, 04:22:29 PM

    Author Topic: Moparscape - Scripting API: Writing Witches Potion Part 1  (Read 1603 times)

    0 Members and 1 Guest are viewing this topic.

    Offlinesini

    • Member
    • ****
    • *
    • *
    • Posts: 5,785
    • Thanks: +0/-0
      • View Profile


    Notes:

    I have to review on how I want the conventions of quests to be done and I need to finish a lot of other helper methods involved with quests. This however is writing ALL of the dialogue involved with the quest and updating the quest stage after dialogue is finished. Most of the video will be fluff of me coding and talking about future prospects. Tomorrows video will be fleshing out the quest helper methods (removing the items from the inventory, checking if they are there, etc) along with proper naming of all the module methods. Background artist is Banks.

    Hope you enjoy! This took me 30 minutes which means on average we could finish a SIMPLE quest everyday if we put our minds to the effort and once its done once its done on all platforms using the same API.

    Result script:

    Code: Lua
    1. local module ={}
    2.  
    3. module.one =function(plr)
    4.     plr:dialogueplr("<p,calm>I am in search of a quest.")
    5.     plr:dialoguenpc("<p,calm>Hmmm... Maybe I can think of something for you.")
    6.     plr:dialoguenpc("<p,calm>Would you like to become proficient in the dark arts.")
    7.     plr:dialogueoption("Yes help me become one with my dark side.", module.dialogue_quest_start,
    8.         "No I have my principle and honour.",function(plr)                             -- Just let them know theyre missing out
    9.             plr:dialoguenpc("Suit yourself, but you're missing out.")
    10.         end,
    11.         "What, you mean improve my magic?", module.three)
    12. end
    13.  
    14. module.dialogue_quest_start =function(plr)
    15.  
    16.     -- Have a little chit chat about getting the ingredients
    17.     plr:dialoguenpc("Ok I'm going to make a potion to help bring out your darker self.")
    18.     plr:dialoguenpc("You will need certain ingredients.")
    19.     plr:dialogueplr("What do I need?")
    20.     plr:dialoguenpc("You need an eye of newt, a rat's tail, an onion... Oh and a piece of burnt meat.")
    21.     plr:dialoguenpc("Great I'll go get them.")
    22.  
    23.     -- Update the stage of the quest to being started
    24.     plr:setvar(variables.witches_potion_stage,1)
    25. end
    26.  
    27. module.three =function(plr)
    28.     plr:prompt("The witch sighs.")
    29.     plr:dialoguenpc("Yes improve your magic...")
    30.     plr:dialoguenpc("Do you have no sense of drama?")
    31.     plr:dialogueoption("Yes I'd like to improve my magic.",function(plr)
    32.             plr:prompt("The witch sighs.")
    33.             plr:call(module.dialogue_quest_start)
    34.         end,
    35.         "No I'm not interested.",function(plr)
    36.             plr:dialoguenpc("Many aren't to start off with.")
    37.             plr:prompt("The witch smiles mysteriously.")
    38.             plr:dialoguenpc("But I think you'll be drawn back to this place.")
    39.         end,
    40.         "Show me the mysteries of the dark arts....",function(plr)
    41.             plr:prompt("The witch smiles mysteriously.")
    42.             plr:call(module.dialogue_quest_start)
    43.         end)
    44. end
    45.  
    46. module.four =function(plr)
    47.     plr:dialoguenpc("So have you found the things for the potion?")
    48.     iftruethen    -- Check if items are present
    49.         plr:dialogueplr("Yes I have everything!")
    50.         plr:dialogueplr("Excellent, can I have them?")
    51.         plr:prompt([[You pass the ingredients to Hetty and she puts them all into her<p>cauldron.
    52.         Hetty closes her eyes and begins to chant. The cauldron<p>bubbles mysteriously.]])
    53.         -- TODO: Remove the items from the player inventory
    54.         plr:dialogueplr("Well, is it ready?")
    55.         plr:dialoguenpc("Ok, now drink from the cauldron.")
    56.  
    57.         plr:setvar(variables.witches_potion_stage,2)
    58.     else
    59.         plr:dialogueplr("I found some of the things you asked for:")
    60.         -- TODO: player chat for what items are exisiting in the inventory
    61.         plr:dialoguenpc("Graet, but I'll need the other ingredients as well.")
    62.     end
    63. end
    64.  
    65. return module
    66.  

    Here are my notes used in the video:

    Code: [Select]
    Witches potion

    "I can start this quest by talking to <red>Hetty</red> in her house in <red>Rimmington</red>, West of <red>Port Sarim</red>"

    - Talk to Hetty

    "<p,quiz>What could you want with an old woman like me?"

    Option ->
    "I am in search of a quest." (0)
    "I've heard that you are a witch." (1)

    (0)
    "I am in search of a quest."
    "Hmmm... Maybe I can think of something for you."
    "Would you like to become proficient in the dark arts"

    Option ->
    "Yes help me become one with my dark side." (2)
    "No I have my principle and honour." (3)
    "What, you mean improve my magic?" (4)

    (1)
    "I've heard that you are a witch."
    "Yer it does seem to be getting fairly common knowledge."
    "I fear I may get a visit from the witch hunters of Falador before long."

    (2)
    "Yes help me become one with my dark side."
    (sub2)
    "Ok I'm going to make a potion to help bring out your darker self."
    "You will need certain ingredients."
    "What do I need?"
    "You need an eye of newt, a rat's tail, an onion... Oh and a piece of burnt meat."
    "Great I'll go get them."

    (3)
    "No I have my principle and honour."
    "Suit yourself, but you're missing out."

    (4)
    "What, you mean improve my magic?"
    "The witch sighs."Note: Standalone dialogue
    "Yes improve your magic..."
    "Do you have no sense of drama?"

    Option ->
    "Yes I'd like to improve my magic." (5)
    "No I'm not interested." (6)
    "Show me the mysteries of the dark arts..." (7)

    (5)
    "The witch signs."Note: Standalone dialogue
    goto sub2

    (6)
    "No I'm not interested."
    "Many aren't to start off with."
    "The witch smiles mysteriously." Note: Standalone dialogue
    "But I think you'll be drawn back to this place."

    (7)
    "The witch smiles mysteriously."Note: Standalone dialogue
    goto sub2


    <blue>Hetty needs me to bring the following:</blue><p,red>An onion<p>A rat's tail<p>A burnt piece of meat<p>An eye of newt</red>

    I have eye of newt in my inventory:

    <st>I have an eye of newty</st>

    When I have all the items just strikes through each of them with the same message

    After first stage:

    "I spoke to Hetty at her house at Rimmington. Hetty told me she could increase my magic powerif I can bring her certain ingredients for a potion."

    "So have you found the things for the potion?"
    "I found some of the things you asked for:"
    "I don't have rats tail."
    "Great, but I'll need the other ingredients as well."

    "So have you found the things for the potion?"
    "Yes I have everything!"
    "Excellent, can I have them?"

    "Well, is it ready?"
    "Ok,now drink from the cauldron."

    "I should drink from the <red>cauldron</red> and improve my magic!"





    « Last Edit: April 06, 2015, 02:58:16 AM by sinisoul »
    Runescape Gambling

    OfflineVain_

    • Member
    • ****
    • Posts: 3,057
    • Thanks: +0/-0
      • View Profile
    Re: Moparscape - Scripting API: Writing Witches Potion Part 1
    « Reply #1 on: April 06, 2015, 08:09:41 AM »
    graet work
    Runescape Gambling

    Offlinesini

    • Member
    • ****
    • *
    • *
    • Posts: 5,785
    • Thanks: +0/-0
      • View Profile
    Re: Moparscape - Scripting API: Writing Witches Potion Part 1
    « Reply #2 on: April 06, 2015, 08:19:38 AM »
    Sorry that the video was 30 minutes. Imagine if I did the entire quest! Probably a solid hour. Maybe more.
    Runescape Gambling

    Offlineox random xi

    • Member
    • ****
    • Posts: 3,889
    • Thanks: +0/-0
      • View Profile
    Re: Moparscape - Scripting API: Writing Witches Potion Part 1
    « Reply #3 on: April 06, 2015, 01:03:41 PM »
    I'll have to take a look at this when I get home from school, maybe I'll write a quest or two haha.
    Quote from: sini
    hey tom Im coming for ur gurl
    Quote from: Tom
    I'm cool with that, she'd never go for someone who can't finish the job anyway. :D
    https://forum.moparisthebest.com/

    OfflineDavidi2

    • Member
    • ****
    • *
    • Posts: 23,272
    • Thanks: +0/-0
      • View Profile
    Re: Moparscape - Scripting API: Writing Witches Potion Part 1
    « Reply #4 on: April 06, 2015, 01:33:52 PM »
    what happened to the player context so that you wouldnt need to be doing the plyr:

    also do you have a list of completed commands

    Offlinesini

    • Member
    • ****
    • *
    • *
    • Posts: 5,785
    • Thanks: +0/-0
      • View Profile
    Re: Moparscape - Scripting API: Writing Witches Potion Part 1
    « Reply #5 on: April 06, 2015, 07:01:49 PM »
    I'll explain to you later

    OfflineAmbokile

    • Member
    • ****
    • Posts: 3,009
    • Thanks: +0/-0
      • View Profile
    Re: Moparscape - Scripting API: Writing Witches Potion Part 1
    « Reply #6 on: April 06, 2015, 07:23:28 PM »
    This looks like a very nice API. Good job.

    Offlinesini

    • Member
    • ****
    • *
    • *
    • Posts: 5,785
    • Thanks: +0/-0
      • View Profile
    Re: Moparscape - Scripting API: Writing Witches Potion Part 1
    « Reply #7 on: April 06, 2015, 07:44:59 PM »
    I will be releasing the repo, docs, and part 2 tonight. Stay tuned or get on irc and we can debate features together :)

    OfflinestCky

    • Member
    • ****
    • Posts: 409
    • Thanks: +0/-0
      • View Profile
    Re: Moparscape - Scripting API: Writing Witches Potion Part 1
    « Reply #8 on: April 06, 2015, 08:02:59 PM »
    Das kinda cool brah, I'll take a good look in my spare time and maybe get stuck in :)
    HOLD CTRL AND TYPE "WTF" FOR ℱ𝓪𝓷𝓬𝔂 𝓦𝓣ℱ

    Offlinesini

    • Member
    • ****
    • *
    • *
    • Posts: 5,785
    • Thanks: +0/-0
      • View Profile
    Re: Moparscape - Scripting API: Writing Witches Potion Part 1
    « Reply #9 on: April 06, 2015, 08:54:00 PM »
    Code: Lua
    1. local witches_potion =require('quest/witches_potion')
    2.  
    3. app:onoption(type.npc, option.first, npc.hetty,function(plr, npc, option)
    4.  
    5.     -- If witches potion is started then we need to check if the player has the required items.
    6.     if plr:getvar(varplr.witches_potion_progress)>0then
    7.  
    8.         witches_potion:dialogue_stage_1_check_items(plr)
    9.  
    10.     -- If withces potion is finished we provide a completely different dialogue
    11.     elseif plr:getvar(varplr.witches_potion_progress)>= witches_potion.complete_stage then
    12.         plr:chatnpc('How\'s your magic comign along?')
    13.         plr:chatplr('I\'m practing and slowly getting better.')
    14.         plr:chatnpc('Good good.')
    15.     else
    16.         local dialogue = plr:optiondialogue()
    17.  
    18.         dialogue:option('I am in search of a quest.', witches_potion.dialogue_stage_0_quest_start)
    19.  
    20.         dialogue:option('I\'ve heard you\'re a witch',function(plr)
    21.             plr:chatnpc('Yer it seems to be getting fairly common knowledge.')
    22.             plr:chatnpc('I fear I may get a visit from the witch hunters of Falador before long.')
    23.         end)
    24.     end
    25. end)
    26.  

    I changed option dialogues because I hated forcing inline functions into a single method.

     

    Copyright © 2017 MoparScape. All rights reserved.
    Powered by SMFPacks SEO Pro Mod |
    SimplePortal 2.3.5 © 2008-2012, SimplePortal