Good day, dear forum users. Please help, I’m a total newbie. The question is too dumb and simple, but I can’t find an answer to it.
How can I make one of several actions be performed? That is, as in programming, the “OR” function. For example, action 1 or action 2 will be executed.
I can’t do it in an expression, only integral functions are accepted there.
I will describe my example. An object falls on the character. It is necessary that his health is replenished by 1 or 2 points. How to implement it?
Or, for example, I would like something else. For the character to either die or stay alive. How to implement this “OR”?
I solved my issue. Through structure. I just take a random variable in the desired array through random.
But maybe someone else knows a similar way? I don’t know if they are needed though.
For example, I did this:
Are you predetermining whether it should be increased by 1 or 2 points? Or are you wanting to randomly decide?
If so, you could just use the “RandomInRange()” expression. You’d set up an event with whatever conditions you want, then choose the “Change the value of a Variable” action (or object variable, or global variable, however you’re set up), then you’d use the expression builder button (blue button on the right of the field) to find the Random In Range expression. Set the first expression parameter to 1, and the second parameter to 2.
That way it’ll randomly choose between 1 or 2 whenever the event is called. No need for arrays or anything like that.
Thank you very much for your help!
At first I did not understand your message in all subtleties, did not understand the meaning. But then I myself, in the process of another task, realized everything, and realized that this is what you meant.
Excessive arrays and structures are really not needed, especially in my task.