Advertisement
pazryx

2 rule bouncy ball physics OW Workshop

Jul 23rd, 2020
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.11 KB | None | 0 0
  1. variables
  2. {
  3. player:
  4. 0: BAL_LOQ
  5. 1: BAL_POS
  6. 2: HOR_NML
  7. 3: VRT_NML
  8. 4: BAL_ENT
  9. 5: WAL_NML
  10. 6: HOR_VEL
  11. }
  12.  
  13. rule("DE/MAKE BALL")
  14. {
  15. event
  16. {
  17. Ongoing - Each Player;
  18. All;
  19. All;
  20. }
  21.  
  22. conditions
  23. {
  24. Is Button Held(Event Player, Interact) == True;
  25. }
  26.  
  27. actions
  28. {
  29. Skip If(Event Player.BAL_LOQ == True, 5);
  30. Event Player.BAL_LOQ = True;
  31. Event Player.BAL_POS = Eye Position(Event Player) + Facing Direction Of(Event Player) * Vector(3, 1, 3);
  32. Create Effect(All Players(All Teams), Sphere, Orange, Event Player.BAL_POS, 0.500, Visible To Position and Radius);
  33. Event Player.BAL_ENT = Last Created Entity;
  34. Skip(5);
  35. Event Player.BAL_LOQ = False;
  36. Destroy Effect(Event Player.BAL_ENT);
  37. Stop Chasing Player Variable(Event Player, BAL_POS);
  38. Stop Chasing Player Variable(Event Player, VRT_NML);
  39. Stop Chasing Player Variable(Event Player, HOR_VEL);
  40. }
  41. }
  42.  
  43. rule("MELEE")
  44. {
  45. event
  46. {
  47. Ongoing - Each Player;
  48. All;
  49. All;
  50. }
  51.  
  52. conditions
  53. {
  54. (Distance Between(Eye Position(Event Player), Event Player.BAL_POS) <= 2 || Distance Between(Position Of(Event Player),
  55. Event Player.BAL_POS) <= 2) == True;
  56. Is Button Held(Event Player, Melee) == True;
  57. Event Player.BAL_LOQ == True;
  58. }
  59.  
  60. actions
  61. {
  62. Event Player.VRT_NML = Vector(0, 0, 0);
  63. Event Player.HOR_NML = Facing Direction Of(Event Player);
  64. Event Player.HOR_VEL = 20;
  65. Chase Player Variable At Rate(Event Player, BAL_POS,
  66. Event Player.BAL_POS + Event Player.VRT_NML + Event Player.HOR_NML * Event Player.HOR_VEL,
  67. Event Player.HOR_VEL / 2 + Absolute Value(Y Component Of(Event Player.VRT_NML)), Destination and Rate);
  68. Chase Player Variable At Rate(Event Player, HOR_VEL, 0, 5, Destination and Rate);
  69. Chase Player Variable At Rate(Event Player, VRT_NML, Vector(0, -10000, 0), 15, Destination and Rate);
  70. }
  71. }
  72.  
  73. rule("BOUNCE")
  74. {
  75. event
  76. {
  77. Ongoing - Each Player;
  78. All;
  79. All;
  80. }
  81.  
  82. conditions
  83. {
  84. Event Player.BAL_LOQ == True;
  85. Distance Between(Event Player.BAL_POS, Ray Cast Hit Position(Event Player.BAL_POS, Event Player.BAL_POS + (
  86. Event Player.HOR_NML * Event Player.HOR_VEL + Event Player.VRT_NML) * 250, Null, All Players(All Teams), False)) <= 0.500;
  87. }
  88.  
  89. actions
  90. {
  91. Event Player.WAL_NML = Ray Cast Hit Normal(Event Player.BAL_POS, Event Player.BAL_POS + Event Player.HOR_NML * 250, Null,
  92. All Players(All Teams), False);
  93. Event Player.HOR_NML = Event Player.HOR_NML - 2 * Event Player.WAL_NML * (X Component Of(Event Player.HOR_NML) * X Component Of(
  94. Event Player.WAL_NML) + Y Component Of(Event Player.HOR_NML) * Y Component Of(Event Player.WAL_NML) + Z Component Of(
  95. Event Player.HOR_NML) * Z Component Of(Event Player.WAL_NML));
  96. Skip If(Distance Between(Event Player.BAL_POS, Ray Cast Hit Position(Event Player.BAL_POS, Event Player.BAL_POS - Vector(0, 250,
  97. 0), Null, All Players(All Teams), False)) > 0.500, 1);
  98. Event Player.VRT_NML *= Vector(0, -0.600, 0);
  99. Skip If(Event Player.HOR_VEL > 0 || Absolute Value(Y Component Of(Event Player.VRT_NML)) > 0.250, 2);
  100. Event Player.VRT_NML = Vector(0, 0, 0);
  101. Stop Chasing Player Variable(Event Player, VRT_NML);
  102. }
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement