Skip to content

Instantly share code, notes, and snippets.

@AltimorTASDK
Created July 20, 2024 04:34
Show Gist options
  • Save AltimorTASDK/93a7e1ec8a138e082bf57814483f8ba6 to your computer and use it in GitHub Desktop.
Save AltimorTASDK/93a7e1ec8a138e082bf57814483f8ba6 to your computer and use it in GitHub Desktop.
rule("Item - Grappling Hook - Init")
{
event
{
Ongoing - Each Player;
All;
All;
}
actions
{
Chase Player Variable At Rate(Event Player, grappling_hook_cooldown, 0, 1, None);
}
}
rule("Item - Grappling Hook - Fire")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Event Player.item_owned[Global.ITEM_GRAPPLING_HOOK] == True;
Is Alive(Event Player) == True;
Is Button Held(Event Player, Button(Melee)) == True;
}
actions
{
If(!Event Player.grappling_hook_in_use);
If(!Event Player.can_move || !Event Player.can_use_abilities || Event Player.blink_dagger_in_use || Event Player.grappling_hook_cooldown > 0 ||
(Hero Of(Event Player) != Hero(Brigitte) && Hero Of(Event Player) != Hero(Reinhardt) &&
Is True For Any(Filtered Array(
All Living Players(All Teams), Current Array Element != Event Player), Distance Between(Event Player, Current Array Element)
<= 2.500 && Is In View Angle(Event Player, Current Array Element, 90))));
Set Melee Enabled(Event Player, True);
Press Button(Event Player, Button(Melee));
Wait(1, Ignore Condition);
Set Melee Enabled(Event Player, False);
Abort;
End;
Event Player.grappling_hook_in_use = True;
Event Player.magnet_boots_in_use = False;
Event Player.jetpack_in_use = False;
Event Player.grappling_hook_attached_to_map = False;
Event Player.grappling_hook_fire_position = Eye Position(Event Player);
Event Player.grappling_hook_position = Eye Position(Event Player);
Event Player.grappling_hook_fire_direction = Facing Direction Of(Event Player);
Chase Player Variable At Rate(Event Player, grappling_hook_position,
Event Player.grappling_hook_fire_position + Event Player.grappling_hook_fire_direction * 30, 110, None);
Event Player.grappling_hook_distance = 0;
Chase Player Variable At Rate(Event Player, grappling_hook_distance, 30, 110, None);
Create Beam Effect(
Filtered Array(All Players(All Teams),
Current Array Element == Event Player || Event Player.visible),
Grapple Beam, Event Player,
Event Player.grappling_hook_attached_player != Null ?
Ray Cast Hit Position(
Vector(0, 1.2, 0) + Update Every Frame(
Position Of(Event Player) +
Direction Towards(
Position Of(Event Player),
Position Of(Event Player.grappling_hook_attached_player)) *
(Distance Between(
Position Of(Event Player),
Position Of(Event Player.grappling_hook_attached_player)) - 1)),
Vector(0, 1.2, 0) + Update Every Frame(
Position Of(Event Player.grappling_hook_attached_player)),
Event Player.grappling_hook_attached_player, Event Player, True) :
Event Player.grappling_hook_attached_to_map ?
Event Player.grappling_hook_attach_point + Vector(0, 1, 0) :
Event Player.grappling_hook_position,
Color(White), Visible To Position and Radius);
Modify Player Variable(Event Player, grappling_hook_effects, Append To Array, Last Created Entity);
Create Effect(
Filtered Array(All Players(All Teams),
(Current Array Element == Event Player || Event Player.visible) &&
Current Array Element != Event Player.grappling_hook_attached_player),
Good Aura, Color(Yellow),
Event Player.grappling_hook_attached_player != Null ?
Ray Cast Hit Position(
Vector(0, 1.2, 0) + Update Every Frame(
Position Of(Event Player) +
Direction Towards(
Position Of(Event Player),
Position Of(Event Player.grappling_hook_attached_player)) *
(Distance Between(
Position Of(Event Player),
Position Of(Event Player.grappling_hook_attached_player)) - 1)),
Vector(0, 1.2, 0) + Update Every Frame(
Position Of(Event Player.grappling_hook_attached_player)),
Event Player.grappling_hook_attached_player, Event Player, True) +
Direction Towards(
Update Every Frame(Position Of(Event Player.grappling_hook_attached_player)),
Update Every Frame(Position Of(Local Player))) * 0.1 :
Event Player.grappling_hook_attached_to_map ?
Event Player.grappling_hook_attach_point + Vector(0, 1, 0) +
Direction Towards(
Event Player.grappling_hook_attach_point + Vector(0, 1, 0),
Update Every Frame(Eye Position(Local Player))) * 0.1 :
Event Player.grappling_hook_position,
0.05, Visible To Position and Radius);
Modify Player Variable(Event Player, grappling_hook_effects, Append To Array, Last Created Entity);
Else;
If(Event Player.grappling_hook_attached_player != Null);
Event Player.grappling_hook_cooldown = 3;
End;
Event Player.grappling_hook_in_use = False;
Play Effect(Event Player, Buff Explosion Sound, Color(White), Event Player, 50);
End;
}
}
rule("Item - Grappling Hook - Attach to player")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Event Player.grappling_hook_in_use == True;
Event Player.grappling_hook_attached_to_map != True;
Event Player.grappling_hook_attached_player == Null;
Filtered Array(All Living Players(All Teams), Current Array Element != Event Player && !Has Status(Current Array Element,
Phased Out) &&
Is In Line of Sight(Event Player.grappling_hook_fire_position, Current Array Element, Barriers Do Not Block LOS) &&
Dot Product(Event Player.grappling_hook_fire_direction, Position Of(Current Array Element) + Vector(0, 0.800, 0)
- Event Player.grappling_hook_fire_position) <= Event Player.grappling_hook_distance + 1.250 && Array Contains(
Players Within Radius(Event Player.grappling_hook_fire_position - Vector(0, 0.800, 0)
+ Event Player.grappling_hook_fire_direction * Max(Dot Product(Event Player.grappling_hook_fire_direction, Position Of(
Current Array Element) + Vector(0, 0.800, 0) - Event Player.grappling_hook_fire_position), 1.250), 1.250, All Teams, Surfaces),
Current Array Element)) != Empty Array;
}
actions
{
"Perform radius check from closest point on line of travel"
Event Player.grappling_hook_attached_player = Sorted Array(Filtered Array(All Living Players(All Teams),
Current Array Element != Event Player && !Has Status(Current Array Element, Phased Out) && Dot Product(
Event Player.grappling_hook_fire_direction, Position Of(Current Array Element) + Vector(0, 0.800, 0)
- Event Player.grappling_hook_fire_position) <= Event Player.grappling_hook_distance + 1.250 &&
Is In Line of Sight(Event Player.grappling_hook_fire_position, Current Array Element, Enemy Barriers Block LOS) &&
!(Hero Of(Current Array Element) == Hero(Genji) && Is Using Ability 2(Current Array Element) &&
Dot Product(Event Player.grappling_hook_fire_direction, Facing Direction Of(Current Array Element)) < 0) &&
Array Contains(
Players Within Radius(Event Player.grappling_hook_fire_position - Vector(0, 0.800, 0)
+ Event Player.grappling_hook_fire_direction * Max(Dot Product(Event Player.grappling_hook_fire_direction, Position Of(
Current Array Element) + Vector(0, 0.800, 0) - Event Player.grappling_hook_fire_position), 1.250), 1.250, All Teams, Surfaces),
Current Array Element)), Distance Between(Position Of(Current Array Element) + Vector(0, 0.800, 0),
Event Player.grappling_hook_fire_position + Event Player.grappling_hook_fire_direction * Dot Product(
Event Player.grappling_hook_fire_direction, Position Of(Current Array Element) + Vector(0, 0.800, 0)
- Event Player.grappling_hook_fire_position)))[0];
If(Event Player.grappling_hook_attached_player == Null);
Event Player.grappling_hook_in_use = False;
Play Effect(Event Player, Debuff Impact Sound, Color(White), Event Player, 50);
Abort;
End;
Start Accelerating(Event Player, Direction Towards(Position Of(Event Player), Position Of(
Event Player.grappling_hook_attached_player)) * 44 - Velocity Of(Event Player), Min(Magnitude Of(Direction Towards(Position Of(
Event Player), Position Of(Event Player.grappling_hook_attached_player)) * 44 - Velocity Of(Event Player)) / 0.016, 120), 44,
To World, Direction Rate and Max Speed);
Event Player.move_speed = 2300;
Call Subroutine(update_move_speed);
Start Facing(Event Player,
Update Every Frame(Direction Towards(Event Player, Event Player.grappling_hook_attached_player)),
300, To World, Direction and Turn Rate);
Start Forcing Throttle(Event Player, 0, 0, 0, 0, 0, 0);
Disallow Button(Event Player, Button(Secondary Fire));
Disallow Button(Event Player, Button(Primary Fire));
Disallow Button(Event Player, Button(Crouch));
Disallow Button(Event Player, Button(Ability 1));
Disallow Button(Event Player, Button(Ability 2));
Disallow Button(Event Player, Button(Ultimate));
Disallow Button(Event Player, Button(Melee));
Disallow Button(Event Player, Button(Jump));
Disallow Button(Event Player, Button(Reload));
Disallow Button(Event Player, Button(Interact));
Event Player.gravity = 0;
Call Subroutine(update_gravity);
Damage(Event Player.grappling_hook_attached_player, Event Player, 30);
Play Effect(Event Player, Buff Impact Sound, Color(White), Event Player, 50);
}
}
rule("Item - Grappling Hook - Detach from player if took too long")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Event Player.grappling_hook_in_use == True;
Event Player.grappling_hook_attached_player != Null;
Event Player.grappling_hook_melee != True;
}
actions
{
Wait(3, Abort When False);
Event Player.grappling_hook_in_use = False;
}
}
rule("Item - Grappling Hook - Detach from player if stuck")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Event Player.grappling_hook_in_use == True;
Event Player.grappling_hook_attached_player != Null;
Event Player.grappling_hook_melee != True;
Speed Of(Event Player) < 1;
}
actions
{
Wait(0.500, Abort When False);
Event Player.grappling_hook_in_use = False;
}
}
rule("Item - Grappling Hook - Melee player when close enough")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Event Player.grappling_hook_in_use == True;
Event Player.grappling_hook_attached_player != Null;
Distance Between(Position Of(Event Player), Position Of(Event Player.grappling_hook_attached_player)) <= 2.500;
}
actions
{
Event Player.grappling_hook_melee = True;
Event Player.grappling_hook_cooldown = 3;
Start Forcing Player Position(Event Player, Position Of(Event Player), False);
If(Hero Of(Event Player) == Hero(Reinhardt) || Hero Of(Event Player) == Hero(Brigitte) || (Hero Of(Event Player) == Hero(Genji)
&& Is Using Ultimate(Event Player)));
Allow Button(Event Player, Button(Primary Fire));
Start Holding Button(Event Player, Button(Primary Fire));
Wait(0.200, Ignore Condition);
Stop Holding Button(Event Player, Button(Primary Fire));
Else;
Allow Button(Event Player, Button(Melee));
Set Melee Enabled(Event Player, True);
Press Button(Event Player, Button(Melee));
Wait(0.200, Ignore Condition);
Set Melee Enabled(Event Player, False);
End;
Event Player.grappling_hook_in_use = False;
Stop Forcing Player Position(Event Player);
}
}
rule("Item - Grappling Hook - Attach to map")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Event Player.grappling_hook_in_use == True;
Event Player.grappling_hook_attached_to_map != True;
Event Player.grappling_hook_attached_player == Null;
Is In Line of Sight(Event Player.grappling_hook_fire_position, Event Player.grappling_hook_position, Barriers Do Not Block LOS) == False;
}
actions
{
If(Event Player.seraph_wings_in_use);
Event Player.grappling_hook_in_use = False;
Play Effect(Event Player, Debuff Impact Sound, Color(White), Event Player, 50);
Abort;
End;
Event Player.grappling_hook_attached_to_map = True;
Event Player.grappling_hook_attach_point = Ray Cast Hit Position(Event Player.grappling_hook_fire_position,
Event Player.grappling_hook_fire_position + Event Player.grappling_hook_fire_direction * 30, Empty Array, Event Player, True)
- Vector(0, 1, 0);
Event Player.grappling_hook_attach_distance = Distance Between(Position Of(Event Player),
Event Player.grappling_hook_attach_point);
Start Accelerating(Event Player, Direction Towards(Position Of(Event Player), Event Player.grappling_hook_attach_point), Min(Max(0,
Distance Between(Position Of(Event Player), Event Player.grappling_hook_attach_point)
- Event Player.grappling_hook_attach_distance) / 0.032, 200), 10000, To World, Direction Rate and Max Speed);
Play Effect(Event Player, Buff Impact Sound, Color(White), Event Player, 50);
}
}
rule("Item - Grappling Hook - Attached to map on ground")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Event Player.grappling_hook_in_use == True;
Event Player.grappling_hook_attached_to_map == True;
Is In Air(Event Player) != True;
}
actions
{
Stop Transforming Throttle(Event Player);
Stop Forcing Throttle(Event Player);
Event Player.move_speed = 100;
Call Subroutine(update_move_speed);
}
}
rule("Item - Grappling Hook - Attached to map in air")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Event Player.grappling_hook_in_use == True;
Event Player.grappling_hook_attached_to_map == True;
Is In Air(Event Player) == True;
}
actions
{
Start Transforming Throttle(Event Player, Square Root(1 - Dot Product(World Vector Of(Vector(1, 0, 0), Event Player, Rotation),
Direction Towards(Position Of(Event Player), Event Player.grappling_hook_attach_point)) ^ 2), Square Root(1 - Dot Product(
World Vector Of(Vector(0, 0, 1), Event Player, Rotation), Direction Towards(Position Of(Event Player),
Event Player.grappling_hook_attach_point)) ^ 2), World Vector Of(Vector(0, 0, 1), Event Player, Rotation) - Direction Towards(
Position Of(Event Player), Event Player.grappling_hook_attach_point) * Dot Product(World Vector Of(Vector(0, 0, 1),
Event Player, Rotation), Direction Towards(Position Of(Event Player), Event Player.grappling_hook_attach_point)));
Event Player.move_speed = 200;
Call Subroutine(update_move_speed);
Start Forcing Throttle(Event Player, 0, 0.500, 0, 0.500, 0, 0.500);
}
}
rule("Item - Grappling Hook - Update attach distance")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Event Player.grappling_hook_in_use == True;
Event Player.grappling_hook_attached_to_map == True;
Distance Between(Position Of(Event Player), Event Player.grappling_hook_attach_point)
< Event Player.grappling_hook_attach_distance;
}
actions
{
Event Player.grappling_hook_attach_distance = Distance Between(Position Of(Event Player),
Event Player.grappling_hook_attach_point);
Modify Player Variable(Event Player, grappling_hook_attach_distance, Max, 3);
Wait(0.016, Ignore Condition);
Loop If Condition Is True;
}
}
rule("Item - Grappling Hook - Leave attach distance")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Event Player.grappling_hook_in_use == True;
Event Player.grappling_hook_attached_to_map == True;
Distance Between(Position Of(Event Player), Event Player.grappling_hook_attach_point)
> Event Player.grappling_hook_attach_distance;
}
actions
{
Apply Impulse(Event Player,
Normalize(Direction Towards(Position Of(Event Player), Event Player.grappling_hook_attach_point)),
0.001, To World, Cancel Contrary Motion XYZ);
Wait(0.016, Ignore Condition);
Loop If Condition Is True;
}
}
rule("Item - Grappling Hook - Detach on death")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Is Dead(Event Player) == True;
}
actions
{
Event Player.grappling_hook_in_use = False;
}
}
rule("Item - Grappling Hook - Detach if unable to use abilities")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Event Player.can_use_abilities == False;
}
actions
{
Event Player.grappling_hook_in_use = False;
}
}
rule("Item - Grappling Hook - Detach on attached player death")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Event Player.grappling_hook_attached_player != Null;
Is Dead(Event Player.grappling_hook_attached_player) == True;
}
actions
{
Wait(0.016, Ignore Condition);
Event Player.grappling_hook_in_use = False;
Event Player.grappling_hook_cooldown = 1;
}
}
rule("Item - Grappling Hook - Detach on attached player phased out")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Event Player.grappling_hook_attached_player != Null;
Has Status(Event Player, Phased Out) == True;
}
actions
{
Event Player.grappling_hook_in_use = False;
Event Player.grappling_hook_cooldown = 1;
}
}
rule("Item - Grappling Hook - Reach max range")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Event Player.grappling_hook_in_use == True;
Event Player.grappling_hook_attached_to_map != True;
Event Player.grappling_hook_attached_player == Null;
Event Player.grappling_hook_distance >= 30;
}
actions
{
Event Player.grappling_hook_in_use = False;
Play Effect(Event Player, Debuff Impact Sound, Color(White), Event Player, 50);
}
}
rule("Item - Grappling Hook - Equip")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Event Player.item_owned[Global.ITEM_GRAPPLING_HOOK] == True;
Hero Of(Event Player) != Hero(Brigitte);
Event Player.menu_open != True;
}
actions
{
Set Melee Enabled(Event Player, False);
}
}
rule("Item - Grappling Hook - Unequip")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Event Player.item_owned[Global.ITEM_GRAPPLING_HOOK] != True;
}
actions
{
Set Melee Enabled(Event Player, True);
Event Player.grappling_hook_in_use = False;
}
}
rule("Item - Grappling Hook - Brigitte fix stop")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Event Player.item_owned[Global.ITEM_GRAPPLING_HOOK] == True;
Hero Of(Event Player) == Hero(Brigitte);
Is Firing Primary(Event Player) != True;
Event Player.menu_open != True;
}
actions
{
Wait(0.250, Abort When False);
Set Melee Enabled(Event Player, False);
}
}
rule("Item - Grappling Hook - Brigitte fix start")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Event Player.item_owned[Global.ITEM_GRAPPLING_HOOK] == True;
Hero Of(Event Player) == Hero(Brigitte);
Is Firing Primary(Event Player) == True;
}
actions
{
Set Melee Enabled(Event Player, True);
}
}
rule("Item - Grappling Hook - Cleanup")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Event Player.grappling_hook_in_use != True;
}
actions
{
Destroy Effect(Event Player.grappling_hook_effects);
Event Player.grappling_hook_effects = Empty Array;
If(Event Player.grappling_hook_attached_to_map);
Stop Transforming Throttle(Event Player);
End;
If(!Event Player.seraph_wings_in_use && !Event Player.blink_dagger_in_use && !Event Player.jetpack_in_use);
Event Player.move_speed = 100;
Call Subroutine(update_move_speed);
Stop Accelerating(Event Player);
Stop Forcing Throttle(Event Player);
Event Player.gravity = 100;
Call Subroutine(update_gravity);
End;
If(Event Player.grappling_hook_attached_player != Null);
Stop Facing(Event Player);
Allow Button(Event Player, Button(Secondary Fire));
Allow Button(Event Player, Button(Primary Fire));
Allow Button(Event Player, Button(Crouch));
Allow Button(Event Player, Button(Ability 1));
Allow Button(Event Player, Button(Ability 2));
Allow Button(Event Player, Button(Ultimate));
Allow Button(Event Player, Button(Melee));
Allow Button(Event Player, Button(Jump));
Allow Button(Event Player, Button(Reload));
Allow Button(Event Player, Button(Interact));
Event Player.grappling_hook_attached_player = Null;
Call Subroutine(seraph_wings_update);
End;
Event Player.grappling_hook_melee = False;
Wait(0.032, Abort When False);
Event Player.grappling_hook_attached_to_map = False;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment