This thread contains questions and answers from the discord chat.
I'm copying them here to make it easier for others who might have the same questions.
A Nifty 2D Adventure Toolkit for Unity · By
How do you show another dialog list when already in a dialog? Like when a character asks you a question, and you want the player to pick an option?
Edit: This topic is also covered in this video:
There's 3 ways of doing this, depending how much you want to add in the editor, and how much in code.
The First is to simply make a second DialogTree, set it up, and start the second dialog when you want. using D.SecondDialog.Start();, or Goto(D.SecondDialog);. Then to switch back, D.FirstDialog.Start();, or GotoPrevious(); This is best for big long dialogs with lots of options.
The Second is shown in the demo game. If you select the dialog "ChatWithBarney", there are three Options that have "show" left unticked. These aren't visible until the player clicks Option 2, and asks about the forest.
Inside that script you can see that all the regular Options are turned off, and the forest ones are turned On.
Dave: What's with this forest anyway? Barney: Whaddaya mean? OptionOff(1,2,3); OptionOff("bye"); OptionOn("tree","leaf","forestdone");
Then, the "Enough about forests" option turns the regular options back on again.
OptionOff("tree","leaf","forestdone"); OptionOn(1,2,3); OptionOn("bye");
This is where OptionOffForever comes in handy, since sometimes you don't want options to come back on when you return to the first list of questions
The Third is a quick way of doing simple choices purely in-code, called "Inline Dialog Options".
This way, you don't have to add the options to the editor at all, and is best when it's a one off quick-prompt.
Use the E.WaitForInlineDialog
function to show a user the options, then check the result with E.InlineDialogResult
(function documentation here).
Eg.
Barney: You fight like a dairy farmer! E.WaitForInlineDialog("How appropriate, you fight like a cow", "I am rubber, you are glue", "I'm shakin' I'm shakin'"); if ( E.InlineDialogResult == 0 ) { Dave: How appropriate, you fight like a cow LoseSwordFight(); } else if ( E.InlineDialogResult == 2 ) { Dave: I'm shakin' I'm shakin' WinSwordFight(); }
Can you give tips on best usage of WalkToClicked/FaceClicked shortcuts vs being more explicit.
Characters, hHotspots and props have a "WalkTo" and "Look At" point you can drag around in the scene view.
WalkToClicked just walks to the "WalkTo" point of whatever you clicked on. Then LookAtClicked faces the character towards it (relative to their pivot point which should be at their feet.). Mostly when you click something, that's the thing you want them to walk to, so that's why there's an explicit shortcut command for it.
When I change room text saying "The Quick Brown Fox.." shows up
This is a bug I should fix, but you can work around it by putting the code Consume at the end of the script (instead of End)
The reason it happens is because changing the room doesn't "block" the script, so the engine thinks the interaction didn't do anything. Then it brings up the "you cant use that" line which gets busted when the room changes. Consume will tell the engine that the script DID do something.
Can I make it so the inventory item doesn't stay selected after using it on something?
You can use
I.Active = false;
at the end of each UseInv script, and UnhandledUseInv
To do it automatically is a bit trickier:
Something like this in the global script might do the trick:
in the header, add a variable:
bool m_invClick = false;
in OnMouseClick, add this under the comment: // Left click with active inventory, use the inventory item
m_invClick = true;
Then in UpdateBlocking
if ( m_invClick )
{
I.Active = null;
m_invClick = false;
}
How would I flash the inventory menu after adding a new item?
This is a bit advanced to set up, but the GuiDropDownBar component has a "HighlightForTime()" function, that brings the bar down for however long you specify
To access that in quest script you can do :
G.Inventory.Instance.GetComponent<GuiDropDownBar>().HighlightForTime(2);
You could add a public function to global script to call when you want to do this.
If you want to make it flash, you'll have to do some more custom code in global script, or add your own component to the gui that does it. (maybe just sets visible on/off on a timer repeatedly)
I’m curious how to approach animating a walkable area, i.e. what if you had a moving background or foreground that affected where the character could be walking? Want to learn more about animation syncing as a well which I glanced at in another post
Proper dynamic object avoidance is on my to-do list (so characters walk around each other). But at the moment you can:
void AnimRegionOn(string regionName)
{
R.Current.GetRegion(regionName).Walkable = false;
//note you'd also probably want to set other regions to walk able here too maybe
}
How does versioning work with PowerQuest? (Eg. Github, SVN)
It's the same as any unity project. So follow any tutorial you find on that subject.
But basically, you just need the Assets, ProjectSettings, and Packages folders, ignore the rest. (same if you just want to back up your project)
Also in Project Settings, make sure Version Control mode is set to "Visible Meta Files" and Asset Serializeation is set to "Force Text"
I can't see my character in a room
First, cCheck you set the baseline for the background, it should be at the top of the screen, so the character is always in front of it.
If it's not the player character, check you set their "room" in their data, to the name of the room they should be in. (or in the room's OnEnterRoom function, add C.MyCharacter.Show(); )
I have an invisible Dialog Tree/Character/etc!
This is a known issue, happens sometimes. Possibly unity bugged out or you deleted a prefab with-out using the powerquest interface.
To fix it, you need to:
1. Select the PowerQuest prefab (from Tools menu)
2. Change inspector to "Debug" mode
3. Scroll down to Character Prefabs/Dialog Tree Prefabs and remove the empty one, or drag in the correct prefab.
4. Then change the inspector back to Normal mode.
Is there a way to scale the character down as he moves up on the screen? Or tint a character when they're in a certain spot?
How do I start a new empty project rather than using a template?
You don't need to! It's easier to change or delete what's there, once you've started adding your own content. That way you always have a working project.
How do I change the camera size? I tried to change it on the camera, but when I hit play it has no effect.
I have an inventory item (a hook) that's used on another inventory item (a rope), how do I let players do it both ways around? (Use hook on rope, OR rope on hook)
The engine actually tries both ways around. If one does nothing, it tries the other. But for this to work, you need to check against the 'item' variable that's passed to the function, rather than checking against the active inventory item.
Eg: If this is in the Rope's 'Inv' function it will work both ways.
if ( item == I.Hook ) { Display: You combine the hook with the rope to make a grappling hook. I.GrapplingHook.Add(); thisItem.Remove(); // In this case, the 'thisItem' variable is the Rope item.Remove(); // In this case, the 'item' variable is the Hook }