TL;DR: So lately i’ve been updating alot of my Rules for a game i’ve been working on since Workshop Launch. Alot of these rules i was able to condense down &/OR Add To them because of New actions that have been added to the Workshop & my own knowledge of how to scrip has improved. However I run into this problem w/ alot of my Rules, and while it works just fine, I have to image it’s Server intensive to execute, especially when several Rules w/ the same structure can be launched at the same time by various players. SO…
My question is:
Is there a way to modify Specific Indexes OR Elements in an Array, without looping through the array and modifying 1 Index/Element at a time?
For Example, as of right now, I have “these” rules structured like so:
Example 1: Lucio Boop (Boop enemies further based on how close they are to Lucio when Soundwave is triggered (M2))
Rule: Player Delt Damage
Modify Player Variable(Event Player, A, Append To Array, Victim);
Event Player.B = Mapped Array(Event Player.A, Distance Between(Event Player, Current Array Element));
Wait(0.060, Restart When True);
While(Event Player.C < Count Of(Event Player.A));
Apply Impulse(Event Player.A[Event Player.C], Facing Direction Of(Event Player), 50)
/ Event Player.B[Event Player.C], To World, Incorporate Contrary Motion);
Wait(0.016, Ignore Condition);
Event Player.C += 1;
End;
Event Player.Cooldown[2] = 10;
Wait(2, Ignore Condition);
Event Player.A = Empty Array;
Event Player.C = 0;
I use Var C as the Index I want to select. Apply an Impulse to That player in the selected Index by the distance That player is from Lucio, then Modify var C by 1 (To get to the next index of the array), And Loop if Var C is less then the count of elements in the array. The result is Each player caught in the array is booped a different distance based on how close they are to Lucio.
Example 2: Cooldown Timer (modify Var Indexes by 1 until they reach 0)
conditions
{
Is True For Any(Event Player.Cooldown, Current Array Element > 1) == True;
}
actions
{
Wait(1, Ignore Condition);
Skip If(Event Player.Cooldown[0] == 0, 1);
Event Player.Cooldown[0] -= 1;
Skip If(Event Player.Cooldown[1] == 0, 1);
Event Player.Cooldown[1] -= 1;
Skip If(Event Player.Cooldown[2] == 0, 1);
Event Player.Cooldown[2] -= 1;
Loop If Condition Is True;
Event Player.Cooldown = Null;
}
}
Since you can’t chase an Index, i simply modify an Index by 1, wait 1sec, then loop IF that Index is greater then 0.
As i said, Both these rules work flawlessly, but because of the looping element in each rules (Specifically the Lucio one & all other’s like that) I have to image they are resource hogs.
Is there a way where can modify the entire array at once, But each index individually based on a condition?
Thanks for looking. Sorry for the long read. Im hoping i gave enough detail to understand what im trying to accomplish.
. And yeah nothing to add especially here from my side. The loop operations within an action list might it be a for/while or any associative loop perform really well, when you have a clear and determined vision of what the outcome might be for your modes, the loops are just fine for a couple of linear interpolation by your own if you wanna modify even multiple values over time/at rate and at one frame/at once, so you don’t need to rely on Chasing Operations for intensity variancy that heavily.