Forum rules - please read before posting.

Is there an action which behaves like a switch for integers?

edited September 2020 in Technical Q&A

Unity Ver: 2019.4.8f1
AC Ver: 1.71.8

I want to do a check on a local integer, and then for different values excute different actions. Obviously this could be done with a few Variable: Checks however I'm always eager to use the least number of nodes if possible.

If this was C# I'd use a switch statement. Does AC have an action that works similarly for integers? A single action that can add outputs for different values?

I realise Variable: Pop Up Switch is a thing, but that's for a variable of type 'pop up'. Is there anything simply for integers?

Thanks.

Comments

  • If you rely on a PopUp instead of an Integer, so that its possible values are fixed, you can use the Variable: Pop-up switch Action to cater for all possible values inside a single Action.

    Otherwise, you could duplicate it and modify it in a custom Action do something similar for Integer variables, so long as you set a "max possible value" field above it first.

  • edited September 2020

    @ChrisIceBox Thanks bud. Having looked at it a bit more, pop-up is fine for now but absolutely a simple integer switch action would be a useful tool to have. I'll have a play around with a custom action some time.

  • Turns out pop-ups are the best thing in the world.

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.