Creating a Roleplay: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 50: | Line 50: | ||
# Click in the middle of the stage block to open up its editor. Add the library game action deal3damage. This makes it do 3 damage to the player when they fail the roll. | # Click in the middle of the stage block to open up its editor. Add the library game action deal3damage. This makes it do 3 damage to the player when they fail the roll. | ||
# Try it out for yourself! | # Try it out for yourself! | ||
[[File:Outliner Example.png|center|frame|Example of the outliner]] | [[File:Outliner Example.png|center|frame|Example of the outliner]] | ||
== Connecting to a player == | |||
Roleplays are always set or started through Game Actions. You can start one in multiple ways just by triggering a GameAction with the type "roleplay" from anywhere in the game. But to connect one to an NPC where you can click the RP box, you'll need an encounter. | |||
# In the roleplay editor, make sure the Player is linked to the player you want to attach the RP to. | |||
# Create a new encounter, or edit an existing encounter with same NPC (see [[Creating_a_Dungeon]]). | |||
# Scroll down to Start/passive Game Actions. | |||
# Click Unique to create a unique game action. You can also use a library asset, but this is one of those places where a unique action may be sensible. | |||
# Set the type to roleplay. | |||
# Select the roleplay to the roleplay you created. | |||
# You're done! Note that if you're already in the dungeon that the encounter is attached to, you'll need to run game.setDungeon(game.dungeon.label, game.dungeon.active_room) in the console, or leave and return to the dungeon since dungeons are snapshotted. | |||
== Text Extras == | |||
* When writing roleplay stage text, wrapping a section of text in square brackets [] will turn the section into an emote, removing it from the speech bubble and making it italic with a smaller font. | |||
* You can set the name/portrait in a roleplay stage to %T to set the portrait to the player who brought you to the stage. You can set it to "none" to hide the portrait/name. You can set it to %P to target the first roleplay player. | |||
[[Category:Modding]] |
Latest revision as of 15:50, 20 February 2025
In FQ, the dialogue box that shows up when you talk to NPCs is called a Roleplay.
- To start, find the Roleplay button on the left to view a listing of roleplays. Click New to create a new one.
- Give it a unique label, I'll call mine "rpTest" and uncheck persistent, once, and auto play. WARNING: DO NOT EDIT LABELS AFTER SETTING THEM.
- Description is only used internally in the editor. For more information about the fields, click the question mark at the top right of the window.
- The recommended way to create roleplays nowadays is to use the Outliner. Click the Outliner button to bring it up. You can only have one outliner at a time.
Outliner Basics
- The roleplay block will show in the middle of the outliner. The squares are referred to as "blocks". If you edit the roleplay you'll see the block change. But some edits may require you to click the refresh button at the top right of the outliner screen.
- Notice the yellow connection on the right, that's an input which accepts a single roleplay stage. A roleplay stage is a collection of one or more texts to be shown on the screen, and optionally some responses for the player to use.
- Right click on a grey area and select + Stage to create a stage.
- You can drag blocks around by their titles. You can zoom with the scroll wheel and pan by dragging the background.
- Drag a line from the output (left side) of the stage or from the roleplay to connect them. This sets the entry stage for the roleplay.
- Click inside the stage block to bring up the stage editor, or click + New Text to create a text immediately. For the sake of the demo I'll just add a text with "Hello!" in the first stage. Then in the stage editor I'll check the "Leave" button to auto generate a "[Leave]" response.
- Right click and create a reply. Connect it to the Stage.
- Click inside the reply to change its properties. I'll set the text to "How are you?" and leave the rest as default.
- Next I'll create another Stage block and connect it to the yellow node on the reply.
- I'll click + New Text and set it to "Fine thank you!" and leave everything else empty. If a stage has no replies, it automatically creates a "[Leave]" option.
- Load up a game of FQ and type in the console: game.setRoleplay('rpTest', true, game.players[0]) Note: Ctrl+Shift+J opens the console in Chrome.
- If everything worked you should now be able to go through the roleplay.
Conditions
- Replies and Goto can have conditions.
- In the RP we created above, create a new Goto and link it to the blue node of the "How are you?" reply.
- Click in the middle of the Goto block to bring up the goto editor. Click Library under Conditions, search for and add targetBreastsLarge.
- Create a new Stage and link it to the yellow node of the goto.
- Create a text in the stage and set it to "Very fine now that you are here!"
- If you save and load up the RP again through the console, if your character has the large_breasts tag, the "How are you?" response will now take you to the "Very fine now that you are here!" reply, otherwise to "Fine thank you!"
- Under the how are you reply, add a new reply. Set the text to "Bork!" and connect it to the "Hello!" stage block.
- Click inside the Bork! reply block and add the library condition targetCanine.
- Connect the yellow node to the "Fine thank you!" stage.
- If you load the RP up again in game, you'll get the Bork! option only if your active character is a dog.
Dice rolls
- You can make dice rolls to make outcomes different based on luck.
- Create a new reply under Bork! and set the text to [Slap], and output to none. Output none just means it won't generate a speech bubble.
- Set dice roll to 10. This is the minimum number the player must roll to win.
- Click the ProPhys button to auto fill a modifier for a physical check. You can create any math formulas here you want. If you open up the console and type game.players[0].appendMathVars('se_', {}, new gGameEvent({target:game.players[0], sender:game.players[0]})) you can see a list of keywords you can use.
- Connect the left side of the block to the Hello! stage.
- Create a new Goto next to the [Slap] reply. Click it to edit it and add click the "Add Roll Success" button to automatically add the roll success condition.
- Connect the left side to the cyan node of the [Slap] block.
- Create a new stage and link it to the right side of the goto.
- As a text you can add %S slaps %T!
- Create a new stage and link it to the yellow node of the [Slap] reply.
- Add a new text to it like "%S tries to slap %T, but %T is quicker and slaps back!"
- Click in the middle of the stage block to open up its editor. Add the library game action deal3damage. This makes it do 3 damage to the player when they fail the roll.
- Try it out for yourself!

Connecting to a player
Roleplays are always set or started through Game Actions. You can start one in multiple ways just by triggering a GameAction with the type "roleplay" from anywhere in the game. But to connect one to an NPC where you can click the RP box, you'll need an encounter.
- In the roleplay editor, make sure the Player is linked to the player you want to attach the RP to.
- Create a new encounter, or edit an existing encounter with same NPC (see Creating_a_Dungeon).
- Scroll down to Start/passive Game Actions.
- Click Unique to create a unique game action. You can also use a library asset, but this is one of those places where a unique action may be sensible.
- Set the type to roleplay.
- Select the roleplay to the roleplay you created.
- You're done! Note that if you're already in the dungeon that the encounter is attached to, you'll need to run game.setDungeon(game.dungeon.label, game.dungeon.active_room) in the console, or leave and return to the dungeon since dungeons are snapshotted.
Text Extras
- When writing roleplay stage text, wrapping a section of text in square brackets [] will turn the section into an emote, removing it from the speech bubble and making it italic with a smaller font.
- You can set the name/portrait in a roleplay stage to %T to set the portrait to the player who brought you to the stage. You can set it to "none" to hide the portrait/name. You can set it to %P to target the first roleplay player.