PlayStation Trophies in Naninovel
Posted: 05 Jun 2023 03:55
by Orenn16
Hello!
I'm currently developing a game in Unity using Naninovel, and the plan is to publish the game on PS4/5. I know any questions about PlayStation specific development issues should be done on their forums, but I had an inquiry that's more specific to naninovel that I figured I'd try asking about here.
So I'm trying to add PlayStation trophy triggers to my game and, while the ins and outs of that process I can inquire about on the playstation forums, I was curious where in the Naninovel assets I would find the engine code I should be working with to implement this kind of unlockable? Is it within the editor folder?
I guess what I'm asking is where in Naninovels assets is the code that is running the script itself, where I could place a trigger that would essentially say "when this choice is selected, unlock Trophy"?
I appreciate any help you can provide! Coding is not something I'm super familiar with and naninovel has made this project so much easier, but I still run into issues like this lead me to asking dumb questions like these, haha.
Re: PlayStation Trophies in Naninovel
Posted: 05 Jun 2023 06:42
by idaot
I suggest using custom commands (https://naninovel.com/guide/custom-commands.html#custom-commands) to access the API of the trophy system to perform the desired action. If you got any trophies that require multiple actions then consider using conditional execution (https://naninovel.com/guide/naninovel-scripts.html#conditional-execution).
Re: PlayStation Trophies in Naninovel
Posted: 13 Jun 2023 12:02
by Orenn16
Thank you so much! I’ll give this a go and report back with results. This is the last step before we can submit to publish on PS4 so with any luck this will get us across the finish line!
Thanks again for the reply and helpful info
Re: PlayStation Trophies in Naninovel
Posted: 05 Jul 2023 22:19
by Orenn16
Hello again! Just a quick follow up to this; where do we code these custom commands? Is this done within the main narrative scene/script itself, or is there an engine script I should be pulling up to add this code in? I worked with PlayStation to get a piece of sample code that essentially "initializes" the trophy pack but I'm having the same dilemma there: when working with nani novel I'm unsure if all of my coding should be done in the narrative script where I'm writing the dialog, moving characters, playing music etc, or if there is another script within naninovel that I should be coding these higher level behind the scenes functions such as enabling trophies for the PlayStation platform.
Re: PlayStation Trophies in Naninovel
Posted: 06 Jul 2023 07:37
by Elringus
No coding should be performed in naniscript since it's a DSL designed for scenario writing. All coding should be in C#; see the code snippets in the article and built-in commands in the package for examples.
Re: PlayStation Trophies in Naninovel
Posted: 06 Mar 2024 21:04
by Orenn16
Sorry to bring up an older post, but following up on this, I have the code using the customer commands in a way that looks like this:
using Naninovel;
using Naninovel.Commands;
using UnityEngine;
[CommandAlias("UnlockAchievement")]
public class UnlockAchievement : Command
{
public StringParameter ID;
Code: Select all
public override UniTask ExecuteAsync (AsyncToken asyncToken = default)
{
if (Assigned(ID))
{
Debug.Log($"Unlocked Achievement: {ID}!");
}
else
{
Debug.Log("No ID provided for Achievement!");
}
return UniTask.CompletedTask;
}
}
So my question now would be, where do I place this code in Naninovel within Unity? Does this go in the engine folder? The resource folder? I'm not sure where this goes so that it can be called upon in the script of the game itself. Thanks so much in advance for your help!
Re: PlayStation Trophies in Naninovel
Posted: 09 Mar 2024 02:48
by idaot
The Naninovel folder shouldn't be modified as Naninovel itself may break as a result of it and we cannot provide support for modified packages. As long as it's not located in a Naninovel or Resources folder, the location doesn't matter.