Advertisement
Guest User

Untitled

a guest
Jul 4th, 2015
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.66 KB | None | 0 0
  1. import("ScarUtil.scar");
  2.  
  3. function OnGameSetup() -- Called as the first thing in the script no matter what
  4. player1 = World_GetPlayerAt(1);
  5. player2 = World_GetPlayerAt(2);
  6. player3 = World_GetPlayerAt(3);
  7. player4 = World_GetPlayerAt(4);
  8. end
  9. -----------------------------------------------------
  10. function OnInit()
  11. -- More stuff
  12. AI_EnableAll(false);
  13. UI_SetCPMeterVisibility(false);
  14.  
  15. -- Declaring groups
  16. sg_scout1 = SGroup_CreateIfNotFound("sg_scout1") -- Declare the SG
  17. sg_defender1 = SGroup_CreateIfNotFound("sg_defender1")
  18. sg_defendervet1 = SGroup_CreateIfNotFound("sg_defendervet1")
  19. sg_defendervet2 = SGroup_CreateIfNotFound("sg_defendervet2")
  20. sg_counter1 = SGroup_CreateIfNotFound("sg_counter1")
  21. sg_defenders = SGroup_CreateIfNotFound("sg_defenders")
  22. sg_defendertotal = SGroup_CreateIfNotFound("sg_defendertotal")
  23. sg_scout2 = SGroup_CreateIfNotFound("sg_scout2")
  24. sg_sdkfz251 = SGroup_CreateIfNotFound("sg_sdkfz251")
  25. sg_reinforcement = SGroup_CreateIfNotFound("sg_reinforcement")
  26. sg_reinforcement1 = SGroup_CreateIfNotFound("sg_reinforcement1")
  27. -- Function call
  28. Restriction();
  29. InitializeObjectives();
  30.  
  31. Villageattack(); -- Call villageattack function
  32. Farm_Attack_Reinforcement();
  33.  
  34. Rule_AddOneShot(OBJ_Farm_Mission, 2);
  35.  
  36. -- Intervals
  37. Rule_AddInterval(Move, 2); -- Calls the function every 7th second
  38. Rule_AddInterval(OBJ_Farm_Lose, 10);
  39.  
  40. -- Functions to test stuff out
  41. testing();
  42. end
  43. Scar_AddInit(OnInit);
  44. -----------------------------------------------------
  45. function Restriction()
  46. g_manpowerrate = Modify_PlayerResourceRate(player1, RT_Manpower, 0, MUT_Multiplication);
  47. g_fuelrate = Modify_PlayerResourceRate(player1, RT_Fuel, 0, MUT_Multiplication);
  48. g_munitionrate = Modify_PlayerResourceRate(player1, RT_Munition, 0, MUT_Multiplication);
  49.  
  50. Player_SetResource(player1, RT_Manpower, 0);
  51. Player_SetResource(player1, RT_Fuel, 0);
  52. Player_SetResource(player1, RT_Munition, 0);
  53.  
  54. Player_SetAbilityAvailability(player1, ABILITY.GERMAN.ASSAULT_GRENADIER_GRENADE, ITEM_REMOVED)
  55. Player_SetAbilityAvailability(player1, ABILITY.GERMAN.GRENADIER_PANZERFAUST_MP, ITEM_REMOVED)
  56. Player_SetAbilityAvailability(player1, ABILITY.GERMAN.GRENADIER_RIFLE_GRENADE_ABILITY_MP, ITEM_REMOVED)
  57.  
  58. end
  59. -----------------------------------------------------
  60. function InitializeObjectives()
  61. -- Missions
  62. OBJ_FARM= {
  63. SetupUI = function()
  64. end,
  65.  
  66. OnStart = function()
  67. Rule_AddInterval(OBJ_Farm_IsDone, 2)
  68. Rule_AddInterval(Farm_Attack_Reinforcement, 2)
  69. end,
  70.  
  71. OnComplete = function()
  72. Player_AddResource(player1, RT_Manpower, 125);
  73. Util_CreateSquads(player3, sg_sdkfz251, BP_GetSquadBlueprint("sdkfz_251_halftrack_squad_mp"), mkr_playerspawn, mkr_truckfarm1, 1, nil, nil, nil, nil, nil);
  74. Util_CreateSquads(player3, sg_reinforcement, BP_GetSquadBlueprint("grenadier_squad_mp"), sg_sdkfz251, nil, 1, nil, nil, nil, nil, nil);
  75. Util_CreateSquads(player3, sg_reinforcement1, BP_GetSquadBlueprint("mg42_heavy_machine_gun_squad_mp"), sg_sdkfz251, nil, 1, nil, nil, nil, nil, nil);
  76. TruckLeave()
  77. Rule_AddInterval(TruckLeave, 2);
  78. end,
  79.  
  80. OnFail = function()
  81. end,
  82.  
  83. Title = "$f69d864ff41f412f91dfd87227648192:1",
  84. Description = 0,
  85. Type = OT_Primary, -- main objective (the star)
  86. }
  87. Objective_Register(OBJ_FARM);
  88. end
  89. -----------------------------------------------------
  90. function Villageattack()
  91. Util_CreateSquads(player1, sg_scout1, BP_GetSquadBlueprint("assault_grenadier_squad_mp"), mkr_playerspawn, nil, 10, nil, nil, nil, nil, nil);
  92. Util_CreateSquads(player1, sg_scout1, BP_GetSquadBlueprint("grenadier_squad_mp"), mkr_playerspawn1, nil, 1, nil, nil, nil, nil, nil);
  93.  
  94. Util_CreateSquads(player2, sg_defendervet1, BP_GetSquadBlueprint("conscript_squad_mp"), villageattack_building, nil, 1, nil, nil, nil, nil, nil);
  95.  
  96. Util_CreateSquads(player2, sg_defendervet2, BP_GetSquadBlueprint("combat_engineer_squad_mp"), mkr_defenderspawn3, nil, 1, nil, nil, nil, nil, nil);
  97. Cmd_SquadPatrolMarker( sg_defendervet2, mkr_defenderspawn3 )
  98.  
  99. Util_CreateSquads(player2, sg_defender1, BP_GetSquadBlueprint("conscript_squad_mp"), villageattack_building1, nil, 1, nil, nil, nil, nil, nil);
  100.  
  101. SGroup_IncreaseVeterancyRank(sg_defendervet1, World_GetRand(1, 2), true);
  102. SGroup_IncreaseVeterancyRank(sg_defendervet2, World_GetRand(1, 3), true);
  103.  
  104. Util_CreateSquads(player2, sg_counter1, BP_GetSquadBlueprint("conscript_squad_mp"), mkr_counterspawn, nil, 1, nil, nil, nil, nil, nil);
  105. SGroup_IncreaseVeterancyRank(sg_counter1, World_GetRand(1, 2), true);
  106.  
  107. SGroup_AddGroup(sg_defenders, sg_defendervet1);
  108. SGroup_AddGroup(sg_defenders, sg_defendervet2);
  109. SGroup_AddGroup(sg_defenders, sg_defender1);
  110.  
  111. SGroup_AddGroup(sg_defendertotal, sg_defenders);
  112. SGroup_AddGroup(sg_defendertotal, sg_counter1);
  113. end
  114. -----------------------------------------------------
  115. function Move()
  116. if (SGroup_Count(sg_defenders) <=1) then
  117. Cmd_Move(sg_counter1, mkr_defenderspawn2);
  118. Rule_RemoveMe();
  119. end
  120. end
  121. -----------------------------------------------------
  122. function Farm_Attack_Reinforcement()
  123. if (SGroup_TotalMembersCount(sg_scout1, false) == 2) then
  124. Util_CreateSquads(player1, sg_scout2, BP_GetSquadBlueprint("grenadier_squad_mp"), mkr_playerspawn, nil, 1, nil, nil, nil, nil, nil);
  125. SGroup_AddGroup(sg_scout1, sg_scout2);
  126. Cmd_Move(sg_scout2, mkr_defenderspawn3);
  127. end
  128. end
  129. -----------------------------------------------------
  130. function OBJ_Farm_Mission()
  131. -- Call mission
  132. Objective_Start(OBJ_FARM, true);
  133. end
  134. -----------------------------------------------------
  135. function OBJ_Farm_Lose()
  136. -- Lose condition OBJ_Farm_Lose
  137. if (SGroup_Count(sg_scout1) == 0) then
  138. Game_EndSP(false);
  139. Rule_RemoveAll()
  140. end
  141. end
  142. -----------------------------------------------------
  143. function OBJ_Farm_IsDone()
  144. if (EGroup_IsCapturedByPlayer( farm_point, player1, ANY ) and SGroup_Count(sg_defendertotal) == 0) then
  145. Objective_Complete(OBJ_FARM, true);
  146. end
  147. end
  148. -----------------------------------------------------
  149. function TruckLeave()
  150. if (Prox_AreSquadsNearMarker(sg_sdkfz251, mkr_truckfarm1, ANY, 2) == true) then
  151. Cmd_EjectOccupants(sg_sdkfz251, nil, true);
  152. SGroup_SetPlayerOwner(sg_reinforcement, player1)
  153. SGroup_SetPlayerOwner(sg_reinforcement1, player1)
  154. Cmd_Move(sg_reinforcement, mkr_reinforcementtruck)
  155. Cmd_Move(sg_reinforcement1, mkr_reinforcementtruck1)
  156. end
  157. Cmd_MoveToAndDespawn(sg_sdkfz251, mkr_playerspawn1, true)
  158. Rule_RemoveMe();
  159. end
  160. -----------------------------------------------------
  161. function testing()
  162.  
  163. FOW_Enable(false)
  164. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement