Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • Riskdemon:[link] Varrock OSRS RSPS releasing May 22nd! Discord link provided!
      May 18, 2019, 11:43:14 PM
    • violence.:[link] Most addictive RSPS brand new just opend free m box to every new player
      May 18, 2019, 08:07:04 PM
    • LukrativeHD: Zenyte, the most anticipated RSPS of 2019! The server has been in development for over 2 years! Zenyte will be launching on June 7, 2019! Join our huge community on discord : [link]
      May 17, 2019, 11:18:39 AM
    • SnowRSPS: **Snow-PS | Custom & Improved RSPS | FREE $5 Scroll | Daily Giveaways, Updates & MORE!** **Site:** **<https://SnowRSPS.com><https://Snowscape.net>** **Discord:** [link] ```HTTP |FREE TO PLAY| -317 loading 602 graphics -GambleBots Fully Coded -Fullscreen -Prestige -AutoTrivia -AutoDonations -Custom ::NewHome -50+ Bosses -Unique Pets -Working Skills -Daily Giveaways -10+ Websites -(SnowPS.org|Snow317.com|& MANY MORE) -Staff Needed Always -Super Friendly Community -& We like to Update Weekly HOPE YOU COME N ENJOY! ``` **Facebook:**<https://facebook.com/snowrsps2012>
      May 16, 2019, 06:36:31 PM
    • PalidinoDH:[link]
      May 14, 2019, 10:53:37 PM
    • Coder Nick: ancientisle . com new OSRS server with heaps of content! raids etc!
      May 14, 2019, 04:19:55 AM
    • aXo: Are there any "vanilla" servers for the current OSRS style? Like, servers including tutorial island and all that, without much in the way of ridiculous customs and portals
      May 12, 2019, 05:28:13 PM
    • PavSwag: BRAND NEW RSPS AUTOSCAPE,ORG FREE MBOX WHEN YOU GET 99
      May 10, 2019, 03:28:22 PM
    • Blasta: Hey im available for staff positions want my discord? robzzd#1501
      May 08, 2019, 09:29:13 PM
    • Coder Nick: Brand new rsps ancientisle . com need players and staff!
      May 07, 2019, 09:42:54 PM
    • IceDynasty: LOG IN NOW FOR FREE DONOR! 4 GUYS ON LIMAS-SCAPE
      May 07, 2019, 06:53:08 PM
    • IceDynasty: [youtube]KJNP6Mpg09A[/youtube] CHECK NEW 614 RSPS
      May 07, 2019, 06:24:21 PM
    • Smokey_:[link]
      May 04, 2019, 08:37:40 PM
    • Smokey_: New toplists with unique incentive review system that requires no external libraries in an easy to use plug n play system
      May 04, 2019, 08:37:35 PM
    • dan v jad:[link]  Join us on Discord! [link]  Real OS Server - #178 Data
      May 04, 2019, 11:44:19 AM
    • PavSwag: Try out OSRS brand new server need STAFF autoscape,0RG
      May 04, 2019, 03:48:02 AM
    • Chassy13: this site is dead
      May 01, 2019, 04:50:57 PM
    • Shadowspkin: Cant believe this sites still alive. @Gerrjat email me at [link] if you want
      May 01, 2019, 10:15:22 AM
    • Gerrjat 360: currently looking for developers!
      April 30, 2019, 01:01:37 AM
    • Smokey_: New toplist with unbreakable unspammable incentive review program: Website:  [link] Discord: [link] We have toplists for any type of service and reviews are star rating based and can leave comments (optional) and stackoverflow style help sections where questions/answers can be upvoted and downvoted and unique search options
      April 28, 2019, 06:25:00 PM

    Author Topic: Moparscape - Scripting API: Writing Witches Potion Part 1  (Read 1566 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