Forum rules - please read before posting.

How to change Options value through actionlist?

I have a cycle element in my options menu that changes the player's perspective between first and third person. This change can also be made by pressing the P button on the keyboard. I would like to know how to make the corresponding option to change also in the options menu when the P button is pressed?

Comments

  • What is the corresponding option? Are you referring to a Global Variable that's linked to Options Data?

    If so, updating the variable - either through Actions or through Menu elements - should update both the variable as well as it's options data value.

    How is the P key input currently read? Best to rely on Active Inputs, as you can configure when such inputs are read, i.e, during gameplay, when paused etc. Active Inputs can be used to run ActionLists that e.g. change the Options-linked variable's value.

  • The button in the options menu and the P key (using active input) runs the same actionlist which alternates between two values.

    Now when I press the button in the options menu, it requires two clicks to change the perspective but now the values are the wrong way around (Character is in third person while the menu says first person)

    In the actionlist I check the value, change the player, the movement method, and the camera, and set the variable to the correct value.



  • The variable is linked to Options Data, so changing its value will update the Options automatically. Though, you'll want to run the PerspectiveChange ActionList when your game begins - if not already.

    Can you share a screenshot of the PerspectiveChange ActionList?

  • It's weird, I was wondering if the game being paused has some effect on it?

    Not entirely sure if I'm doing something wrong, here is the actionlist.

  • I think I see the issue.

    The Cycle element, which is linked to the PerspectiveToggle variable, will update the variable's value automatically before the ActionList is run.

    The ActionList shouldn't be updating the value itself - only reading it - and the value should be assumed to have changed beforehand. That is, the initial Variable: Check Action should cause the "Movement method" to change to Direct if the value is True, and First Person if the value is False - not the other way around.

    If you want to run these same Actions as a result of hitting an input outside of this Menu, have it run a separate ActionList that merely checks the variable's value, and runs one of two Variable: Set Actions to toggle it between True and False. Then, have it use a ActionList: Run to run the above ActionList, which should only deal with the effects of the variable's value once changed.

  • Ah! I should have thought of that. Thanks Chris, works perfectly now!

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.