Skip to content

Instantly share code, notes, and snippets.

@dreness
Created March 30, 2020 20:30
Show Gist options
  • Save dreness/bd40069edaf615e22ab26bab2780bb5a to your computer and use it in GitHub Desktop.
Save dreness/bd40069edaf615e22ab26bab2780bb5a to your computer and use it in GitHub Desktop.
Trails / Throttle demo
rule("fast setup")
{
event
{
Ongoing - Global;
}
conditions
{
Or(Is In Setup, Is Assembling Heroes) == True;
}
actions
{
Set Match Time(5);
}
}
rule("go long")
{
event
{
Ongoing - Global;
}
conditions
{
Is Game In Progress == True;
}
actions
{
Set Match Time(3599);
}
}
rule("init")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Has Spawned(Event Player) == True;
}
actions
{
Set Player Variable(Event Player, A, True);
Set Player Variable(Event Player, N, 15);
Set Player Variable(Event Player, D, 0.500);
Set Player Variable(Event Player, S, 30);
Set Player Variable(Event Player, Q, Position Of(Event Player));
Set Player Variable(Event Player, M, 0);
Set Player Variable(Event Player, J, 0);
Set Global Variable(V, Vector(207.616, 28.999, -29.290));
Set Global Variable(T, 100);
Set Global Variable(U, 100);
}
}
rule("init hud: speed, (x,y,z), Trails enabled, max effects, throttle")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Has Spawned(Event Player) == True;
}
actions
{
Create HUD Text(Event Player, Null, Null, Velocity Of(Event Player), Left, 0, White, White, White, Visible To and String,
Default Visibility);
Create HUD Text(Event Player, Null, Null, String("{0}: {1}", String("Time", Null, Null, Null), Player Variable(Event Player, D),
Null), Left, 1, White, White, White, Visible To and String, Default Visibility);
Create HUD Text(Event Player, Null, Null, String("{0}: {1}", String("Height", Null, Null, Null), Player Variable(Event Player, S),
Null), Left, 2, White, White, White, Visible To and String, Default Visibility);
Create HUD Text(Event Player, Null, Null, String("{0}: {1}", String("Max", Null, Null, Null), Player Variable(Event Player, N),
Null), Left, 3, White, White, White, Visible To and String, Default Visibility);
Create HUD Text(Event Player, Null, Null, String("{0}: {1}", String("Started", Null, Null, Null), String("{0}: {1}",
Player Variable(Event Player, J), String("{0}: {1}", String("Selected", Null, Null, Null), Player Variable(Event Player, M),
Null), Null), Null), Left, 4, White, White, White, Visible To and String, Default Visibility);
Create HUD Text(Event Player, Null, Null, Global Variable(T), Left, 1, White, White, White, Visible To and String,
Default Visibility);
Create HUD Text(Event Player, Null, Null, Throttle Of(Event Player), Left, 0, White, White, White, Visible To and String,
Default Visibility);
}
}
rule("trails")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Is Alive(Event Player) == True;
Speed Of(Event Player) > 2;
Player Variable(Event Player, A) == 1;
}
actions
{
Set Player Variable(Event Player, P, Position Of(Event Player));
Modify Player Variable(Event Player, F, Append To Array, Divide(Speed Of(Event Player), Player Variable(Event Player, S)));
Create Effect(All Players(All Teams), Sphere, Green, Player Variable(Event Player, P), Last Of(Player Variable(Event Player, F)),
None);
Modify Player Variable(Event Player, E, Append To Array, Last Created Entity);
Wait(Player Variable(Event Player, D), Ignore Condition);
Loop If Condition Is True;
}
}
rule("clear trails")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Player Variable(Event Player, A) == 1;
}
actions
{
Skip If(Compare(Count Of(Player Variable(Event Player, E)), <=, Player Variable(Event Player, N)), 3);
Destroy Effect(First Of(Player Variable(Event Player, E)));
Modify Player Variable(Event Player, E, Remove From Array By Index, 0);
Modify Player Variable(Event Player, F, Remove From Array By Index, 0);
Wait(Player Variable(Event Player, D), Ignore Condition);
Loop If Condition Is True;
}
}
rule("toggle trails (hello)")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Is Communicating(Event Player, Hello) == True;
}
actions
{
Skip If(Not(Player Variable(Event Player, A)), 2);
Set Player Variable(Event Player, A, False);
Abort;
Set Player Variable(Event Player, A, True);
}
}
rule("respawn (voice line up)")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Is Communicating(Event Player, Voice Line Up) == True;
Is In Spawn Room(Event Player) == False;
}
actions
{
Respawn(Event Player);
}
}
rule("TP to range (voice left)")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Is Communicating(Event Player, Voice Line Left) == True;
}
actions
{
Teleport(Event Player, Global Variable(V));
}
}
rule("clear all effects (primary + secondary)")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Is Button Held(Event Player, Primary Fire) == True;
Is Button Held(Event Player, Secondary Fire) == True;
}
actions
{
Destroy All Effects;
Set Player Variable(Event Player, E, Empty Array);
Set Player Variable(Event Player, F, Empty Array);
}
}
rule("Adjust delay")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Player Variable(Event Player, M) == 1;
Player Variable(Event Player, J) != 0;
Is Button Held(Event Player, Interact) == False;
Is Button Held(Event Player, Crouch) == False;
}
actions
{
Set Player Variable(Event Player, D, Absolute Value(Divide(Vertical Facing Angle Of(Event Player), 12)));
Wait(0.100, Ignore Condition);
Loop If Condition Is True;
}
}
rule("Adjust scale")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Player Variable(Event Player, M) == 2;
Player Variable(Event Player, J) != 0;
Is Button Held(Event Player, Interact) == False;
Is Button Held(Event Player, Crouch) == False;
}
actions
{
Set Player Variable(Event Player, S, Absolute Value(Divide(Vertical Facing Angle Of(Event Player), 2)));
Wait(0.100, Ignore Condition);
Loop If Condition Is True;
}
}
rule("Adjust effect count")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Player Variable(Event Player, M) == 3;
Player Variable(Event Player, J) != 0;
Is Button Held(Event Player, Interact) == False;
Is Button Held(Event Player, Crouch) == False;
}
actions
{
Set Player Variable(Event Player, N, Round To Integer(Absolute Value(Multiply(Vertical Facing Angle Of(Event Player), 2)), Up));
Wait(0.100, Ignore Condition);
Loop If Condition Is True;
}
}
rule("toggle edit mode (interact + crouch)")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Is Button Held(Event Player, Interact) == True;
Is Button Held(Event Player, Crouch) == True;
}
actions
{
Skip If(Compare(Player Variable(Event Player, J), !=, 0), 2);
Set Player Variable(Event Player, J, 1);
Abort;
Set Player Variable(Event Player, J, 0);
disabled Set Player Variable(Event Player, M, 0);
}
}
rule("select edit mode")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Player Variable(Event Player, J) != 0;
}
actions
{
Wait(0.020, Ignore Condition);
Skip If(Not(Compare(X Component Of(Throttle Of(Event Player)), >, 0)), 2);
Set Player Variable(Event Player, M, 1);
Abort;
Skip If(Not(Compare(X Component Of(Throttle Of(Event Player)), <, 0)), 2);
Set Player Variable(Event Player, M, 2);
Abort;
Skip If(Not(Compare(Z Component Of(Throttle Of(Event Player)), >, 0)), 2);
Set Player Variable(Event Player, M, 3);
Abort;
Loop;
}
}
disabled rule("time chase")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Is Button Held(Event Player, Ultimate) == True;
}
actions
{
Chase Global Variable Over Time(T, 0.100, 4, Destination and Duration);
Wait(4, Ignore Condition);
Chase Global Variable Over Time(T, 1, 0.400, Destination and Duration);
}
}
disabled rule("slow motion")
{
event
{
Ongoing - Global;
}
conditions
{
Is Game In Progress == True;
}
actions
{
If(Compare(Global Variable(T), !=, Global Variable(U)));
Wait(0.016, Ignore Condition);
Set Slow Motion(Global Variable(T));
Set Global Variable(U, Global Variable(T));
Loop;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment