Advertisement
Nolt

mission code

Sep 11th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1. InfantryTypes = { "altnode1", "crusader", "templar" }
  2.  
  3. Objectives = function()
  4. MainObjective = player.AddPrimaryObjective("Capture the alien artifact.")
  5. Camera.Position = Actor1022.CenterPosition
  6.  
  7. end
  8.  
  9. IntroductionInfo = function()
  10. UserInterface.SetMissionText("An artifact of alien origin has been detected nearby, explore the area and recapture our M.C.V.")
  11. Trigger.AfterDelay(DateTime.Seconds(15), CleanMissionText)
  12. end
  13.  
  14. MCVFoundMessage = function()
  15. UserInterface.SetMissionText("M.C.V. located, Nod did not try to hide it, I am estimating a low probability of encountering an ambush.")
  16. Trigger.AfterDelay(DateTime.Seconds(15), CleanMissionText)
  17.  
  18. end
  19.  
  20. NodWarnedMessage = function()
  21. UserInterface.SetMissionText("As expected, the M.C.V. has a tracker, Nod has been notified of our presence, establish a base and capture the alien artifact.")
  22. Trigger.AfterDelay(DateTime.Seconds(15), CleanMissionText)
  23. Trigger.AfterDelay(DateTime.Seconds(15), ProduceInfantry)
  24. end
  25.  
  26. IdlingUnits = { }
  27. AttackGroupSize = 3
  28.  
  29. ProduceInfantry = function()
  30. local delay = Utils.RandomInteger(DateTime.Seconds(3), DateTime.Seconds(9))
  31. local toBuild = { Utils.Random(InfantryTypes) }
  32. ai.Build(toBuild, function(unit)
  33. IdlingUnits[#IdlingUnits + 1] = unit[1]
  34. Trigger.AfterDelay(delay, ProduceInfantry)
  35. if #IdlingUnits >= (AttackGroupSize) then
  36. SendAttack()
  37. end
  38. end)
  39. end
  40.  
  41. SendAttack = function()
  42. local units = { }
  43. units = SetupAttackGroup()
  44. Utils.Do(units, function(unit)
  45. IdleHunt(unit)
  46. end)
  47. end
  48.  
  49. IdleHunt = function(unit) if not unit.IsDead then Trigger.OnIdle(unit, unit.Hunt) end end
  50.  
  51. SetupAttackGroup = function()
  52. local units = { }
  53.  
  54. for i = 0, AttackGroupSize, 1 do
  55. if #IdlingUnits == 0 then
  56. Media.DisplayMessage("" .. #IdlingUnits)
  57. return units
  58. end
  59.  
  60. local number = Utils.RandomInteger(1, #IdlingUnits)
  61.  
  62. if IdlingUnits[number] and not IdlingUnits[number].IsDead then
  63. units[i] = IdlingUnits[number]
  64. table.remove(IdlingUnits, number)
  65. end
  66. end
  67.  
  68. return units
  69. end
  70.  
  71. CleanMissionText = function()
  72. UserInterface.SetMissionText("")
  73. end
  74.  
  75. Militants = {Actor502, Actor503, Actor504}
  76. MilitantPatrolPath = { Actor1207, Actor1208, Actor1209, Actor1210, Actor1211, Actor1212}
  77.  
  78. WorldLoaded = function()
  79. player = Player.GetPlayer("Cabal")
  80. ai = Player.GetPlayer("Nod1")
  81. Objectives()
  82. IntroductionInfo()
  83.  
  84. Trigger.OnEnteredProximityTrigger(Actor1023.CenterPosition, WDist.New(1024 * 15), function(a, id)
  85. if a.Owner == player then
  86. Trigger.RemoveProximityTrigger(id)
  87. baseCamera = Actor.Create("camera", true, { Owner = player, Location = Actor1023.Location })
  88. MCVFoundMessage()
  89. end
  90. end)
  91. Trigger.OnKilledOrCaptured(Actor1023, function() NodWarnedMessage()
  92. end)
  93. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement