Okay, so this has been utterly frustrating so far, but what I’m trying to do is create a master Rule which governs a simple YES or NO response for “Is Using Ability 1”.
-Is Event Player (Team 2, Reaper) using Ability 1 == True
+Set Move Speed: 150
-Is Event Player (Team 2, Reaper) using Ability 1 == False
+Set Move Speed: 100
This isn’t the exact code but you get the idea, I’ve got it working when divided into 2 Rules… but with as many rules as I’m going to have in this game mode I simply need to make them more Professional.
If someone can condense this idea into a Simple ON/OFF If Statement, without the need for creating additional Variables or Rules your help would be SO insanely appreciated… because this is driving me nuts.
We dont have the If/Else construct in workshop (the most basic construct in programming, but ok). Instead there is the “skip if” action, wich checks a predicate and, if its true, skips a number of action.
So something like:
if (a == true) then {
do something
} else {
do something else
}
is in workshop:
skip if(not(compare(variable(A), ==, true)), 1)
do something
do something else
If you want it readable as the classic if/else using the not(compare(A, ==, true)) construct is helpful. Otherwise just use compare(A, ==, false).
Yes but don’t make sense, Skip If is something like switch/break in programming languages not like if/else/elseif statements. I think overwatch workshop developers can be inspired in Construct 2 basic script system.
So here’s what I’ve got now, admittedly it still definitely doesn’t work, but at least we’ve got an error to work with.
Condition:
Is Using Ability 1 (Event Player) == True
Actions:
Skip If(Not(Compare(Is Using Ability 1 (Event Player), ==, True)), 1)
Set Move Speed(Event Player, 150)
Skip If(Not(Compare(Is Using Ability 1 (Event Player), ==, False)), 1)
Set Move Speed(Event Player, 100)
ERROR: Conditions Went False, But No Actions Running So Nothing Happens
Admittedly I don’t know much about the functionality of “Compare”, but there really isn’t a whole lot of documentation on it to read up on in the first place.
Hope this helps clear stuff up, thanks for trying mate!
so whenever this rule gets executed, the player is using the ability. That means, that the first skip block will never be skipped and the second always. What you need instead are 2 rules:
rule 1:
condition:
- Is Using Ability 1 (Event Player) == True
action:
- Set Move Speed(Event Player, 150)
rule 2:
condition:
- Is Using Ability 1 (Event Player) == False
action:
- Set Move Speed(Event Player, 100)
Note: Compare() simply resolves a relational statement, such as A < B, etc.
Aaah… so that’s why none of the over 20 different phrasings I tried worked. Well that’s a bit of a bummer, lol.
And yes, that is literally the code that I was using to make it work:
So unfortunately it looks like there just isn’t a way to do this without either Variables OR 2 Rules minimum. At least, not using the simplistic condition “Is Player Using Ability 1” that is.
Why not use a loop if condition is true? It will skip the loop if the condition is not true, meaning the actions behind it wiill take effect.
Action
Wait (Ignore Condition)
Loop If C is true
Revert action
Because your editing a stat value, it shouldn’t overlap.
You ARE a genius! Originally I had thought of using a Loop function after noticing that true “If Statements” weren’t a thing, but figured the ‘looping’ nature of a “Loop” definitely would not work.
I’m still testing the functionality out on this, but the Loop Function is definitely working right now. I’m just curious how much memory it’s using in order to operate, I’ve got my ‘Wait’ at 0.5 seconds, so as to avoid overkilling the system; but I do have to wonder which build is more efficient.
Perhaps the ‘For Loop’ may end up being more expensive on the system when there’s 30-40 lines of it running at once, but then again, maybe not! Since the 2 Rule “YES/NO” setup is theoretically running on a EVERY FRAME basis.