I’m going to chime in and expect the same base as @ArcanaXXI with the Global Health pack position Array, due to this and me being lazy I couldn’t test the Code though.
variables
{
global:
0: HealthPacks
2: TeamAffiliation
player:
0: HackedHPs
1: HPHackDuration
2: NextHacked
}
rule("Rule 1")
{
event
{
Ongoing - Each Player;
All;
Sombra;
}
conditions
{
Is Firing Secondary(Event Player) == True;
Is In View Angle(Event Player, First Of(Sorted Array(Filtered Array(Global.HealthPacks,
Global.TeamAffiliation[Index Of Array Value(Global.HealthPacks, Current Array Element)] != Opposite Team Of(Team Of(
Event Player))), Distance Between(Event Player, Current Array Element))), 15) == True;
Is In Line of Sight(Eye Position(Event Player), First Of(Sorted Array(Filtered Array(Global.HealthPacks,
Global.TeamAffiliation[Index Of Array Value(Global.HealthPacks, Current Array Element)] != Opposite Team Of(Team Of(
Event Player))), Distance Between(Event Player, Current Array Element))), Enemy Barriers Block LOS) == True;
}
actions
{
Wait(0.650, Abort When False);
Event Player.NextHacked = Index Of Array Value(Global.HealthPacks, First Of(Sorted Array(Global.HealthPacks, Distance Between(
Event Player, Current Array Element))));
If(Array Contains(Event Player.HackedHPs, Event Player.NextHacked));
Event Player.NextHacked = Index Of Array Value(Event Player.HackedHPs, Event Player.NextHacked);
Event Player.HPHackDuration[Event Player.NextHacked] = 60;
Else;
Modify Player Variable(Event Player, HPHackDuration, Append To Array, 60);
Global.TeamAffiliation[Event Player.NextHacked] = Team Of(Event Player);
}
}
rule("Rule 2")
{
event
{
Ongoing - Each Player;
All;
Sombra;
}
conditions
{
Event Player.HPHackDuration == True;
}
actions
{
Wait(0.250, Ignore Condition);
Event Player.HPHackDuration = Mapped Array(Event Player.HPHackDuration, Current Array Element - 0.250);
If(!First Of(Event Player.HPHackDuration));
Skip If(Is True For Any(Players On Hero(Hero(Sombra), Team Of(Event Player)), Array Contains(Current Array Element.HackedHPs,
First Of(Event Player.HackedHPs))), 1);
Global.TeamAffiliation[First Of(Event Player.HackedHPs)] = All Teams;
Modify Player Variable(Event Player, HackedHPs, Remove From Array By Index, 0);
Modify Player Variable(Event Player, HPHackDuration, Remove From Array By Index, 0);
End;
Loop If Condition Is True;
}
}
rule("Rule 3")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Hero Of(Event Player) != Hero(Sombra);
Count Of(Remove From Array(Event Player.HackedHPs, 0)) > Null;
}
actions
{
Skip If(Is True For Any(Players On Hero(Hero(Sombra), Team Of(Event Player)), Array Contains(Current Array Element.HackedHPs,
First Of(Event Player.HackedHPs))), 1);
Global.TeamAffiliation[First Of(Event Player.HackedHPs)] = All Teams;
Modify Player Variable(Event Player, HackedHPs, Remove From Array By Index, Null);
Loop If Condition Is True;
}
}
rule("Rule 4")
{
event
{
Player Left Match;
All;
Sombra;
}
conditions
{
Count Of(Event Player.HackedHPs) != Null;
}
actions
{
While(Count Of(Event Player.HackedHPs) != Null);
Skip If(Is True For Any(Players On Hero(Hero(Sombra), Team Of(Event Player)), Array Contains(Current Array Element.HackedHPs,
First Of(Event Player.HackedHPs))), 1);
Global.TeamAffiliation[First Of(Event Player.HackedHPs)] = All Teams;
Modify Player Variable(Event Player, HackedHPs, Remove From Array By Index, Null);
End;
}
}
Rule 3 & 4
Are simply there to remove the Hacked health packs once the player switches off Sombra / leaves.
The problem is; once the player leaves, if they were the first to hack any on the Health packs that they hacked, and another Sombra hacked it afterwards the Script will leave that HP hacked, the game will remove the hack of said HP.
I don’t know if the game handles it this way too if the first Player to hack the HP switches Heroes.
Rule 1
Determines if the Player hacked a health pack (also not flawless…) the view Angle might need to get adjusted to the View Angle that’s required to hack a target + to make sure that there’s no enemy in LOS that would get hacked first; both things that I didn’t bother adding.
Rule 2
Tracks the hacked health pack hack duration:
it might eat up to 0.249 seconds of each health pack that’s hacked after the first one.
You can lower the interval to reduce the amount of time that’s being eaten at the cost of server load, whatever you need more, accuracy or server stability.