Page 1 of 2
Best way to swap portrait sprites?
Posted: Tue Aug 17, 2021 2:25 am
by mac
Hello Tony!
So I'm using the VN template and I want to find the best way to swap portrait sprites for each dialogue entry. So lets say the first entry I want my character to be in its default 'pose', then second one with his hand behind his head, third with closed eyes. For example, how would I make this like an index that each dialogue entry has its own so I can specify which sprite it should display?
Re: Best way to swap portrait sprites?
Posted: Tue Aug 17, 2021 8:19 am
by Tony Li
Hi,
In the Dialogue Editor's Actors section, assign multiple sprites to the character's Portrait Sprites section. Each one will have an index number (1, 2, 3, ...).
In your dialogue entry Dialogue Text, include [pic=#]
markup tags, where # is the index number. That dialogue entry will use the specified sprite instead of the first one.
If you want to permanently switch to a different sprite, use the
SetPortrait() sequencer command.
Note: If you're using
animated portraits, then use the Animator***() sequencer commands to control the animator instead of using the techniques above.
Re: Best way to swap portrait sprites?
Posted: Wed Aug 18, 2021 12:50 am
by mac
Got it Tony, thank you!
Another question, as I also have Quest Machine and i'm using it, how can I use a dialogue entry to complete a quest step/condition?
- Screenshot_3.png (16.64 KiB) Viewed 1495 times
For instance how do I trigger this message with dialogue?
Re: Best way to swap portrait sprites?
Posted: Wed Aug 18, 2021 10:15 am
by Tony Li
Hi,
To manually change the state of a Quest Machine quest or quest node, in a dialogue entry's Script field use the SetQuestState() or SetQuestNodeState() Lua functions as described on page 12 of the integration's 'Dialogue System Support.pdf' manual. (Import the integration package in Plugins / Pixel Crushers / Quest Machine / Third Party Support to get this Lua function.)
To send a message that a quest node's Conditions are listening for, use the SendMessageSystem() Lua function, such as:
Code: Select all
SendMessageSystem("Completed", "1MeetAudrey0")
After you import the appropriate package, both sets of Lua functions should be available in the "..." dropdown menu, in the submenu named 'Custom', so you don't have to type them in manually. Or you can just type them in manually if you prefer.
Re: Best way to swap portrait sprites?
Posted: Thu Aug 19, 2021 1:50 pm
by mac
Thank you Tony, I guess the function inside the node worked since I got no errors in the console, but my HUD, alert or Journal have not updated. Also, shouldn't the Quest Editor nodes get lit up like the Quest Machine Tutorial videos when my quest is ongoing? I guess my quest is not starting to begin with.
- Screenshot_2.jpg (916.56 KiB) Viewed 1485 times
This is how the Quest Editor and game looks after playing the dialogue that should move my quest to the next node. (Like I said, HUD and Journal did not update, alert did not play.)
- Screenshot_4.png (14.58 KiB) Viewed 1485 times
This is how the quest node (Follow Audrey) that the dialogue line should advance to is set up.
Re: Best way to swap portrait sprites?
Posted: Thu Aug 19, 2021 2:14 pm
by Tony Li
Hi,
Did you give the quest to the player first? (You can use the GiveQuest() Lua function.)
Is the player selected? If you've selected the NPC, the Quest Editor window will show you the version of the quest that's in the NPC's Quest Giver component. Make sure you've selected the player so the Quest Editor window will the (active) version of the quest that's in the player's Quest Journal component.
Re: Best way to swap portrait sprites?
Posted: Thu Aug 19, 2021 5:00 pm
by mac
So, after selecting my player gameobject as you said, this is how the quest editor looks like now:
- Screenshot_6.png (27.66 KiB) Viewed 1482 times
I think I have assigned the quest to the player since you taught how to do it here:
https://www.pixelcrushers.com/phpbb/vie ... 918#p21918
The Quest Editor doesn't change, it stays like that before and after using the dialogue that should advance the quest.
Re: Best way to swap portrait sprites?
Posted: Thu Aug 19, 2021 5:06 pm
by Tony Li
Hi,
That screenshot looks good. The Start node is green, which means it's True (done). The Meet Audrey node is blue, which means it's active, so its Message condition should be listening for the message.
Try temporarily ticking the Quest Machine GameObject's Debug > Debug Message System checkbox. This will log a lot of info to the Console, but it will let you verify whether the conversation is sending the Completed + 1MeetAudrey0 message.
Re: Best way to swap portrait sprites?
Posted: Thu Aug 19, 2021 6:12 pm
by mac
Oh I just realized that the condition was set in the next node and not in the 'Meet Audrey' one, so even though the message was sent, the condition was not there
Everything working as it should now, thank you again Tony!
One small question. I want to customize the animations for the Quest Alert UI popup, and from what I see here, Expand is responsible for bringing the UI in, and Hidden, to hide it, so those are the animations I should edit for customization right?
Re: Best way to swap portrait sprites?
Posted: Thu Aug 19, 2021 8:51 pm
by Tony Li
mac wrote: ↑Thu Aug 19, 2021 6:12 pmOne small question. I want to customize the animations for the Quest Alert UI popup, and from what I see here, Expand is responsible for bringing the UI in, and Hidden, to hide it, so those are the animations I should edit for customization right?
Yes. Or, better yet, assign your own animator controller and animations. That way you won't lose your customizations when you update Quest Machine.