When answer is wrong/right , Destroy platform

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
mmopulencia
Posts: 15
Joined: Tue Aug 07, 2018 2:49 am

When answer is wrong/right , Destroy platform

Post by mmopulencia »

Hi!

I'm making a simple math based game , and wanted to know how i can go about doing this , the answers are chosen based a multiple choice provided, i already got it down on how to make multiple choices and alternate paths to responses , what i kinda need to know is how do i , say for example platform 1 named "plat(1)" to get destroyed when i got the wrong answer so the character would fall down and how do i say for example rebuild platform 1 once ive fallen over it . how do i put that / incorporate it . into the dialogue systems scripts.

lastly is there a way for me to make the script say , after i select an answer , it runs a specific script?


Thank you for your time.
delgelato
Posts: 8
Joined: Sat Aug 11, 2018 11:15 am

Re: When answer is wrong/right , Destroy platform

Post by delgelato »

If you trigger the conversation with DialogueSystemTrigger(DST), and your gameObject is already on the scene, then you can add another DST and set the Trigger to OnConversationEnd to disable the gameobject. Maybe each question is a quest or it sets a variable (set a variable by setting the "Script" section in the dialogue with Variable["variableName"] = true or 1 or a text)
In the Conditions, check that variable is true.

You can also add the Action in the DST to restore the platform OnConversationStart

To run a specific C# script, you have to register it like shown here, then you can add things like GameObjectExists(param) in the Script section of the dialogue.

If your platform is spawned at runtime, it depends on your implementation
User avatar
Tony Li
Posts: 21079
Joined: Thu Jul 18, 2013 1:27 pm

Re: When answer is wrong/right , Destroy platform

Post by Tony Li »

You can also use the SetActive() sequencer command. Here's one way to use it:

1. Make your platform a child of an active GameObject. It can be instantiated at runtime.

2. In the wrong answer, use SetActive() to deactivate and then reactivate the GameObject:
  • Dialogue Text: "Wrong! Down you go!"
    Sequence:

    Code: Select all

    {{default}};
    SetActive(plat(1),false);
    SetActive(plat(1),true)@2
The sequence above does three things:
  • Plays the default sequence defined on the Dialogue Manager. This typically keeps the subtitle visible for a duration based on the text length.
  • At the 0-second mark, deactivates plat(1).
  • At the 2-second mark, reactivates plat(1). This GameObject must be in a hierarchy whose root parent is active; otherwise the Dialogue System won't be able to find it again once it's inactive.
To run a C# script, follow delgelato's advice to register it with Lua.
mmopulencia
Posts: 15
Joined: Tue Aug 07, 2018 2:49 am

Re: When answer is wrong/right , Destroy platform

Post by mmopulencia »

Thank you both for your reply , sorry for the delayed response . Will certainly give this a look.
Post Reply