Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import("ScarUtil.scar");
- function OnGameSetup() -- Called as the first thing in the script no matter what
- player1 = World_GetPlayerAt(1);
- player2 = World_GetPlayerAt(2);
- player3 = World_GetPlayerAt(3);
- player4 = World_GetPlayerAt(4);
- player5 = World_GetPlayerAt(5);
- player6 = World_GetPlayerAt(6);
- Setup_SetPlayerName(player1, "$f69d864ff41f412f91dfd87227648192:5");
- Setup_SetPlayerName(player2, "$f69d864ff41f412f91dfd87227648192:6");
- Setup_SetPlayerName(player3, "$f69d864ff41f412f91dfd87227648192:7");
- Setup_SetPlayerName(player4, "$f69d864ff41f412f91dfd87227648192:9");
- Setup_SetPlayerName(player5, "$f69d864ff41f412f91dfd87227648192:8");
- Setup_SetPlayerName(player6, "$f69d864ff41f412f91dfd87227648192:10");
- end
- -----------------------------------------------------
- function OnInit()
- -- More stuff
- AI_EnableAll(false);
- -- Declaring groups
- sg_scout1 = SGroup_CreateIfNotFound("sg_scout1") -- Declare the SG
- sg_defender1 = SGroup_CreateIfNotFound("sg_defender1")
- sg_defendervet1 = SGroup_CreateIfNotFound("sg_defendervet1")
- sg_defendervet2 = SGroup_CreateIfNotFound("sg_defendervet2")
- sg_counter1 = SGroup_CreateIfNotFound("sg_counter1")
- sg_counter2 = SGroup_CreateIfNotFound("sg_counter2")
- sg_defenders = SGroup_CreateIfNotFound("sg_defenders")
- sg_defendertotal = SGroup_CreateIfNotFound("sg_defendertotal")
- sg_scout2 = SGroup_CreateIfNotFound("sg_scout2")
- sg_sdkfz251 = SGroup_CreateIfNotFound("sg_sdkfz251")
- sg_reinforcement = SGroup_CreateIfNotFound("sg_reinforcement")
- sg_reinforcement1 = SGroup_CreateIfNotFound("sg_reinforcement1")
- sg_totalscout = SGroup_CreateIfNotFound("sg_totalscout")
- sg_11attackforce = SGroup_CreateIfNotFound("sg_11attackforce")
- sg_6attackforce = SGroup_CreateIfNotFound("sg_6attackforce")
- sg_counterfarm = SGroup_CreateIfNotFound("sg_counterfarm")
- -- Function call
- Restriction();
- InitializeObjectives();
- Villageattack(); -- Call villageattack function
- Modify_Enable_PlayerIssueRetreat();
- -- Intervals
- Rule_AddOneShot(OBJ_Farm_Mission, 2);
- Rule_AddOneShot(CP_Meter, 1)
- Rule_AddOneShot(BaseStart, 1)
- Rule_AddOneShot(NoRetreat, 1)
- Rule_AddInterval(Move, 2); -- Calls the function every 2th second
- Rule_AddInterval(InstantCapture, 2);
- Rule_AddInterval(Hintmessage, 2);
- -- Functions to test stuff out
- testing();
- end
- Scar_AddInit(OnInit);
- -----------------------------------------------------
- function Restriction()
- g_manpowerrate = Modify_PlayerResourceRate(player1, RT_Manpower, 0, MUT_Multiplication);
- g_fuelrate = Modify_PlayerResourceRate(player1, RT_Fuel, 0, MUT_Multiplication);
- g_munitionrate = Modify_PlayerResourceRate(player1, RT_Munition, 0, MUT_Multiplication);
- Player_SetResource(player1, RT_Manpower, 0);
- Player_SetResource(player1, RT_Fuel, 0);
- Player_SetResource(player1, RT_Munition, 0);
- Player_SetAbilityAvailability(player1, ABILITY.GERMAN.ASSAULT_GRENADIER_GRENADE, ITEM_REMOVED)
- Player_SetAbilityAvailability(player1, ABILITY.GERMAN.GRENADIER_PANZERFAUST_MP, ITEM_REMOVED)
- Player_SetAbilityAvailability(player1, ABILITY.GERMAN.GRENADIER_RIFLE_GRENADE_ABILITY_MP, ITEM_REMOVED)
- Player_SetConstructionMenuAvailability( player1, "tp_construction_german_grenadier", ITEM_REMOVED )
- end
- -----------------------------------------------------
- function InitializeObjectives()
- -- Missions
- OBJ_FARM= {
- SetupUI = function()
- UI_CreateMinimapBlip(farm_point, 10, BT_General)
- end,
- OnStart = function()
- Rule_AddInterval(OBJ_Farm_IsDone, 2);
- Rule_AddInterval(OBJ_Farm_Lose, 10);
- Rule_AddInterval(Farm_Attack_Reinforcement, 2);
- end,
- OnComplete = function()
- Player_AddResource(player1, RT_Manpower, 150);
- Player_AddResource(player1, RT_Munition, 40);
- Rule_AddOneShot(Resources_FarmComplete, 2);
- BuildingExplode()
- TruckDrop()
- Objective_Start(OBJ_COUNTERFARM, true); -- Main
- end,
- OnFail = function()
- end,
- Title = "$f69d864ff41f412f91dfd87227648192:1",
- Description = 0,
- Type = OT_Primary, -- main objective (the star)
- }
- OBJ_COUNTERFARM= {
- SetupUI = function()
- end,
- OnStart = function()
- Counterfarm()
- Rule_AddInterval(OBJ_Counter_Lose, 10);
- Rule_AddInterval(OBJ_Counter_IsDone, 2);
- end,
- OnComplete = function()
- Cmd_MoveToAndDespawn(sg_sdkfz251, mkr_playerspawn1, true);
- BaseBuild()
- hintretreat = HintPoint_Add(mkr_retreat, true, "$f69d864ff41f412f91dfd87227648192:14");
- HintPoint_Remove(hintreinforcetruck);
- Rule_AddOneShot(RemoveHint, 30)
- end,
- OnFail = function()
- end,
- Title = "$f69d864ff41f412f91dfd87227648192:3",
- Description = 0,
- Type = OT_Primary, -- main objective (the star)
- }
- Objective_Register(OBJ_FARM);
- Objective_Register(OBJ_COUNTERFARM);
- end
- -----------------------------------------------------
- function CP_Meter()
- UI_SetCPMeterVisibility(false);
- end
- -----------------------------------------------------
- function Modify_Enable_PlayerIssueRetreat(playerid, value)
- if value == true then
- value = 1
- elseif value == false then
- value = 0
- end
- -- Create the appropriate modifier
- local modifier = Modifier_Create(MAT_Player, "modifiers\\enable_player_issue_retreat.lua", MUT_Enable, false, value, "")
- Modifier_ApplyToPlayer(modifier, playerid)
- end
- -----------------------------------------------------
- function NoRetreat()
- Modify_Enable_PlayerIssueRetreat(player1, false)
- end
- -----------------------------------------------------
- function Resources_FarmComplete()
- Modifier_Remove(g_manpowerrate);
- Modifier_Remove(g_fuelrate);
- Modifier_Remove(g_munitionrate);
- g_manpowerrate = Modify_PlayerResourceRate(player1, RT_Manpower, 0.15, MUT_Multiplication);
- g_fuelrate = Modify_PlayerResourceRate(player1, RT_Fuel, 0, MUT_Multiplication);
- g_munitionrate = Modify_PlayerResourceRate(player1, RT_Munition, 0.4, MUT_Multiplication);
- end
- -----------------------------------------------------
- function Villageattack()
- -- Player1 (17. Armee)
- Util_CreateSquads(player1, sg_scout1, BP_GetSquadBlueprint("assault_grenadier_squad_mp"), mkr_playerspawn2, nil, 10, nil, nil, nil, nil, nil);
- Util_CreateSquads(player1, sg_scout1, BP_GetSquadBlueprint("grenadier_squad_mp"), mkr_playerspawn, nil, 1, nil, nil, nil, nil, nil);
- Util_CreateSquads(player1, sg_scout1, BP_GetSquadBlueprint("grenadier_squad_mp"), mkr_playerspawn1, nil, 1, nil, nil, nil, nil, nil);
- SGroup_AddGroup(sg_totalscout, sg_scout1);
- -- Player2 (Soviet Union)
- Util_CreateSquads(player2, sg_defendervet1, BP_GetSquadBlueprint("conscript_squad_mp"), villageattack_building, nil, 1, nil, nil, nil, nil, nil);
- Util_CreateSquads(player2, sg_defendervet2, BP_GetSquadBlueprint("combat_engineer_squad_mp"), mkr_defenderspawn3, nil, 1, nil, nil, nil, nil, nil);
- Cmd_SquadPatrolMarker( sg_defendervet2, mkr_defenderspawn3 )
- Util_CreateSquads(player2, sg_defender1, BP_GetSquadBlueprint("conscript_squad_mp"), villageattack_building1, nil, 1, nil, nil, nil, nil, nil);
- SGroup_IncreaseVeterancyRank(sg_defendervet1, World_GetRand(1, 2), true);
- SGroup_IncreaseVeterancyRank(sg_defendervet2, World_GetRand(1, 3), true);
- Util_CreateSquads(player2, sg_counter1, BP_GetSquadBlueprint("conscript_squad_mp"), mkr_counterspawn, nil, 1, nil, true, nil, nil, nil);
- SGroup_IncreaseVeterancyRank(sg_counter1, World_GetRand(1, 2), true);
- Util_CreateSquads(player2, sg_counter2, BP_GetSquadBlueprint("conscript_squad_mp"), mkr_counterspawn, nil, 1, nil, true, nil, nil, nil);
- SGroup_IncreaseVeterancyRank(sg_counter2, World_GetRand(1, 2), true);
- SGroup_AddGroup(sg_defenders, sg_defendervet1);
- SGroup_AddGroup(sg_defenders, sg_defendervet2);
- SGroup_AddGroup(sg_defenders, sg_defender1);
- SGroup_AddGroup(sg_defendertotal, sg_defenders);
- SGroup_AddGroup(sg_defendertotal, sg_counter1);
- SGroup_AddGroup(sg_defendertotal, sg_counter2);
- -- Player3 (11. Armee)
- Util_CreateSquads(player3, sg_11attackforce, BP_GetSquadBlueprint("assault_grenadier_squad_mp"), mkr_11attackforce, nil, 1, nil, nil, nil, nil, nil);
- Util_CreateSquads(player3, sg_11attackforce, BP_GetSquadBlueprint("ostruppen_squad_mp"), mkr_11attackforce, nil, 2, nil, nil, nil, nil, nil);
- -- Player5 (6. Armee)
- Util_CreateSquads(player5, sg_6attackforce, BP_GetSquadBlueprint("assault_grenadier_squad_mp"), mkr_6attackforce, nil, 1, nil, nil, nil, nil, nil);
- Util_CreateSquads(player5, sg_6attackforce, BP_GetSquadBlueprint("grenadier_squad_mp"), mkr_6attackforce, nil, 2, nil, nil, nil, nil, nil);
- end
- -----------------------------------------------------
- function Move()
- if (SGroup_Count(sg_defenders) <=1) then
- Cmd_Move(sg_counter1, mkr_defenderspawn1);
- Cmd_Move(sg_counter2, mkr_defenderspawn2);
- Rule_RemoveMe();
- end
- end
- -----------------------------------------------------
- function Farm_Attack_Reinforcement()
- if (SGroup_TotalMembersCount(sg_scout1, false) == 2) then
- Util_MissionTitle("$f69d864ff41f412f91dfd87227648192:2", 2.0, 5.0, 2.0);
- Util_CreateSquads(player1, sg_scout2, BP_GetSquadBlueprint("grenadier_squad_mp"), mkr_playerspawn, nil, 1, nil, nil, nil, nil, nil);
- SGroup_AddGroup(sg_totalscout, sg_scout2);
- Cmd_Move(sg_scout2, mkr_defenderspawn3);
- Rule_RemoveMe();
- end
- end
- -----------------------------------------------------
- function OBJ_Farm_Mission()
- -- Call mission
- Objective_Start(OBJ_FARM, true);
- end
- -----------------------------------------------------
- function OBJ_Farm_Lose()
- -- Lose condition OBJ_Farm_Lose
- if (SGroup_Count(sg_totalscout) == 0) then
- Game_EndSP(false);
- Rule_RemoveAll();
- end
- end
- -----------------------------------------------------
- function InstantCapture()
- if (SGroup_Count(sg_defendertotal) == 0) then
- EGroup_InstantCaptureStrategicPoint( farm_point, player1 )
- Rule_RemoveMe();
- end
- end
- -----------------------------------------------------
- function OBJ_Farm_IsDone()
- if (EGroup_IsCapturedByPlayer( farm_point, player1, ANY ) and SGroup_Count(sg_defendertotal) == 0) then
- Objective_Complete(OBJ_FARM, true);
- end
- end
- -----------------------------------------------------
- function TruckDrop()
- Util_CreateSquads(player5, sg_sdkfz251, BP_GetSquadBlueprint("sdkfz_251_halftrack_squad_mp"), mkr_playerspawn, mkr_truckfarm1, 1, nil, nil, nil, nil, nil);
- Util_CreateSquads(player5, sg_reinforcement1, BP_GetSquadBlueprint("mg42_heavy_machine_gun_squad_mp"), sg_sdkfz251, nil, 1, nil, nil, nil, nil, nil);
- Cmd_EjectOccupants(sg_sdkfz251, mkr_truckfarm1, true);
- SGroup_SetPlayerOwner(sg_reinforcement1, player1);
- end
- -----------------------------------------------------
- function Hintmessage()
- if (Prox_AreSquadsNearMarker(sg_sdkfz251, mkr_truckfarm1, false, 5)) then
- hintreinforcetruck = HintPoint_Add(mkr_truckfarm1, true, "$f69d864ff41f412f91dfd87227648192:12");
- Rule_RemoveMe();
- end
- end
- -----------------------------------------------------
- function BuildingExplode()
- Player_AddAbility(player2, BP_GetAbilityBlueprint("light_support_artillery"));
- t_villageblowup = {mkr_villageblowup, mkr_villageblowup1, mkr_villageblowup2, mkr_villageblowup3};
- Cmd_Ability(player2, BP_GetAbilityBlueprint("light_support_artillery"), t_villageblowup[World_GetRand(1, #t_villageblowup)], nil, true, false);
- end
- -----------------------------------------------------
- function Counterfarm()
- Util_CreateSquads(player2, sg_counterfarm, BP_GetSquadBlueprint("penal_battalion_mp"), mkr_counterfarm, mkr_farmattack3, 1, nil, nil, nil, nil, nil);
- Util_CreateSquads(player2, sg_counterfarm, BP_GetSquadBlueprint("conscript_squad_mp"), mkr_counterfarm1, mkr_farmattack2, 1, nil, nil, nil, nil, nil);
- Util_CreateSquads(player2, sg_counterfarm, BP_GetSquadBlueprint("conscript_squad_mp"), mkr_counterfarm2, mkr_farmattack1, 1, nil, nil, nil, nil, nil);
- Util_CreateSquads(player2, sg_counterfarm, BP_GetSquadBlueprint("penal_battalion_mp"), mkr_counterfarm3, mkr_farmattack, 1, nil, nil, nil, nil, nil);
- Rule_RemoveMe();
- end
- -----------------------------------------------------
- function OBJ_Counter_IsDone()
- if (SGroup_Count(sg_counterfarm) == 0) then
- Objective_Complete(OBJ_COUNTERFARM, true);
- end
- end
- -----------------------------------------------------
- function OBJ_Counter_Lose()
- -- Lose condition OBJ_Farm_Lose
- if (SGroup_Count(sg_totalscout) == 0) then
- Game_EndSP(false);
- Rule_RemoveAll();
- end
- end
- -----------------------------------------------------
- function BaseStart()
- EGroup_DeSpawn(baseobject);
- EGroup_DeSpawn(baseflag);
- EGroup_DeSpawn(baseflag1);
- EGroup_DeSpawn(basereinforce);
- EGroup_DeSpawn(basereinforce1);
- EGroup_DeSpawn(retreat);
- end
- -----------------------------------------------------
- function BaseBuild()
- Modify_Enable_PlayerIssueRetreat(player1, true)
- Camera_MoveTo(mkr_camerabase, true, SLOW_CAMERA_PANNING, true, true);
- Game_FadeToBlack(FADE_OUT, 2)
- EGroup_DeSpawn(firstbase);
- if (EGroup_GetAvgHealth(villageattack_building) > 0) then
- hintbase = HintPoint_Add(mkr_villageblowup2, true, "$f69d864ff41f412f91dfd87227648192:13");
- EGroup_ReSpawn(baseobject);
- EGroup_ReSpawn(baseflag);
- EGroup_ReSpawn(basereinforce);
- EGroup_ReSpawn(retreat);
- else
- hintbase = HintPoint_Add(mkr_villageblowup, true, "$f69d864ff41f412f91dfd87227648192:13");
- EGroup_ReSpawn(baseobject);
- EGroup_ReSpawn(baseflag1);
- EGroup_ReSpawn(basereinforce1);
- EGroup_ReSpawn(retreat);
- end
- Game_FadeToBlack(FADE_IN, 0.5)
- end
- -----------------------------------------------------
- function RemoveHint()
- HintPoint_Remove(hintbase);
- HintPoint_Remove(hintretreat);
- end
- -----------------------------------------------------
- function testing()
- FOW_Enable(true)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement