STAR TREK 2d20
  1. #1
    Morenu's Avatar
    Join Date
    Mar 2020
    Location
    Pennsylvania, USA
    Posts
    551

    ChatGPT as a DM tool?

    OK, I am putting this here and maybe its old news, but I was playing on ChatGPT. This seems like a great way to get ideas and even specifics for modules. Hmm, could FG use Lua to pull ideas into FG?

    I put the following in just to play:

    ME: Can you write ideas for use in a Pathfinder 1e campaign?

    ChatGPT:
    Code:
    Certainly! Here are some ideas for use in a Pathfinder 1e campaign:
    
    1. A group of powerful wizards have created a pocket dimension that they use as a sanctuary from the outside world. The players are hired to enter the dimension and retrieve a valuable artifact, but they soon discover that the wizards have their own plans for the artifact.
    
    2. A powerful necromancer has taken up residence in a nearby city, and is using his dark powers to raise an army of undead. The players must infiltrate the city and stop the necromancer before he can unleash his horde on the surrounding countryside.
    
    3. A group of dwarven miners have uncovered an ancient temple deep beneath the mountains, but they have unwittingly awakened a powerful evil that was sealed within. The players must journey into the temple and defeat the evil before it can escape and wreak havoc on the world.
    
    4. A powerful artifact has been stolen from the royal palace, and the players are tasked with retrieving it. But as they investigate, they discover that the theft is just one part of a much larger conspiracy that threatens the stability of the kingdom.
    
    5. A powerful lich has emerged from his tomb and is raising an army of undead to conquer the world. The players must journey to the lich's lair and defeat him before he can carry out his plans.
    
    6. A group of adventurers have stumbled upon an ancient artifact that has the power to summon a powerful demon. The players must journey to the demon's realm and defeat it before it can wreak havoc on the world.
    
    7. A group of bandits have taken up residence in an old castle on the outskirts of town, and are terrorizing the local population. The players must infiltrate the castle and defeat the bandits before they can cause any more harm.
    
    8. A powerful dragon has taken up residence in a nearby mountain, and is hoarding treasure and terrorizing the surrounding countryside. The players must journey to the dragon's lair and defeat it before it can cause any more damage.
    
    9. A powerful wizard has created a portal to another world, and is using it to summon powerful creatures to do his bidding. The players must journey through the portal and defeat the wizard before he can carry out his plans.
    
    10. A powerful demon has taken up residence in a nearby city, and is using his powers to corrupt the population and turn them to his side. The players must infiltrate the city and defeat the demon before it can carry out its plans.
    I tried a bit more specific...

    ME: How about specific ideas for rooms found in Forgotten Realms, Undermountain?

    ChatGPT:
    Code:
    Certainly, here are some specific ideas for rooms that could be found in Undermountain, a dungeon located in the Forgotten Realms:
    
    The Chamber of Whispers - This room is filled with the sound of faint whispers that seem to come from nowhere. The players must use their wits to decipher the whispers and solve a puzzle that will grant them access to the next area.
    
    The Forge of Elemental Fire - This room is filled with intense heat and molten lava. The players must use their skills to navigate the room and avoid being burned alive, while also defeating the fire elementals that reside within.
    
    The Hall of Mirrors - This room is filled with mirrors that reflect the players' movements, making it difficult to tell what is real and what is an illusion. The players must use their perception skills to navigate the room and avoid traps.
    
    The Crypt of the Undead - This room is filled with the undead, including zombies, skeletons, and mummies. The players must use their combat skills to defeat the undead and locate the treasure hidden within.
    
    The Puzzle Room - This room is filled with a complex series of puzzles that must be solved in order to progress. The puzzles may involve riddles, mazes, or other brain teasers that will challenge the players' intellects.
    
    The Waterfall Room - This room is dominated by a massive waterfall that cascades down from a hidden source high above. The players must navigate the treacherous waters and avoid being swept away by the powerful current.
    
    The Room of Illusions - This room is filled with illusions that trick the players into thinking they are in a different location or facing different enemies. The players must use their intelligence and observation skills to determine what is real and what is an illusion.
    
    The Chamber of Shadows - This room is shrouded in darkness, and the players must use their torches or magical light sources to navigate. The shadows themselves may also be dangerous, as they can conceal traps or ambushes.
    
    The Labyrinthine Caverns - This room is a complex network of winding tunnels and caverns that twist and turn in unexpected ways. The players must use their navigational skills to find their way through and avoid getting lost.
    
    The Room of Elemental Chaos - This room is dominated by the four elements of air, earth, fire, and water, which swirl and clash together in a deadly dance. The players must use their knowledge of elemental magic and combat skills to survive and defeat any elementals that may reside within.
    Then I did this:

    ME: create a Drow wizard, level 12 for use in Pathfinder 1st edition

    ChatGPT:
    Code:
    Here is a Drow wizard, level 12 for use in Pathfinder 1st edition:
    
    Name: Nethysara
    
    Race: Drow
    
    Class/Level: Wizard 12
    
    Alignment: Lawful Evil
    
    Ability Scores:
    
    Strength: 10
    Dexterity: 16
    Constitution: 12
    Intelligence: 22
    Wisdom: 14
    Charisma: 12
    Skills:
    
    Knowledge (arcana) +23
    Spellcraft +23
    Knowledge (planes) +20
    Knowledge (religion) +20
    Perception +16
    Sense Motive +16
    Feats:
    
    Spell Focus (Enchantment)
    Greater Spell Focus (Enchantment)
    Heighten Spell
    Craft Wondrous Item
    Improved Initiative
    Scribe Scroll
    Spell Penetration
    Greater Spell Penetration
    Quicken Spell
    Spells:
    
    Cantrips (4): Acid Splash, Dancing Lights, Mage Hand, Prestidigitation
    1st Level (6): Charm Person, Magic Missile, Ray of Enfeeblement, Sleep, True Strike, Unseen Servant
    2nd Level (6): Glitterdust, Invisibility, Scorching Ray, See Invisibility, Touch of Idiocy, Web
    3rd Level (5): Fireball, Lightning Bolt, Suggestion, Vampiric Touch, Wind Wall
    4th Level (5): Confusion, Dimension Door, Fear, Phantasmal Killer, Wall of Fire
    5th Level (4): Baleful Polymorph, Cloudkill, Feeblemind, Wall of Force
    Equipment:
    
    Headband of Vast Intelligence +2
    Amulet of Natural Armor +1
    Ring of Protection +2
    Gloves of Dexterity +2
    Cloak of Resistance +2
    Wand of Magic Missile (10 charges)
    Wand of Invisibility (10 charges)
    Wand of Web (10 charges)
    Pearl of Power (3rd level)
    Spellbook containing all spells known
    Nethysara is a master of enchantment magic, using her spells to charm and manipulate those around her to do her bidding. She is a formidable opponent in combat, able to blast enemies with powerful spells or turn them into harmless creatures. Her equipment enhances her abilities, making her harder to hit and more effective in casting spells. She is a dangerous adversary and should not be underestimated.
    Last edited by Morenu; April 18th, 2023 at 22:48.
    My First Mod PFRPG - Feats Extended, focusing on PF1e Feats and Racial Traits automation. It is open to community assistance. Here is the forum Link.

    40+ PF1e Extensions & Modules I use, with links.

    PF1E Coding Effects - Spreadsheet

    Discord: Morenu

  2. #2
    Morenu's Avatar
    Join Date
    Mar 2020
    Location
    Pennsylvania, USA
    Posts
    551
    I did this then, no idea if it is even vaguely correct, but I thought it was interesting.

    ME: Create an extension using Lua code for accessing ChatGPT from within Fantasy Grounds

    ChatGPT:
    Sure, here's an example of Lua code for an extension that allows you to access ChatGPT from within Fantasy Grounds:
    Code:
    ```
    -- load the http module
    local http = require("socket.http")
    
    -- define a function to send a message to ChatGPT and return the response
    function sendToChatGPT(message)
        -- encode the message for use in a URL
        local encodedMessage = http.urlencode(message)
        
        -- send the message to the ChatGPT API
        local response = http.request("https://api.openai.com/v1/engine/davinci-codex/completions", "prompt=" .. encodedMessage .. "&max_tokens=256")
        
        -- extract the response from the API and return it
        local responseJson = json.decode(response)
        local choices = responseJson.choices[1]
        return choices.text
    end
    
    -- define a function to handle chat messages and send them to ChatGPT
    function onChat(message)
        -- check if the message was sent by the current player
        if message.sender ~= User.getUsername() then
            -- send the message to ChatGPT and output the response to the chat log
            local response = sendToChatGPT(message.text)
            ChatManager.Message(response)
        end
    end
    
    -- register the onChat function as a chat event handler
    ChatManager.registerEventHandler("onChat", onChat)
    ```
    {ChatGPT's explanation:}

    This code uses the `http` module to make a request to the ChatGPT API. The `sendToChatGPT` function takes a message as input, encodes it for use in a URL, and sends it to the ChatGPT API using the `http.request` function. It then extracts the response from the API and returns it.

    The `onChat` function is called whenever a chat message is sent. It checks if the message was sent by the current player (using `User.getUsername()`), and if not, it sends the message to ChatGPT using the `sendToChatGPT` function and outputs the response to the chat log using the `ChatManager.Message` function.

    Finally, the code registers the `onChat` function as a chat event handler using the `ChatManager.registerEventHandler` function.

    Note that you will need to obtain an API key for the ChatGPT API in order to use this code. You can find instructions for obtaining an API key on the OpenAI website. Additionally, this code only provides a basic example of how to use ChatGPT within Fantasy Grounds; you may need to modify the code to suit your specific use case.
    Last edited by Morenu; April 18th, 2023 at 22:47.
    My First Mod PFRPG - Feats Extended, focusing on PF1e Feats and Racial Traits automation. It is open to community assistance. Here is the forum Link.

    40+ PF1e Extensions & Modules I use, with links.

    PF1E Coding Effects - Spreadsheet

    Discord: Morenu

  3. #3
    Morenu's Avatar
    Join Date
    Mar 2020
    Location
    Pennsylvania, USA
    Posts
    551
    Hmm... random encounter generator? hmmm

    ME: Acting as the Dungeon Master, tell me what my Level 3 human cleric sees as she enters town

    ChatGPT:

    Code:
    As your Level 3 human cleric enters the town, she sees a bustling and lively scene. The town is a small one, but it is filled with people going about their daily business. The streets are lined with shops and stalls selling all manner of goods, from fresh produce to handcrafted wares.
    
    In the center of the town, your cleric notices a large and ornate temple. The temple is dedicated to a deity your cleric worships, and she can feel the presence of divine power emanating from it. The temple is bustling with activity, as worshippers come and go, and the sounds of hymns and prayers fill the air.
    
    As your cleric makes her way through the town, she notices a commotion in the distance. She sees a group of people gathered around a small plaza, where a man is preaching to the crowd. The man is speaking about the dangers of evil and the importance of righteousness, and your cleric can sense a hint of divine inspiration in his words.
    
    As she continues to explore the town, your cleric notices several inns and taverns, where travelers and locals alike gather to eat, drink, and share stories. She also sees a number of guards patrolling the streets, keeping a watchful eye on the town and its inhabitants.
    
    Overall, your cleric senses that this town is a place of both piety and commerce, where the divine and the mundane are intertwined. It seems like a welcoming and safe place, but there is a hint of danger and adventure lurking in the shadows, waiting to be discovered.
    Last edited by Morenu; April 18th, 2023 at 22:45.
    My First Mod PFRPG - Feats Extended, focusing on PF1e Feats and Racial Traits automation. It is open to community assistance. Here is the forum Link.

    40+ PF1e Extensions & Modules I use, with links.

    PF1E Coding Effects - Spreadsheet

    Discord: Morenu

  4. #4
    Morenu's Avatar
    Join Date
    Mar 2020
    Location
    Pennsylvania, USA
    Posts
    551
    Now I am just talking to myself but how about this?

    ME: Using Pathfinder 1e rules, create forest encounter suitable for a party of 3, level 3 characters

    ChatGPT:
    Code:
    Encounter: Ambush in the Forest
    
    Description: The party is traveling through a dense forest when they are ambushed by a group of goblin raiders. The goblins are hiding in the trees and underbrush, waiting for the party to pass by before launching their attack.
    
    Encounter Level: 3
    
    Encounter Creatures:
    
    5 Goblin Warriors (CR 1/3 each)
    Terrain:
    
    Dense forest with plenty of cover and concealment opportunities for the goblins.
    Tactics:
    
    The goblins will use their small size and natural stealth to hide in the underbrush and trees, waiting for the party to pass by.
    Once the party is in range, the goblins will launch a surprise attack, firing arrows from the cover of the trees and underbrush.
    The goblins will attempt to isolate and overwhelm individual party members, using hit-and-run tactics and hit-and-hide strategies.
    Rewards:
    
    200 XP for defeating the goblins.
    Loot from the goblin raiders' pockets and scattered around their hideout. This could include a few gold pieces, some random trinkets, and possibly a potion or two.
    Notes:
    
    The party may be able to use their own knowledge of forest survival and tracking to detect the goblins' presence before the ambush occurs.
    The party may also be able to lure the goblins out of hiding by creating a distraction or using themselves as bait.
    ME: Stats for the Goblin Warriors

    ChatGPT:
    Code:
    Sure, here are the stats for the Goblin Warriors in Pathfinder 1e:
    
    Goblin Warrior
    Small Humanoid (Goblin)
    CR: 1/3
    XP: 135
    Initiative: +6
    Senses: Darkvision 60 ft.; Perception -1
    
    Defense:
    AC: 16 (+1 size, +2 Dex, +3 studded leather armor)
    HP: 11 (2d8+2)
    Fort: +3, Ref: +2, Will: -1
    Defensive Abilities: Evasion
    
    Offense:
    Speed: 30 ft.
    Melee: Short sword +3 (1d4-1/19-20)
    Ranged: Short bow +4 (1d4/x3)
    
    Statistics:
    Str: 8, Dex: 14, Con: 12, Int: 10, Wis: 9, Cha: 6
    Base Atk: +1; CMB: -2; CMD: 10
    Feats: Point Blank Shot, Precise Shot
    Skills: Ride +8, Stealth +12
    Languages: Goblin
    
    Special Abilities:
    
    Evasion (Ex): A Goblin Warrior can avoid damage from certain area-effect attacks, such as a fireball, by making a successful Reflex save and taking no damage.
    Goblin Traits: Goblin Warriors gain a +4 racial bonus on Ride and Stealth checks. They also gain a +1 bonus on attack rolls against foes who are smaller than them. Finally, they gain a +2 bonus on saves against illusions.
    Note: You can adjust the number of Goblin Warriors in the encounter to make it easier or more difficult, depending on your party's strength and abilities.
    My First Mod PFRPG - Feats Extended, focusing on PF1e Feats and Racial Traits automation. It is open to community assistance. Here is the forum Link.

    40+ PF1e Extensions & Modules I use, with links.

    PF1E Coding Effects - Spreadsheet

    Discord: Morenu

  5. #5
    Quote Originally Posted by Morenu View Post
    Now I am just talking to myself but how about this?

    ME: Using Pathfinder 1e rules, create forest encounter suitable for a party of 3, level 3 characters

    ChatGPT:
    Code:
    Encounter: Ambush in the Forest
    
    Description: The party is traveling through a dense forest when they are ambushed by a group of goblin raiders. The goblins are hiding in the trees and underbrush, waiting for the party to pass by before launching their attack.
    
    Encounter Level: 3
    
    Encounter Creatures:
    
    5 Goblin Warriors (CR 1/3 each)
    Terrain:
    
    Dense forest with plenty of cover and concealment opportunities for the goblins.
    Tactics:
    
    The goblins will use their small size and natural stealth to hide in the underbrush and trees, waiting for the party to pass by.
    Once the party is in range, the goblins will launch a surprise attack, firing arrows from the cover of the trees and underbrush.
    The goblins will attempt to isolate and overwhelm individual party members, using hit-and-run tactics and hit-and-hide strategies.
    Rewards:
    
    200 XP for defeating the goblins.
    Loot from the goblin raiders' pockets and scattered around their hideout. This could include a few gold pieces, some random trinkets, and possibly a potion or two.
    Notes:
    
    The party may be able to use their own knowledge of forest survival and tracking to detect the goblins' presence before the ambush occurs.
    The party may also be able to lure the goblins out of hiding by creating a distraction or using themselves as bait.
    ME: Stats for the Goblin Warriors

    ChatGPT:
    Code:
    Sure, here are the stats for the Goblin Warriors in Pathfinder 1e:
    
    Goblin Warrior
    Small Humanoid (Goblin)
    CR: 1/3
    XP: 135
    Initiative: +6
    Senses: Darkvision 60 ft.; Perception -1
    
    Defense:
    AC: 16 (+1 size, +2 Dex, +3 studded leather armor)
    HP: 11 (2d8+2)
    Fort: +3, Ref: +2, Will: -1
    Defensive Abilities: Evasion
    
    Offense:
    Speed: 30 ft.
    Melee: Short sword +3 (1d4-1/19-20)
    Ranged: Short bow +4 (1d4/x3)
    
    Statistics:
    Str: 8, Dex: 14, Con: 12, Int: 10, Wis: 9, Cha: 6
    Base Atk: +1; CMB: -2; CMD: 10
    Feats: Point Blank Shot, Precise Shot
    Skills: Ride +8, Stealth +12
    Languages: Goblin
    
    Special Abilities:
    
    Evasion (Ex): A Goblin Warrior can avoid damage from certain area-effect attacks, such as a fireball, by making a successful Reflex save and taking no damage.
    Goblin Traits: Goblin Warriors gain a +4 racial bonus on Ride and Stealth checks. They also gain a +1 bonus on attack rolls against foes who are smaller than them. Finally, they gain a +2 bonus on saves against illusions.
    Note: You can adjust the number of Goblin Warriors in the encounter to make it easier or more difficult, depending on your party's strength and abilities.
    You can use ChatGPT to create content for your games, but sometimes the amount of effort to train it to achieve what you want is not worth the time. It's helpful if one can train it with the correct formatting and such for parsing into FG quicker, otherwise you can just generate story and adventure ideas quicker. ChatGPT does have a memory limitation, so after awhile you have to reintroduce your topic or request because it will tend to drift and stray from your original prompt. You can conduct multiple prompts within one conversation, but it get rather convoluted and confusing, especially once it's lost it's focus and initial intent. For my situation, I am not patient or good with typing, so it's useful for me about 65% of the time, but there are other occasions, depending on what you are trying to achieve in which you might be better off just inputting data straight into Fantasy Grounds Unity. If you give ChatGPT good, real world data and examples of the type of output template that you desire it can become very utility.

    Have fun.
    Last edited by Laerun; April 18th, 2023 at 23:06. Reason: Clarity
    FGA Founder
    FGU teacher and student!
    Ultimate License Holder
    Discord Alias: Laerun#6969

    https://www.fantasygroundsacademy.com

  6. #6
    LordEntrails's Avatar
    Join Date
    May 2015
    Location
    -7 UTC
    Posts
    17,234
    Blog Entries
    9
    The LUA code in your example won't work in FG.

    Problems? See; How to Report Issues, Bugs & Problems
    On Licensing & Distributing Community Content
    Community Contributions: Gemstones, 5E Quick Ref Decal, Adventure Module Creation, Dungeon Trinkets, Balance Disturbed, Dungeon Room Descriptions
    Note, I am not a SmiteWorks employee or representative, I'm just a user like you.

  7. #7
    ddavison's Avatar
    Join Date
    Sep 2008
    Posts
    6,134
    Blog Entries
    21
    I use chatGPT for a Fallout RPG game I currently run and I find it to be a great help. It can create lists of things very well, descriptions for people and places, poems and songs that one of my robot NPCs sings, and helps as a sounding board to bounce ideas off. It doesn't know how to make stats for NPCs for the Fallout RPG, but that doesn't stop it from trying. It gets somewhat right if I give it more specific prompts or if I correct it.

    If you were going to try to tie something into chatGPT, I would recommend you don't hook up anything to general chat inputs unless you have a required prefix. Something like "hey Siri" or "okay Google", "Alexa", etc. chatGPT is pretty fast in creating a response, but is too long to have the program sit and wait for the response in a synchronous fashion. To do this properly, we'd likely have to expand some APIs.

  8. #8
    Quote Originally Posted by ddavison View Post
    [...] To do this properly, we'd likely have to expand some APIs.
    So what I'm choosing to read is that you are already on it, and will be previewing the feature shortly. :P

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Character Create Playlist

Log in

Log in