Luyren's Cutscene Resource Pack

Luyren

  • *
  • Posts: 1856
This resource pack allows you to script events for your actors. These events include cutscenes, dialog, treasure chests, enemy patterns and any other uses you can think of and script. By script, I mean a sequence of events that can be triggered in order, with a wait time between them. Since they are behaviors, they can be used in multiple actors or specific instances of your actors with different settings and entirely different scripts,  using the same behaviors.

It also has several quality of life behaviors: changing scenes with relative positioning and required keys, saving, in-game time cycles and light simulation, configure controls for both keyboard and gamepad, soundtrack, particles and many others, all integrated with the scripting behavior. This resource pack can be used in any genre or style of game.

There are 35 behaviors in total: 24 actor behaviors and 9 scene behaviors. A sample game's project file will be available as well, showcasing several of the possibilities of this resource pack

This resource pack is made entirely with vanilla Stencyl, no extensions required, and it works in both the public and private builds. It has minimal use of actual written code, relying almost entirely on the regular blocks.

If you've used my miscellaneous behaviors pack, all of them are already included in this pack, but fully integrated with the scripting method and other behaviors.

THIS RESOURCE PACK IS CURRENTLY ONLY AVAILABLE TO SUBSCRIBERS. This is due to a bug in the currently public release of Stencyl that breaks the pack. On the next public release of Stencyl, everyone will be able to purchase this pack. If you are a subscriber, send me a private message here or on the Discord server and I'll give access to the page.

Now let's talk about some of the features, starting with:

Dialog
<a href="https://www.youtube.com/v/nQBeXLuQALY" target="_blank" class="new_win">https://www.youtube.com/v/nQBeXLuQALY</a>
Here you can see the available options to customize, and how the behavior itself looks in the actor's page. Also note that the layout is customizeable: you can have it look entirely different than this showcase.


As a preview of the scripting method, here is the script for that particular dialog (with the actual dialog text cut because of spacing). It stops the player actor, disables its behaviors so it can't move around and shows the dialog, each one with a different preset, before returning control to the player.
Code: [Select]
0|0,0,Set Actor,Player Actor
0|1,0,Manage Behaviors,Disable,Player Control
0|2,0,Set Speed,0,-
0|3,0,Trigger,Actor,All,KillHUD
0|4,0,Set Actor,Self
0|5,0,Set Value,Global,Display,-,Set,0
0|6,0.2,Face Player,Animation,IdleR,IdleL
0|7,0,Dialog,Key Input,[No Sound],[Wait],[No Skip],-,Here you'll see some of the options for dialog display. [...]
0|8,0,Dialog,Key Input,[No Sound],[Wait],[No Skip],Single,You can have the whole dialog in a single window[...]
0|9,0,Dialog,Key Input,[No Sound],[Wait],[No Skip],Sample,You can also configure [...]
0|10,0,Set Value,Global,Display,-,Set,null
0|11,0,Set Actor,Player Actor
0|12,0,Manage Behaviors,Enable,Player Control
0|13,0,Trigger,Actor,All,CreateHUD
0|14,0,Event Index,0,Stop

Next update will be about branching dialog options.

Thanks for reading!

« Last Edit: November 24, 2019, 06:36:56 am by Luyren »
I have my Stencyl behaviors and resource packs available here: https://luyren.itch.io/


Luyren

  • *
  • Posts: 1856
Branching Dialog and Displaying Options
Regarding displaying options, I initially though having the options from the SNES era RPGs would be enough, but some recent games like Dark Souls and Nier Automata had some quality of life features when dealing with options that I wouldn't have paid much attention if I weren't working on this stuff.

The layout is fully customizeable. I forgot to mention explicity in the last post, but just like the Dialog Interface behavior, the background of the options can be automatically resized. It uses a 9-slice behavior to slice an image in 9 pieces and resize it, preventing distortions.

Speaking of the dialog, I didn't show how the special commands are actually used. The parameters for each command cannot contain spaces. Here they are:
Code: [Select]
Interrupt: <i>
Break Line: <br>
Next Box: <n>
Change the drawing speed: <w=X,Y> X is the regular time between letters, Y is the time when you speed up.
Portrait Animation: <p=X,Y> X is the idle animation, Y is the talking animation.
Change Font: <f=FontName> The font's name cannot contain spaces.
Tremble: <t=TrembleRate>
Display Value: <v=Name,Origin,Index/Key,List/Map> you can determine if it's a global value or attribute from behavior, and specify if it's from a list or map.
Format as Timer: <format>
You add these commands at the beginning of the word you want them to happen.

Back to displaying options, you can set an initially highlighted option, or have no option highlighted when they are initially called. You can have one option delegated as the "cancel" option, which you can move instantly to and select by pressing a single button (press once to highlight that option, press again to select it). The cursor slide between the options can be change to be longer or instantly. You have the option to use a different font for the highlighted option and to use or not a cursor.
In the behavior, you configure all the options that actor can call, in "batches." You can then call a range of options individually with the provided custom block. For the option effects, you have a list events, such as play sound, call triggers and set values.

As for a branching dialog script:
Code: [Select]
0|0,0,Set Actor,Player Actor
0|1,0,Manage Behaviors,Disable,Player Control
0|2,0,Trigger,Actor,All,KillHUD
0|3,0,Set Speed,0,-
0|4,0,Set Actor,Self
0|5,0,Set Value,Global,Display,-,Set,0
0|6,0,Trigger,Scene,One,StopTime,Day and Night Cycle
0|7,0.2,Face Player,Animation,IdleR,IdleL
0|8,0,Dialog,Key Input,[No Sound],[Wait],[No Skip],-,Hello again!
0|9,0,Dialog,Complete,[No Sound],[Wait],[No Skip],-,What do you want to talk about?
0|10,0,Call Options,0,3
1/Local Value,Dialog,-,Equal,0|11,0,Dialog,Key Input,[No Sound],[Wait],[No Skip],-,Blahblah
1/Local Value,Dialog,-,Equal,1|11,0,Dialog,Key Input,[No Sound],[Wait],[No Skip],-,Something something
1/Local Value,Dialog,-,Equal,2|11,0,Dialog,Key Input,[No Sound],[Wait],[No Skip],-,It's really hot here.
1/Local Value,Dialog,-,Equal,3|11,0,Event Index,14
0|12,0,Set Value,Local,Dialog,Set,null
0|13,0,Event Index,9
0|14,0,Set Value,Local,Dialog,Set,null
0|15,0,Trigger,Actor,All,StopDialog
0|16,0,Trigger,Scene,One,StartTime,Day and Night Cycle
0|17,0,Animation,IdleL
0|18,0,Set Value,Global,Display,-,Set,null
0|19,0,Set Actor,Player Actor
0|20,0,Manage Behaviors,Enable,Player Control
0|21,0,Trigger,Actor,All,CreateHUD
0|22,0,Event Index,0
Some basics: before the vertical bar are the conditions. After the vertical bar is the "event index" followed by the "wait time." Event index is the order of the events, and wait time is how long you have to wait for the execution of the next event.

This script has extra events to stop and resume the progression of time in the in-game day and night cycle. More importantly you can check how the script handle conditions.
  • Once an actor's script is triggered, it will constantly check for the conditions of the next event. When you select an option, it sets a local value which is then used as a condition to determine the dialog to show.
  • You can see the "Call Options" event calls a specific range of options (from 0 to 3), at event index 10. All the events with index 11 have a condition, so the script won't advance until an option is selected.
  • At event index 13 it loops back to index 9, so the player can select another option. Finally, you'll see the last event with a condition moves to event index 14, which then plays the rest of the script. In-game, that would be the "cancel" option to exit this dialog.
  • At event index 9, the dialog before the "Call Options, you will see it has "Complete" at the beginning of it. This tells the script to only play the next event when this dialog finishes drawing everything.

Next up: changing scenes.

« Last Edit: October 19, 2019, 10:38:38 am by Luyren »
I have my Stencyl behaviors and resource packs available here: https://luyren.itch.io/

Luyren

  • *
  • Posts: 1856
Changing Scenes
Changing scenes might be something too simple to include in a resource pack, but there are two important factors that I worked on that might be worth your attention: relative positioning and open/locked state.

Relative positioning is used with region scene transitions. The most common case would be your actor reaching the edge of the scene. By using relative positioning, the actor's position on the next scene would changed based on where the actor entered the region. Coordinates on the next scene are also based on the bottom of the actor and its X-center, so one value for coodinates would properly work for multiple actors of any size. In a platformer during a horizontal transition, your next scene coodinates would be the ground on the next scene, for example. This resource pack already comes with an actor customized with this, you just place that on your scenes, configure region/next scene/coordinates and you are good to go.

Side note, you might notice that the facing of the actor is preserved when switching scenes. This is one of the features of the saving behaviors included (the actor doesn't use game attributes to store its facing direction), the same behaviors in my miscellaneous pack.

When using doors, you can set their state as open or closed, and you have a list of requirements to change that state, without using a script.
But if you do want to create a script, for more elaborate effects like showing messages to the player:
Code: [Select]
0|0,0,Set Actor,Player Actor
0|1,0,Manage Behaviors,Disable,Player Control
0|2,0,Set Speed,X,0
0|3,0,Set Actor,Self
0|4,0,Set Value,Global,Display,-,Set,0
1/Global Value,Door,List:1,Equal,Open|5,0,Event Index,6
2/Global Value,Door,List:1,Equal,null/Cutscene/Inventory,Key,Equal,0|5,0,Event Index,8
2/Global Value,Door,List:1,Equal,null/Cutscene/Inventory,Key,Greater,0|5,0,Event Index,10
0|6,0,Trigger,Actor,All,ChangeScene
0|7,0,Event Index,15,Stop
0|8,0,Dialog,Key Input,[No Sound],[Wait],[No Skip],-,It's locked.
0|9,0,Event Index,13
0|10,0,Dialog,Key Input,[No Sound],[Wait],[No Skip],-,You used the key.
0|11,0,Trigger,Actor,All,Open
0|12,0,Event Index,13
0|13,0.1,Set Actor,Player Actor
0|14,0,Manage Behaviors,Enable,Player Control
0|15,0,Set Value,Global,Display,-,Set,null
0|16,0,Event Index,0,Stop
In this case, the actor uses the "Change Scenes" behavior to handle the scene and position, and call its trigger "ChangeScene" in the script to use that function of the behavior. It also calls the trigger "Open" to switch the door's state from closed to open.

The "Event Index" event in the script jumps to a specific index. If it has the "Stop" parameter, it stops the execution of the script, requiring a new "activation." Follow the event index numbers and see if you can understand what the script does.

Next up: customizing controls in-game.
I have my Stencyl behaviors and resource packs available here: https://luyren.itch.io/

Luyren

  • *
  • Posts: 1856
Set Controls Part 1
Changing the controls for keyboard and gamepad. You can customize the entire layout of this menu, including using actors as the scrollbar (which are resized using the 9-slice method) and if the menu starts selecting an option or a control to change. The names of the keys and buttons bound to the controls can later be retrieved and used for dialogs or on interaction displayes.

As you can see in the gif, controls are automatically swapped if you use an existing control. One thing that is not shown here is that you can bind multiple game buttons to the same control. In this case, I have the left analog and the d-pad assigned to the direction controls.

There is also what I call a "gamepad translator", that translate the input code of gamepad buttons into whatever text you want. So far I have the values for PS4 and Siwtch Pro Controller values as default. If anyone is interesting in lending a hand, I still need the input codes and the equivalent buttons for the Xbox controllers (360 and One) on the private builds of Sencyl. I'd appreciate if anyone is willing to post those here.

« Last Edit: October 22, 2019, 03:23:25 pm by Luyren »
I have my Stencyl behaviors and resource packs available here: https://luyren.itch.io/

Luyren

  • *
  • Posts: 1856
Set Controls Part 2
I had some ideas to work on, so decided to postpone the Enemy AI script to the next update.

Fun story: A couple of days ago I realized that the nintendo and xbox controllers don't have names for the equivalent of the R3/L3 buttons in a PS4. Usually they show icons to convey that information. So that's what I worked on this afternoon. The animation used is the one you set as the gamepad translated name. Instead of just setting a PS4 controller to display the text "Triangle" you could set it to "PS4Triangle" and have an actor switch to that animation. You individually set which controls you want to display as text or icons in the behavior.

Also, here is a bit more of the behavior:

You can see how you will configure the pre-mapping of gamepads, and the format for the gamepad translator. Entries with a dash will apply regardless of the connected gamepad.

Next time for sure: Enemy AI Scripts
I have my Stencyl behaviors and resource packs available here: https://luyren.itch.io/

Luyren

  • *
  • Posts: 1856
Enemy AI
With the scripting behavior, you can create AI scripts for the actors in your game. In this gif, the actor generates a number, performs a series of events based on the generated numbers and then generates another number, repeating the procees. Of note, the dash attack sets up a collision condition, so the script won't proceed until it detects a collision from the specified side or sensor. You can also see how you can trigger events in one actor by interacting with other actor or elements in your scene. The particles, actor aura and after image behaviors are in action here as well.

This is a good time as any to show the behavior in which you import the scripts.
You can have the scripts starts executing on a key press while colliding with the player, just a collision, entering a region or start activated. You can set a priority to this script, in case you can interact to multiple actors at once, and you can have a key press force a specific event index. That means that you can have a script that does something with one trigger, and something else with a key press. I call them "dual cutscenes" and they can be used for NPCs that do something on their own, and talk to the player when interacted with, for example.

I finished writting the documentation for it yesterday. Still need to make some final revisions and making at least a video for it. Planned release within the next 10 days, if all goes well, and the showcase game will be available to play before that.

Next up: day and night cycle and time-related events
I have my Stencyl behaviors and resource packs available here: https://luyren.itch.io/

Luyren

  • *
  • Posts: 1856
Day and Night Cycle
Majora's Mask is one of my favorite games, and I remember the time cycle had a big impact on me when I first played it in the early 2000s: for the first time I thought about the game world existing beyond me, what with the NPCs moving around regardless of what I was doing, and trying to make it in time for certain events. Persona 5 had the whole time-management aspect that I loved as well. That's why it was a no-brainer for me to implement this.

The options for transitioning between stages of the day include tint screen, fading layers and calling custom events. The effects happen over in-game time, and if you load a scene in the middle of a transition, it will load the correct tint values and layer opacities. There are also a bunch of customization options for the length of the day, a week-like cycle and the possible displays for the clock and day (it can even use the drawing blocks to draw an analog clock). The time of the day is automatically saved on scene transitions and with a trigger as well.
As for the script uses, you can, of course, use the attributes from the behavior to get the time. There is a specific attribute, called _DayProgress, which returns the total time of the day in minutes. This is easier than making separate conditions for hours and minutes. There is also the _ElapsedTime, which is the amount of minutes elapsed since the in-game day time started moving. This is used for timed events, such as if you have a plant growing. There is a specific script conditions that checks for the elapsed time: you can store the time something happened in a global value, and use this condition to check how much time has passed.

I also made a specific behavior that handles moving actors with schedules. If an actor is suppose to walk a path at a certain time and you leave the scene or enter it in the middle of its path, it would just reset to its initial position. With this behavior, you can have that actor move to a point on that path when created, based on how early or late you entered the scene.

Next Up: the sample game

« Last Edit: October 28, 2019, 06:36:36 pm by Luyren »
I have my Stencyl behaviors and resource packs available here: https://luyren.itch.io/

Luyren

  • *
  • Posts: 1856
click the title if the flash player below doesn't work
<a href="http://www.stencyl.com/game/play/41218" target="_blank" class="new_win">http://www.stencyl.com/game/play/41218</a>
This is the sample game that you'll have the option to get, along with the resource pack. By get I mean the .stencyl file, which you can use to test the existing scripts and play around with. It has its own documentation, detailing the scripts and the setups for each cutscene. I tried to showcase here as many features as I could. Play around, see if there's anything that you think might be useful to your games, if you can find any issues, or if you have any questions about it.

Of notice: flash doesn't seem to like the multiple light sources when the screen is tinted. The Windows version has better framerate when that happens.

About the release date
I wanted to have it released either tomorrow or saturday, but two things happened:
  • A bug in Stencyl was found on the importing/exporting of resources. Progress has been made on that front, but a lot of behaviors swap custom blocks on the public Stencyl build (everything works if you fix these swapped blocks). If a new public version of Stencyl is not released relatively soon, I could write documentation specifically to fix what breaks on import (though that's not ideal). Still have to think about that.
  • I have personal matters to attend to for the entirety of next week.

Documentation and the material for the itchio page are pretty much done. There might be a few tweaks left or small features to add to the resource pack, so once I'm back I can put the final touches and see how I'll deal with the import issue.

I'll update this thread when I get back. Meanwhile you can still reach me on the Stencyl discord server, and I apologize for the delay.

« Last Edit: October 31, 2019, 02:29:53 pm by Luyren »
I have my Stencyl behaviors and resource packs available here: https://luyren.itch.io/

Luyren

  • *
  • Posts: 1856
Here is the updated version of the showcase game for the resource pack.

What's new:
  • The player now moves differently. That's because I included the Player Control behavior. You can hold X (default) to run, and the player actor has a falling animation now. Should also fix some animation oddities.
  • The stone in the village that tells the time now offers an option to change the player's color, showcasing the Color Swap behavior.
  • In the time attack scenes, you can see the slope detection and semi-solid platform features of the Player Control behavior.
  • There is a new NPC at the village INN that shows how you can use the scripts to make an actor follow the player. It also has a questline assigned to it, in which you have to give them a certain item.
  • If you finish the thief's questline, it will now drop an item which activates after images for the player. It also shows how you can save actors created at runtime, which can be reloaded when you leave and return to a scene. You can see that by ignoring the dropped item and moving to other scenes. Once you return, it will still be there.
  • Revamped the option to instantly draw the entire dialog text. This option can now be used when you hold a key to accelerate dialog.

All of these and other small bug fixes were possible thanks to the unexpected delay, so it wasn't time wasted. I'm now in the process of revising the documentation, recording gameplay footage for a video and creating the itchio page.

As for release, I've decided to wait for the next Stencyl public version. With the current public build, the custom blocks get swapped all over the place if you import the resource pack, rendering everything useless. I'd have to write specific documentation for each user to fix it on their end, and it would not make for a pleasant experience. I was told that the next Stencyl release will come relatively soon, so I'm counting on that.

What I can do in the meantime, however, is set the itchio page to restricted, and allow only Stencyl subscribers to access it (I'm not that familiar with the "restricted page" feature, but I believe I'd have to do it manually), since the Stencyl private builds already solved the importing issue. At least that way some people can start using it. Let me know here or on the discord server if anyone is interested in that approach. If there is enough demand I'll consider it.

Let me know what you think, if you had any problems or bugs with the game showcase, or your opinion on the restricted release. Once again, sorry for the delay. It's something out of my control, but I'll make sure to use this time to continue polishing this resource pack as best as I can.

« Last Edit: November 24, 2019, 05:52:53 am by Luyren »
I have my Stencyl behaviors and resource packs available here: https://luyren.itch.io/

Luyren

  • *
  • Posts: 1856
I am proud to announce that Luyren's Cutscene Resource Pack is now available for purchase for Stencyl subscribers. It took longer than expected, but the extra time and some serendipity helped me fix bugs that I would've overlooked otherwise.

The pack breaks on b10300, the current public build of Stencyl. This is due to a resource pack importing bug that's been overlooked for a while, involving custom blocks. There is really no satisfactory way around it for now until the next Stencyl release, so making it available for subscribers is the best I can do, since they already have access to a build with that bug fixed. I apologize to all the non-subscribers, and I'll make sure to make the itchio page fully public as soon as the next build drops.

If you are a subscriber, send me a private message here on the forums or on the Discord server, and I'll give you access to the page's link.

Thank you everyone who's read my threads so far and who's shown interest in the pack over its development. For everyone, and now specially all the non-subscribers, thank you for your patience.

Special thanks to:
Justin and AdventureIslands: Justin helped fix issues I had with the Set Controls behavior, as well as all the work he does on Stencyl's development, his works has been invaluable. AdventureIsland playtested that same behavior and has used it in some of their games, also suggesting features that have been included.
airman4/khermann: they requested that I included the above behavior in the pack, and that in turn made me add several features to it, such as the use of icons to show controls.
Fayabella: they've playtested the Day and Night Cycle, Tint Screen and Inventory behaviors, and greatly helped me expand those with features and optimizations I haven't considered.

« Last Edit: November 24, 2019, 07:54:26 am by Luyren »
I have my Stencyl behaviors and resource packs available here: https://luyren.itch.io/

Luyren

  • *
  • Posts: 1856
I've spent today working on my next resource pack, which will be a free RPG Elements pack. It can potentially suffer from the same bug that's preventing a public release of the Cutscenes Resource Pack though, and I'm still running some test on that.

While thinking about how people could integrate it with the Cutscenes Resource pack, I figured it would be best to do that heavy lifting myself. That is why this cutscene resource pack now has an RPG Variant. When you purchase the pack, you get both versions.

So what does it include?
It handles the behind-the-scenes information in RPGs.
Level Progression
Skill Lists
Character Status
Equipment
Combt Statistics
Damage Type and Status Condition Resistance
Difficulty Modes

The user is encouraged to use the provided custom blocks to integrate them into their games.

Of note, there is the "Charge" behavior. It allows your actor to charge, like in games like Megaman X, Super Metroid and Secret of Mana. You can specify several charge type, different maximum levels for each ones, and events for each charge level on hold and release, during charge and at max level.

TLDR: If you've already purchased the cutscenes resource pack, you just have to redownload it to get this update.  For people interested only in the free RPG Elements pack, updates to come soon.
I have my Stencyl behaviors and resource packs available here: https://luyren.itch.io/

squeeb

  • Posts: 1560
Sweet!
Level progression.  Like experience points?  Will there be different algorithms you can choose from? 

Luyren

  • *
  • Posts: 1856
Sweet!
Level progression.  Like experience points?  Will there be different algorithms you can choose from? 

Yes. You can manually set each individual experience requirement, or you can apply an automatic progression. You can also mix and match: input manually values up to a certain value, and the behavior can complete the rest based on the automatic progression selected. The attribute for that reads:
Code: [Select]
Sets an automatic attribute progression. The Required EXP list will be filled starting from the last item you set in it.
No Progression: won't use an automatic progression.
Fixed: always the same amount of experience for each level.
Arithmetic: the required experience increases by Experience Growth each level.
Geometric: a progression found by multiplying the required experience by Experience Growth in each level. The value to start the progression cannot be 0 in this case.
Fixed would be like in Final Fantasy VIII, in which you always needs 1000 EXP to level up.
Geometric makes some ludicrous experience point requirements in just a few levels. I don't know if that will ever be used, but the option is there.

This will be in the free RPG Elements pack, I'll post about it soon. As to how it's integrated into the Cutscenes Pack, you have scripting events to give experience to an actor, and also the option for item pick ups to give experience, for example. Finally, you can reference the experience behavior's attributes when setting up conditions, allowing you to have scripts that require an actor to be a certain level, for example.
I have my Stencyl behaviors and resource packs available here: https://luyren.itch.io/