Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

PowerQuest

A Nifty 2D Adventure Toolkit for Unity · By Powerhoof

Questions and Answers from the Discord

A topic by Powerhoof created Feb 22, 2021 Views: 712 Replies: 18
Viewing posts 1 to 19
(2 edits)

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. 

How do make music/ambience loop?

There's a loop tickbox in the audio cue itself, tick that.

(2 edits)

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)

Figured it how to adjust the menu sizes/position but wasn’t able to resize inventory items width? 

The 'Grid' object inside GuiInventory prefab has the "cell size". It's just using unity's gui implementation for that for now.

 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:

  • Add multiple "Regions"
  • Untick "enabled" on them.
  • Add some code in your room's Update function that turns on/off the "Walkable" property at appropriate times. When "Walkable" is false, the player will avoid the area.
  • You could use animation events if it's tied to an animation. Like create an event called SetRegion, with a string for the region name, then in the room add:
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(); )

My room sprites don't show up

You might need to create animations for them. Right click on the sprite and click 'create anim from sprites'

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.

(2 edits)

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?

  • Yep, first create a Region in the Room, and set the area (where the player will stand with their feet)
  • Then in it's "Data" in the inspector, set the Scale Top to the scale you want at the top of the region (eg: 0.5x) and Scale Bottom to what you want at the bottom (eg: 1.5x).  
  • In the same place can also set the Tint for the character when in that region (Set the amount of tint by changing the alpha of the color)

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.

  • To change the player character, click to the left of the character in the powerQuest editor, and drag it to the top of the list. 
  • To change the starting room, set your player's 'room' to your new room,  (or edit the title screen script to go to your own room instead of the forest one).
  • Then, to remove existing rooms, characters, inventory, and dialog trees from  your project, right click the item in the PowerQuest editor, and click 'Delete'.
  • Audio cues/clips can be deleted from the project window.
(4 edits)

Why is my character (or room) all wobbly? It looks fine in the scene view, just not in-game.

Images you import need to have a resolution divisible by 2, so they can be centred on a pixel.

To fix it, make sure your image's height and width are both an EVEN number of pixels.

(1 edit)

How do I change the camera size? I tried to change it on the camera, but when I hit play it has no effect.

  • Changing the orthographic size on the camera only effects the preview window. (Though you probably still want to do that too). 
  • To change it for the game: In Tools->Powerquest Project Settings, under Project Setup, set "Vertical Resolution". 
  • To override it for a specific room, you can select the room, and in it's inspector, under change the "Vertical Resolution".
  • If you want to scale your gui camera & canvas, you set the Gui Camera prefab's orthographic size. And also the canvas size within that.  There's a section in the pdf manual if you need more info.
(1 edit)

When my character starts walking their animation gets stuck while they continue to move.

You need to set the walk animation to be looping. Open PowerSprite Animator, select the animation, and tick the "Looping" tickbox on the right.

(1 edit)

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
}