Forum rules - please read before posting.

Built-in once-only switch for dialog?

Would it be possible to consider adding a once-only switch for dialog options? Rather than using a bool in the actionlist to toggle the dialog, it could perhaps have it's own variable built-in thats linked to it's internal node ID, and just switch that when run the first time. Here's how I'd imagine it as an option (sorry about the bad font matching):

Just a suggestion!

Comments

  • yeah, this is another thing i'd add my vote to, except that i'd suggest that maybe it could go further than just dialogue

    i've actually implemented my own little system to handle this kind of thing - where you only want something (usually, but not just, dialogue) to happen only once, but you don't want to faff around cluttering up the variable list with bools

    it would be a nice feature to have built into AC though

  • @HarryOminous What was your approach?

  • edited January 2019

    @ChrisIceBox

    What I've implemented does a bit more than what @zebbi is asking for, so it's a little more flexible, but at the same time it isn't quite as elegant as the straightforward "Play first time only"

    Anyhoo, what I've done is to create the following:

    1) A "ToggledObject" class, which basically records whether an object's "Toggle" flag is On or Off. (It additionally records whether the object is "Locked" or not)

    2) A "RememberToggleState" derived from AC's "Remember" class, to record the Toggle (and Locked) state for any Saved games

    3) Finally, a "CheckObjectToggle" Custom Action which returns the Toggle state to any ActionList that needs to know it. (Plus a similar "CheckObjectLocked" Custom Action)

    In use, let's say I have the Player character make a smartarse remark when he does something for the first time (initiated by a Trigger). I attach the "ToggleObject" and "RememberToggleState" to the Trigger, and when it's tripped, check if the ToggledState is On. If it isn't I get the Player to make his witticism, and do a SendMessage of "setToggleOn" to the Trigger, and that's all that's necessary for it to only happen the once

    A more complex use case, is that I attach the two Components to many of the doors in my environment. When the Player interacts with the door I check the Toggle state in an ActionList, and that lets me know whether the door is open or closed, thus the Player's action can... open it if it's closed, and close it if it's open. (That's also the reason for the additional "Locked" value, as some doors, and drawers and whatnot will be locked at the start of the game)

    As, here:

  • Seems to me that much of that could be simplified by further use of parameters. If the (in-scene) ActionList had a boolean "Is open" parameter, you could then set/get that instead of the toggle state.

    If so, all you'd then need is a way of saving ActionList parameters, e.g. "RememberActionListParameters".

  • edited January 2019

    Being able to remember ActionList parameters in the way you've described sounds like it might be a pretty neat feature to have, although presumably it could only work for in-scene ActionLists? (The above example is an asset-based ActionList)

    I'm not entirely sure it would fulfill my own use-case requirement either, because I can potentially set the Toggle state of an object from places other than within just the single ActionList shown above

    ...

    It's possibly all going a bit beyond zebbi's original request in any event?

  • I'd considered mentioning a switch such as this for other actions, but I was thinking of starting small 😜 It certainly would be convenient and would help readability by incorporating a few actions into themselves. Dialog would be good because you could have a lot of look-ats that first time have a detailed description, then subsequent times, you could just use the first node.
    All of this is obviously subject to how difficult this might be for Chris to implement! 😁
  • @zebbi's original feature request can be implemented by creating a subclass of ActionSpeech, and adding in the checkbox. I'm not personally convinced of the widespread need for this for an official adaptation.

  • Aww! :'( :D

    I'll probably leave it then, hacking AC is scary, especially when updating!

    If something like this, especially for other relevant actions as well, could be considered for a future update, I think it would be much appreciated! (Especially by me and Harry 😜)
  • hacking AC is scary, especially when updating!

    To be clear, I'm not suggesting a hack. Creating a subclass would mean you'd use your own variant of the Dialogue: Play speech Action, not something that'd be overwritten upon updating.

  • I don't think it would be THAT difficult to write, but if Chris doesn't think it's a feature worth implementing in AC itself, then I'll probably just stick to the Toggle method that I'm already using to handle this kind of situation

    As Chris says, creating a Subclass of the Dialogue: PlaySpeech Action wouldn't interfere with the existing AC Action, BUT there would always be the chance that Chris would make some modifications to AC's Dialogue: PlaySpeech in the future, and you'd then have to remember to modify your own version in line with those changes, otherwise things could get rather confusing

    You'd also need to work out how to Remember the state of the variable that records whether or not the Speech has run yet. Soooo, all doable, but maybe more trouble than it's worth

  • A year on, what would be the most efficient way of a "do once per game" for dialogue (or anything really). Would it be a case of making individual bool variables for everything that would need doing once and setting/checking against the on state?
  • edited December 2019

    There wouldn't really be a "general" way to do anything once-per game, since all systems are separated.

    My main issue with having an official "once per game" option for the speech Action is that it would be tied to the Action itself - and so this would not be incorporated into save game files. Even leaving/re-entering a scene would reset it.

    It may be possible (and I'm only thinking out loud here) to have such an option on the line's entry in the Speech Manager, as there it could be properly recorded.

  • Having it once-per-game speech would be very useful for all those little observation lines that only need to be spoken once. Could it be considered for a future version?

  • I will consider it, certainly.

  • edited December 2019

    Looking at the feat. Req, I agree that having a global "Only once" flag, would de-clutter a lot of actions and object handling.

    E.g.: Trigger once/interact once/run once.

    All the checks could go into a function or interface that checks if the current gameplay object can be run forever, once, or a finite number of times.

    or, it could be wrapped inside a Class ActivationTimes, nested in the class.
    which basically would hold an integer and methods to handle it.

    -1 for infinite
    0 for exhausted/never
    > 0 for finite number

    In the inspector it would be a line with either a dropdown set to "Activates: [always = -1]" to avoid breaking code, and another option would be [Once = 1] or [finite amount], which pops on the right the amount of times the object/gameplay element could be used before going inert.

    Of course this integer needs to be serialised.

    An alternative way would be to have compatible classes check if in the same gameObject there's a "Repeatable" monobehaviour, which handles all the counting, only where actually needed.

    And a "Remember Repeatable" to save that amount, when needed.

    If a compatible class can't find such class, it defaults to -1, or "always"

    Extended version:

    The Repeatable monob. could become a "Conditions" component.
    It could either hold just a number, or define more advanced logic (even custom ones, by extending it)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!