Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Fleece

A dialogue manager for Unity that doesn't fray at the edges. · By KaiClavier

Playmaker Compatibility

A topic by RoniDMC created Feb 23, 2020 Views: 600 Replies: 20
Viewing posts 1 to 19

Hi Kai,

I was wondering if there are any plans to incorporate Play Maker actions for use with Fleece?

Using the editor is very intuitive and setting up if statements and variables I noticed it very similar to how Twine/Sugarcube does it, which also makes for setting those up a breeze. I'm getting a little stuck trying to figure out how to use anything other than a Jumper, however. It looks very code heavy and delving through the example scenes is somewhat daunting. I find that I keep telling myself "I wish i could just get the passage information using a Play Maker action".

If not I understand, but I personally would pay extra for the convenience. I know that you personally didn't create the ones for Super Text Mesh (still love that asset btw.) Until then, I'll continue trying things out in code.

Thanks!

Developer

Hey!


That's a fantastic idea and I'd love to get that support in... but yeah, I don't have experience with playmaker, myself... still, I can give it a look shortly! I'll add it to my to-do list for sure. Fleece doesn't have many moving parts, so making connected actions hopefully won't be too bad...

That'd be really cool! And then hey, you can say it has Playmaker support on the asset page. That usually convinces people to hit that pay button (it does for me, haha). If you don't already have the add-on, I'd totally be willing to buy it for you when you're ready to start looking into it.

Developer

Hey!


So, I gave this a shot, but I'm not too sure if this will work right since I'm coding blind.


First, here's an updated Generic Drawstring class. Since Fleece drawstrings are just objects and not monobehaviours, I think you need to hook into the specific monobehaviour that's being used?


https://pastebin.com/z3Xcbtx8


And here's a playmaker action that hopefully passes a string variable to that drawstring, and tells it to begin at a specific passage:


https://pastebin.com/Z51x1iWc


Finally, here's a continue action:


https://pastebin.com/KaqPqPhu


There's no "make choice" action yet... but I want to see if these work first, and figure out the right way to do it. I'm guessing I'll need to send playmake some boolean to tell it if makechocie() or continue() should be used?

Thanks a lot for taking the time to look into this!

When I added the scripts to my project I got the following errors.


I'm guessing that first handful of errors has to do with something from the original Fleece package  interfering with this new GenericDrawstring, but that last error looks to be Play Maker related.

Developer

Right, that GenericDrawstring is supposed to replace the already-existing one, to allow Begin() to use a string reference to start reading... Try deleting/replacing the original script, I'm curious what the result will be. I'm not sure if playmaer will automatically convert fsmstring to string, or if we'll need to add a manual conversion.

Unfortunately, the Play Maker error by itself breaks the other scripts and I can't access Play Maker to test it out.

Developer

Hm... in that case, on that line that's causing an error, try temporarily replacing "fsmString" with a literal string like "Test" to see if things will compile?

(1 edit)

Seems to compile when a regular String replaces it.

Developer

Ahh... I'm really not sure how Playmaker works, so I'm not too sure what to do from here. I figured fsmString was some kind of public serializable variable that can convert to a string somehow? Maybe... fsmString.value? I'm really not sure, sorry!


I'm going to message a pal thats used playmaker before and see if they know what to do!

If they're willing to help out, they have my gratitude! I might hop over to the PM forums and see if anyone there might be able to lend some insight.

Hi Kai,

I made a post on the official Playmaker forums and the admin there asked to get in touch with you to help get you support for Playmaker. I don't know if this means support in getting actions running or support as in getting you hooked up with the plugin but thought I'd see if you wanted to get in touch in the first place before linking them any contact info.

Developer

Sure, that would be great! Should I message em thru email?

(1 edit)

I can give them the email you have on your site or if you prefer to do it yourself you could reach them at the forums here: https://hutonggames.com/playmakerforum/index.php?topic=21884.0

Developer

I'll reach out to them myself, thanks!

Developer (1 edit)

Okay, got my hands on a copy of playmaker, and here's an updated begin script:


https://pastebin.com/Z51x1iWc


And here's a screenshot of how everything looks:




The string variable being used is just the name of the starting passage, in this instance I'm using the dialogue tree from the visual novel example scene (I renamed the starting passage to "VN_Start")

The playmaker tree I made there is pretty simple and doesn't have choices, I just wanted to make sure the actions worked! Now to figure out how to tell playmaker when to continue/show choices... I think I can use the UnityEvents to control the tree, maybe...

I was still getting the "cannot convert from 'string' to 'Fleece.Passage'" error from before.

I had to update the Generic Drawstring code found in the Sample folder in order to get rid of it. The following was added to the code:

At the top

using System;

Then between Update() and public void IncreaseSelectedChoice()

internal void Begin(string value)
        {
            throw new NotImplementedException();
        }

Since I'm using the STM Drawstring script you provided, one change had to be made in it before it would compile:

[ContextMenu("Begin")]
    public void Begin(string value)
    {
        //start at default passage
        Begin(startPassageRef.passage);
    }

However, after those changes, I was able to take the action you made, change some names around to get it to work with the STM Drawstring mentioned, and voila, the action worked! Using PlayMaker's call Method actions, I was even able to call the Continue functions of the Fleece to get multiple lines of text coming and going.

Thanks a lot for your patience and help! I'd love to see how you get the choices working in PlayMaker if you decide to continue with it. I'm definitely going to take some time and write a 5 star review for this and STM. Honestly, I'm kicking myself that I didn't do it before.

Developer

Ah yeah, all of these actions work with a specific monobehaviour class... So the STMDrawstring and GenericDrawstring are entirely different things since I dropped inheritence and made Drawstring a standalone class. I'll see if there's any way for me to make this work, perhaps an interface might be able to get this working? "IDrawstring" requiring a "GetDrawstring()" method or something. I'll be messing with that this week hopefully!

Developer

Hmm I've been working on this, and I'm having a hard time making this code generic. If the playmaker actions directly influence the Drawstring class, and not the monobehaviour containing them, then it's up to the playmaker user to basically make their own monobehaviour using playmaker... I guess that's okay? The whole... Begin drawstring, update text, wait for input system?


Yeah I guess I'm basically just thinking out loud here, but is that an okay end goal?

(1 edit)

I think that's fine since you already provide a Drawstring class that does the basics. Supplying actions for the "out of the box" classes can help get people started faster and easier and if they need more advance features it gives them a solid starting point too. I guess the issue then would be letting people know they're basic features and can be expanded on, then supplying info in the documentation on how to adjust the actions as needed.

Developer

Okay... I think I've got the right things set up for good playmaker actions, I'm just having trouble translating the genericdrawstring.cs class logic into a grid myself to show it off with right now, haha.


If you want, send me an email and I'll send you a new Fleece build along with the new actions! I'll keep working on this.