Forum rules - please read before posting.

Tip: Assign variable presets at runtime

This might be old news to some, but I just discovered that it's possible to create an actionlist that assigns variables and that this can be run at runtime. This is SO helpful when playtesting different states of your game. Just make your presets, make actionlists that assigns them and while the game is running you can hit the RUN button in the top corner in the actionlist editor. Can't believe I've been using AC for at least 4 years without knowing this :sweat_smile:

Comments

  • You can also click the Bulk assign button in the Variables to assign them at runtime as well!

  • Ah! Even better! Seriously, I can't believe how much great functionality you've put into this asset.

  • More's a-comin'! :)

  • This is indeed hugely helpful and powerful.

    Whilst playtesting the starts and on scene enter states of different parts of the game I think It would also be really helpful if that "bulk assign" button worked in the editor too.

    That would allow me to quickly set all the variables to a particular setting BEFORE I pressed the play button, and before the current start scene action runs.

    Any chance of this as a feature update? Or is there a global "on editor play action" that runs before any other action that i could trigger the preset?

    Cheers
    Andi

  • Updating values via preset in the Editor would cause their default values to be overwritten. It could be done via a custom Editor script, but for safety I feel this is probably avoided officially.

    What you can do, however, is assign your preset in your "ActionList on start game" asset file, which can be assigned at the top of the Settings Manager. This will be run before the OnStart cutscene in your game's opening scene.

  • edited October 2020

    Thanks @ChrisIceBox , as always a great explanation and a perfect alternative solution.

    Thanks!

  • Hi, I tried going through the manual about Variable Presets, but I'm still a bit lost. Please bear with me as I'm still learning.

    Could you help me understand how to set up and play Variable: Assign preset ActionList during runtime?

    From what I gather, it seems I can set up a sequence of actions to adjust multiple Global Variable values during runtime, rather than doing it manually. How can I go about setting up these sequences? (Where would I connect the Variable: presets within the ActionList Editor?)

    And about the 'Bulk-assign' feature: I've set up multiple presets, but when I click on 'Bulk-assign', it seems to only apply the preset that's currently visible in the AC Game editor. Am I missing something?

    Thank you so much for your help!

  • A preset allows you to assign the values of all Global or Local Variables in one go. It's typically used when testing, and you want to set your variables to a state that they'd be in at a certain point in the game (i.e. when beginning a new chapter in the story).

    The Variable: Assign preset requires you to first define a preset in the Variables Manager. Once a preset has been defined, you can select each Variable and assign that preset's value.

    The Bulk-assign button essentially does the same thing as the Variable: Assign preset Action. It'll apply the selected preset value to each variable, and is just a convenience tool to avoid having to run the Action when testing in the Editor.

  • Hi Chris, thanks for your reply. Let's say I've created multiple presets: value0, value1, value2, and value3. If I select 'value1' in the 'Created Presets' field under 'Preset Configurations', will all the global variables assigned to 'value1' only be triggered when I hit "Bulk-assign" during play? Is my understanding correct?

    As the project grows more complex, this feature seems incredibly useful! Adventure Creator is already fantastic, but the more I learn about it, the more impressed I am. Thank you once again.

  • Don't think of individual presets as singular values - but rather a collection of values.

    For a single preset, each and every Variable will have it's own associated value.

    For example, a Preset named "Chapter Two", intended to set all variables to the state they'd be in when the game's 2nd chapter begins. By this point in the game, a Variable named "Has spoken to Tim" should be set to True, while "Number of levers pulled" should be set to 3. The "Chapter Two" preset would contain both "True" for the first variable, and "3" for the second.

    Once a Preset is created, selecting a Variable in the Variables Manager will let you define that Variable's value for that preset. It's a value unique for that Variable, but a part of the preset.

    When hitting "Bulk-assign", all variables are updated - to their associated value for that chosen preset.

  • Thanks for clarifying that for me, Chris. This feature is absolutely brilliant! It's incredibly helpful. Thank you!

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.