Advertisement
Guest User

Untitled

a guest
Nov 11th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.62 KB | None | 0 0
  1. variables
  2. {
  3. global:
  4. 0: _extendedGlobalCollection
  5. 1: _arrayBuilder
  6. 7: cellStates
  7. 10: generateStep
  8. 11: buildMazeAt
  9. 14: navigator
  10. 15: navigateTo
  11. 16: walkPath
  12. 17: chosenPathEffects
  13. 75: aStarCheck
  14. 76: visited
  15. 77: i
  16. 78: DestroyEffectArray_index
  17. }
  18.  
  19. rule("Maze: A* Nav")
  20. {
  21. event
  22. {
  23. Ongoing - Global;
  24. }
  25.  
  26. conditions
  27. {
  28. Global Variable(generateStep) == 6;
  29. Is Button Held(Host Player, Interact) == True;
  30. }
  31.  
  32. actions
  33. {
  34. Wait(0.016, Ignore Condition);
  35. Skip If(Compare(Value In Array(Global Variable(_extendedGlobalCollection), 39), ==, 0), 3);
  36. Set Global Variable At Index(_extendedGlobalCollection, 40, Value In Array(Global Variable(_extendedGlobalCollection), 39));
  37. Set Global Variable At Index(_extendedGlobalCollection, 39, 0);
  38. Skip(Value In Array(Global Variable(_extendedGlobalCollection), 40));
  39. Set Global Variable(navigateTo, Divide(Subtract(Position Of(Host Player), Global Variable(buildMazeAt)), 7));
  40. Small Message(All Players(All Teams), Custom String("Navigating to {0}", Global Variable(navigateTo), Null, Null));
  41. Set Global Variable At Index(_extendedGlobalCollection, 1, True);
  42. Set Global Variable At Index(_extendedGlobalCollection, 34, Round To Integer(X Component Of(Global Variable(navigateTo)),
  43. To Nearest));
  44. Set Global Variable At Index(_extendedGlobalCollection, 35, Round To Integer(Z Component Of(Global Variable(navigateTo)),
  45. To Nearest));
  46. Set Global Variable At Index(_extendedGlobalCollection, 36, Round To Integer(X Component Of(Divide(Subtract(Position Of(
  47. Global Variable(navigator)), Global Variable(buildMazeAt)), 7)), To Nearest));
  48. Set Global Variable At Index(_extendedGlobalCollection, 37, Round To Integer(Z Component Of(Divide(Subtract(Position Of(
  49. Global Variable(navigator)), Global Variable(buildMazeAt)), 7)), To Nearest));
  50. Set Global Variable(aStarCheck, Empty Array);
  51. Modify Global Variable(aStarCheck, Append To Array, Vector(Value In Array(Global Variable(_extendedGlobalCollection), 36), -1.000,
  52. Value In Array(Global Variable(_extendedGlobalCollection), 37)));
  53. Set Global Variable At Index(_extendedGlobalCollection, 38, -1.000);
  54. Set Global Variable(visited, Empty Array);
  55. Small Message(All Players(All Teams), Custom String("Initialized, starting in 5 seconds...", Null, Null, Null));
  56. Wait(5, Ignore Condition);
  57. Set Global Variable(i, 0);
  58. Skip If(Not(And(Compare(Global Variable(i), <, Count Of(Global Variable(aStarCheck))), Compare(Value In Array(Global Variable(
  59. _extendedGlobalCollection), 38), ==, -1.000))), 39);
  60. Small Message(All Players(All Teams), Custom String("Starting loop {0}", Global Variable(i), Null, Null));
  61. Wait(3, Ignore Condition);
  62. Set Global Variable At Index(_extendedGlobalCollection, 41, X Component Of(Value In Array(Global Variable(aStarCheck),
  63. Global Variable(i))));
  64. Set Global Variable At Index(_extendedGlobalCollection, 42, Z Component Of(Value In Array(Global Variable(aStarCheck),
  65. Global Variable(i))));
  66. Set Global Variable At Index(_extendedGlobalCollection, 43, Subtract(Value In Array(Value In Array(Global Variable(cellStates),
  67. Value In Array(Global Variable(_extendedGlobalCollection), 41)), Value In Array(Global Variable(_extendedGlobalCollection),
  68. 42)), 16));
  69. Set Global Variable(_arrayBuilder, Value In Array(Global Variable(visited), Value In Array(Global Variable(
  70. _extendedGlobalCollection), 41)));
  71. Set Global Variable At Index(_arrayBuilder, Value In Array(Global Variable(_extendedGlobalCollection), 42), True);
  72. Set Global Variable At Index(visited, Value In Array(Global Variable(_extendedGlobalCollection), 41), Global Variable(
  73. _arrayBuilder));
  74. Small Message(All Players(All Teams), Custom String("Initialized loop {0}", Global Variable(i), Null, Null));
  75. Wait(3, Ignore Condition);
  76. Skip If(Not(And(Compare(Value In Array(Global Variable(_extendedGlobalCollection), 41), ==, Value In Array(Global Variable(
  77. _extendedGlobalCollection), 34)), Compare(Value In Array(Global Variable(_extendedGlobalCollection), 42), ==, Value In Array(
  78. Global Variable(_extendedGlobalCollection), 35)))), 2);
  79. Set Global Variable At Index(_extendedGlobalCollection, 38, Global Variable(i));
  80. Skip(22);
  81. Skip If(Not(Compare(Value In Array(Global Variable(_extendedGlobalCollection), 43), >=, 8)), 2);
  82. Modify Global Variable At Index(_extendedGlobalCollection, 43, Subtract, 8);
  83. Skip(2);
  84. Skip If(Not(And(Compare(Value In Array(Global Variable(_extendedGlobalCollection), 41), >, 0), Not(Value In Array(Value In Array(
  85. Global Variable(visited), Subtract(Value In Array(Global Variable(_extendedGlobalCollection), 41), 1)), Value In Array(
  86. Global Variable(_extendedGlobalCollection), 42))))), 1);
  87. Modify Global Variable(aStarCheck, Append To Array, Vector(Subtract(Value In Array(Global Variable(_extendedGlobalCollection), 41),
  88. 1), Global Variable(i), Value In Array(Global Variable(_extendedGlobalCollection), 42)));
  89. Skip If(Not(Compare(Value In Array(Global Variable(_extendedGlobalCollection), 43), >=, 4)), 2);
  90. Modify Global Variable At Index(_extendedGlobalCollection, 43, Subtract, 4);
  91. Skip(2);
  92. Skip If(Not(And(Compare(Value In Array(Global Variable(_extendedGlobalCollection), 42), >, 0), Not(Value In Array(Value In Array(
  93. Global Variable(visited), Value In Array(Global Variable(_extendedGlobalCollection), 41)), Subtract(Value In Array(
  94. Global Variable(_extendedGlobalCollection), 42), 1))))), 1);
  95. Modify Global Variable(aStarCheck, Append To Array, Vector(Value In Array(Global Variable(_extendedGlobalCollection), 41),
  96. Global Variable(i), Subtract(Value In Array(Global Variable(_extendedGlobalCollection), 42), 1)));
  97. Skip If(Not(Compare(Value In Array(Global Variable(_extendedGlobalCollection), 43), >=, 2)), 2);
  98. Modify Global Variable At Index(_extendedGlobalCollection, 43, Subtract, 2);
  99. Skip(2);
  100. Skip If(Not(And(Compare(Value In Array(Global Variable(_extendedGlobalCollection), 41), <, Subtract(15, 1)), Not(Value In Array(
  101. Value In Array(Global Variable(visited), Add(Value In Array(Global Variable(_extendedGlobalCollection), 41), 1)),
  102. Value In Array(Global Variable(_extendedGlobalCollection), 42))))), 1);
  103. Modify Global Variable(aStarCheck, Append To Array, Vector(Add(Value In Array(Global Variable(_extendedGlobalCollection), 41), 1),
  104. Global Variable(i), Value In Array(Global Variable(_extendedGlobalCollection), 42)));
  105. Skip If(Not(Compare(Value In Array(Global Variable(_extendedGlobalCollection), 43), >=, 1)), 2);
  106. Modify Global Variable At Index(_extendedGlobalCollection, 43, Subtract, 1);
  107. Skip(2);
  108. Skip If(Not(And(Compare(Value In Array(Global Variable(_extendedGlobalCollection), 42), <, Subtract(10, 1)), Not(Value In Array(
  109. Value In Array(Global Variable(visited), Value In Array(Global Variable(_extendedGlobalCollection), 41)), Add(Value In Array(
  110. Global Variable(_extendedGlobalCollection), 42), 1))))), 1);
  111. Modify Global Variable(aStarCheck, Append To Array, Vector(Value In Array(Global Variable(_extendedGlobalCollection), 41),
  112. Global Variable(i), Add(Value In Array(Global Variable(_extendedGlobalCollection), 42), 1)));
  113. Small Message(All Players(All Teams), Custom String("Finished wall check", Null, Null, Null));
  114. Wait(1, Ignore Condition);
  115. Small Message(All Players(All Teams), Custom String("Looping!", Null, Null, Null));
  116. Modify Global Variable(i, Add, 1);
  117. Set Global Variable At Index(_extendedGlobalCollection, 39, 14);
  118. Loop;
  119. Set Global Variable At Index(_extendedGlobalCollection, 39, 0);
  120. Wait(2, Ignore Condition);
  121. Small Message(All Players(All Teams), Custom String("found ya", Null, Null, Null));
  122. Set Global Variable(DestroyEffectArray_index, 0);
  123. Skip If(Not(Compare(Global Variable(DestroyEffectArray_index), <, Count Of(Global Variable(chosenPathEffects)))), 4);
  124. Destroy Effect(Value In Array(Global Variable(chosenPathEffects), Global Variable(DestroyEffectArray_index)));
  125. Set Global Variable(DestroyEffectArray_index, Add(Global Variable(DestroyEffectArray_index), 1));
  126. Set Global Variable At Index(_extendedGlobalCollection, 39, 58);
  127. Loop;
  128. Set Global Variable At Index(_extendedGlobalCollection, 39, 0);
  129. Set Global Variable(chosenPathEffects, Empty Array);
  130. Set Global Variable(walkPath, Empty Array);
  131. Skip If(Not(Compare(Value In Array(Global Variable(_extendedGlobalCollection), 38), !=, -1.000)), 6);
  132. Set Global Variable(walkPath, Append To Array(Append To Array(Empty Array, Vector(Add(X Component Of(Global Variable(buildMazeAt)),
  133. Multiply(X Component Of(Value In Array(Global Variable(aStarCheck), Value In Array(Global Variable(_extendedGlobalCollection),
  134. 38))), 7)), Y Component Of(Global Variable(buildMazeAt)), Add(Z Component Of(Global Variable(buildMazeAt)), Multiply(
  135. Z Component Of(Value In Array(Global Variable(aStarCheck), Value In Array(Global Variable(_extendedGlobalCollection), 38))),
  136. 7)))), Global Variable(walkPath)));
  137. Create Effect(All Players(All Teams), Sphere, Purple, First Of(Global Variable(walkPath)), 0.250, Visible To);
  138. Set Global Variable(chosenPathEffects, Append To Array(Global Variable(chosenPathEffects), Last Created Entity));
  139. Set Global Variable At Index(_extendedGlobalCollection, 38, Y Component Of(Value In Array(Global Variable(aStarCheck),
  140. Value In Array(Global Variable(_extendedGlobalCollection), 38))));
  141. Set Global Variable At Index(_extendedGlobalCollection, 39, 66);
  142. Loop;
  143. Set Global Variable At Index(_extendedGlobalCollection, 39, 0);
  144. Set Global Variable(aStarCheck, Empty Array);
  145. Set Global Variable At Index(_extendedGlobalCollection, 1, False);
  146. Small Message(All Players(All Teams), Custom String("Found path!", Null, Null, Null));
  147. }
  148. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement