Updating an Adventue Creator Inventory before Ending the Conversation

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
CodePrincess
Posts: 111
Joined: Thu Sep 27, 2018 11:06 pm

Updating an Adventue Creator Inventory before Ending the Conversation

Post by CodePrincess »

Evening, everybody!

So, Sis is loving this [item name].Count approach for updating an Adventure Creator inventory; It's so easy!

I was just wondering, is there a way to have the added item show up in the inventory before the conversation ends?

I'm using 1.71.7, Unity 2019.4.0f1 and Pixel Crushers' Dialogue System for Unity v 2.2.7, if that helps.

Thank you for your time and three cheers for Pixel Crushers! :-D
Thank you so much for your help.

Oh! My stats!
Unity 2020.1.10f1
Adventure Creator 1.72.2
Dialogue System for Unity 2.2.12
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Updating an Adventue Creator Inventory before Ending the Conversation

Post by Tony Li »

Hi!

The Dialogue System Extras page has an updated Adventure Creator integration package. It's in the "Updated for 2.2.8" foldout, but it works fine with 2.2.7. The "Updated with 2.2.8" wording just means that it was updated after 2.2.8 was released.

The updated package adds two Lua functions: SyncACToLua() and SyncLuaToAC(). You can use SyncLuaToAC() to have the added item show up in the AC inventory before the conversation ends. To add the Lua function, click the Script field's "..." menu and select Custom > AC > SyncLuaToAC. Then click Apply. Or just type "SyncLuaToAC()" manually into the Script field.
CodePrincess
Posts: 111
Joined: Thu Sep 27, 2018 11:06 pm

Re: Updating an Adventue Creator Inventory before Ending the Conversation

Post by CodePrincess »

Oh, perfect! :D

It's... saying the Lua commands haven't been registered?

I tried faking a script for that, but it didn't seem to take.

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DialogueACUpdateCommands : MonoBehaviour
{
    private void OnEnable()
    {
        PixelCrushers.DialogueSystem.Lua.RegisterFunction("SyncACToLua", this, typeof(
            DialogueAnimatedGifCommands).GetMethod("SyncACToLua")); // orig. typeof(GifManager)
        PixelCrushers.DialogueSystem.Lua.RegisterFunction("SyncLuaToAC", this, typeof(
           DialogueAnimatedGifCommands).GetMethod("SyncLuaToAC"));
    }

    private void OnDisable()
    {
        PixelCrushers.DialogueSystem.Lua.UnregisterFunction("SyncACToLua");
        PixelCrushers.DialogueSystem.Lua.UnregisterFunction("SyncLuaToAC");
    }
}
What do you think I should try next?
Thank you so much for your help.

Oh! My stats!
Unity 2020.1.10f1
Adventure Creator 1.72.2
Dialogue System for Unity 2.2.12
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Updating an Adventue Creator Inventory before Ending the Conversation

Post by Tony Li »

Hi,

Does your AdventureCreatorBridge component contain an Awake method that looks like this?

Code: Select all

private void Awake()
{
    if (!areLuaFunctionsRegistered)
    {
        areLuaFunctionsRegistered = true;
        Lua.RegisterFunction("SyncACToLua", this, SymbolExtensions.GetMethodInfo(() => SyncAdventureCreatorToLua()));
        Lua.RegisterFunction("SyncLuaToAC", this, SymbolExtensions.GetMethodInfo(() => SyncLuaToAdventureCreator()));
    }
}
If not, please try importing DS_AdventureCreatorSupport_2020-07-29.unitypackage again.
CodePrincess
Posts: 111
Joined: Thu Sep 27, 2018 11:06 pm

Re: Updating an Adventue Creator Inventory before Ending the Conversation

Post by CodePrincess »

Private Awake() wasn't in there. Should I add the script you posted?
Thank you so much for your help.

Oh! My stats!
Unity 2020.1.10f1
Adventure Creator 1.72.2
Dialogue System for Unity 2.2.12
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Updating an Adventue Creator Inventory before Ending the Conversation

Post by Tony Li »

Yes, please download that unitypackage and import it. It contains an updated bridge script that contains that Awake method.
CodePrincess
Posts: 111
Joined: Thu Sep 27, 2018 11:06 pm

Re: Updating an Adventue Creator Inventory before Ending the Conversation

Post by CodePrincess »

If not, please try importing DS_AdventureCreatorSupport_2020-07-29.unitypackage again.
...How'd I miss that line. How embarrassing.

Okay, I'm downloading the unity package... and everything fixed!
Thank you so much!
Have a good day, Tony!
Thank you so much for your help.

Oh! My stats!
Unity 2020.1.10f1
Adventure Creator 1.72.2
Dialogue System for Unity 2.2.12
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Updating an Adventue Creator Inventory before Ending the Conversation

Post by Tony Li »

You too!
Post Reply