Merge pull request #8693 from abcdefg30/difficultyA02

Add different difficulties for allies02
This commit is contained in:
Oliver Brakmann
2015-07-19 23:33:29 +02:00
2 changed files with 247 additions and 125 deletions

View File

@@ -7,10 +7,62 @@ JeepPath = { ReinforcementsEntryPoint.Location, ReinforcementsRallyPoint.Locatio
TruckReinforcements = { "truk", "truk", "truk" } TruckReinforcements = { "truk", "truk", "truk" }
TruckPath = { TruckEntryPoint.Location, TruckRallyPoint.Location } TruckPath = { TruckEntryPoint.Location, TruckRallyPoint.Location }
TimerTicks = DateTime.Minutes(10) PathGuards = { PathGuard1, PathGuard2, PathGuard3, PathGuard4, PathGuard5, PathGuard6, PathGuard7, PathGuard8, PathGuard9, PathGuard10, PathGuard11, PathGuard12, PathGuard13, PathGuard14, PathGuard15 }
SendConstructionVehicleReinforcements = function() IdlingUnits = { }
local mcv = Reinforcements.Reinforce(player, ConstructionVehicleReinforcements, ConstructionVehiclePath)[1]
if Map.Difficulty == "Easy" then
TimerTicks = DateTime.Minutes(10)
Announcements =
{
{ "TenMinutesRemaining", DateTime.Seconds(3) },
{ "WarningFiveMinutesRemaining", DateTime.Minutes(5) },
{ "WarningFourMinutesRemaining", DateTime.Minutes(6) },
{ "WarningThreeMinutesRemaining", DateTime.Minutes(7) },
{ "WarningTwoMinutesRemaining", DateTime.Minutes(8) },
{ "WarningOneMinuteRemaining", DateTime.Minutes(9) }
}
elseif Map.Difficulty == "Normal" then
TimerTicks = DateTime.Minutes(5)
Announcements =
{
{ "WarningFiveMinutesRemaining", DateTime.Seconds(3) },
{ "WarningFourMinutesRemaining", DateTime.Minutes(6) },
{ "WarningThreeMinutesRemaining", DateTime.Minutes(7) },
{ "WarningTwoMinutesRemaining", DateTime.Minutes(8) },
{ "WarningOneMinuteRemaining", DateTime.Minutes(9) }
}
InfantryTypes = { "e1", "e1", "e1", "e2", "e2", "e1" }
InfantryDelay = DateTime.Seconds(18)
AttackGroupSize = 5
elseif Map.Difficulty == "Hard" then
TimerTicks = DateTime.Minutes(3)
Announcements =
{
{ "WarningThreeMinutesRemaining", DateTime.Seconds(3) },
{ "WarningTwoMinutesRemaining", DateTime.Minutes(1) },
{ "WarningOneMinuteRemaining", DateTime.Minutes(2) },
}
InfantryTypes = { "e1", "e1", "e1", "e2", "e2", "e1" }
InfantryDelay = DateTime.Seconds(10)
VehicleTypes = { "ftrk" }
VehicleDelay = DateTime.Seconds(30)
AttackGroupSize = 7
else
TimerTicks = DateTime.Minutes(1)
Announcements = { { "WarningOneMinuteRemaining", DateTime.Seconds(3) } }
ConstructionVehicleReinforcements = { "jeep" }
InfantryTypes = { "e1", "e1", "e1", "e2", "e2", "dog", "dog" }
InfantryDelay = DateTime.Seconds(10)
VehicleTypes = { "ftrk" }
VehicleDelay = DateTime.Minutes(1) + DateTime.Seconds(10)
AttackGroupSize = 5
end end
SendJeepReinforcements = function() SendJeepReinforcements = function()
@@ -20,27 +72,97 @@ end
RunInitialActivities = function() RunInitialActivities = function()
Harvester.FindResources() Harvester.FindResources()
Trigger.OnKilled(Harvester, function() HarvesterKilled = true end)
Trigger.OnAllKilled(PathGuards, SendTrucks)
if InfantryTypes then
Trigger.AfterDelay(InfantryDelay, InfantryProduction)
end
if VehicleTypes then
Trigger.AfterDelay(VehicleDelay, VehicleProduction)
end
end end
MissionAccomplished = function() InfantryProduction = function()
Media.PlaySpeechNotification(player, "MissionAccomplished") if SovietBarracks.IsDead then
return
end
local toBuild = { Utils.Random(InfantryTypes) }
if SovietKennel.IsDead and toBuild == "dog" then
toBuild = "e1"
end
ussr.Build(toBuild, function(unit)
IdlingUnits[#IdlingUnits + 1] = unit[1]
Trigger.AfterDelay(InfantryDelay, InfantryProduction)
if #IdlingUnits >= (AttackGroupSize * 1.5) then
SendAttack()
end
end)
end end
MissionFailed = function() VehicleProduction = function()
Media.PlaySpeechNotification(player, "MissionFailed") if SovietWarfactory.IsDead then
return
end
if HarvesterKilled then
ussr.Build({ "harv" }, function(harv)
harv[1].FindResources()
Trigger.OnKilled(harv[1], function() HarvesterKilled = true end)
HarvesterKilled = false
VehicleProduction()
end)
return
end
local toBuild = { Utils.Random(VehicleTypes) }
ussr.Build(toBuild, function(unit)
IdlingUnits[#IdlingUnits + 1] = unit[1]
Trigger.AfterDelay(VehicleDelay, VehicleProduction)
if #IdlingUnits >= (AttackGroupSize * 1.5) then
SendAttack()
end
end)
end
SendAttack = function()
local units = { }
for i = 0, AttackGroupSize, 1 do
local number = Utils.RandomInteger(1, #IdlingUnits)
if IdlingUnits[number] and not IdlingUnits[number].IsDead then
units[i] = IdlingUnits[number]
table.remove(IdlingUnits, number)
end
end
Utils.Do(units, function(unit)
if Map.Difficulty ~= "Real tough guy" then
unit.AttackMove(DeployPoint.Location)
end
Trigger.OnIdle(unit, unit.Hunt)
end)
end end
ticked = TimerTicks ticked = TimerTicks
Tick = function() Tick = function()
ussr.Resources = ussr.Resources - (0.01 * ussr.ResourceCapacity / 25) ussr.Resources = ussr.Resources - (0.01 * ussr.ResourceCapacity / 25)
if ukraine.HasNoRequiredUnits() then if ussr.HasNoRequiredUnits() then
SendTrucks()
player.MarkCompletedObjective(ConquestObjective) player.MarkCompletedObjective(ConquestObjective)
end end
if player.HasNoRequiredUnits() then if player.HasNoRequiredUnits() then
player.MarkFailedObjective(ConquestObjective) ussr.MarkCompletedObjective(ussrObj)
end end
if ticked > 0 then if ticked > 0 then
@@ -69,8 +191,11 @@ ConvoyOnSite = false
SendTrucks = function() SendTrucks = function()
if not ConvoyOnSite then if not ConvoyOnSite then
ConvoyOnSite = true ConvoyOnSite = true
ticked = 0 ticked = 0
ConvoyObjective = player.AddPrimaryObjective("Escort the convoy.") ConvoyObjective = player.AddPrimaryObjective("Escort the convoy.")
player.MarkCompletedObjective(SecureObjective)
Media.PlaySpeechNotification(player, "ConvoyApproaching") Media.PlaySpeechNotification(player, "ConvoyApproaching")
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
ConvoyUnharmed = true ConvoyUnharmed = true
@@ -102,19 +227,20 @@ ConvoyCasualites = function()
end end
end end
ConvoyTimer = function(delay, notification) ConvoyTimerAnnouncements = function()
Trigger.AfterDelay(delay, function() for i = #Announcements, 1, -1 do
if not ConvoyOnSite then Trigger.AfterDelay(Announcements[i][2], function()
Media.PlaySpeechNotification(player, notification) if not ConvoyOnSite then
end Media.PlaySpeechNotification(player, Announcements[i][1])
end) end
end)
end
end end
WorldLoaded = function() WorldLoaded = function()
player = Player.GetPlayer("Greece") player = Player.GetPlayer("Greece")
france = Player.GetPlayer("France") france = Player.GetPlayer("France")
ussr = Player.GetPlayer("USSR") ussr = Player.GetPlayer("USSR")
ukraine = Player.GetPlayer("Ukraine")
Trigger.OnObjectiveAdded(player, function(p, id) Trigger.OnObjectiveAdded(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
@@ -125,26 +251,28 @@ WorldLoaded = function()
Trigger.OnObjectiveFailed(player, function(p, id) Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end) end)
Trigger.OnPlayerLost(player, MissionFailed) Trigger.OnPlayerLost(player, function()
Trigger.OnPlayerWon(player, MissionAccomplished) Media.PlaySpeechNotification(player, "MissionFailed")
end)
Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(player, "MissionAccomplished")
end)
ConquestObjective = player.AddPrimaryObjective("Secure the area.") ussrObj = ussr.AddPrimaryObjective("Deny the allies!")
SecureObjective = player.AddPrimaryObjective("Secure the convoy's path.")
ConquestObjective = player.AddPrimaryObjective("Eliminate the entire soviet presence in this area.")
Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(allies, "MissionTimerInitialised") end) Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(allies, "MissionTimerInitialised") end)
RunInitialActivities() RunInitialActivities()
SendConstructionVehicleReinforcements() Reinforcements.Reinforce(player, ConstructionVehicleReinforcements, ConstructionVehiclePath)
Trigger.AfterDelay(DateTime.Seconds(5), SendJeepReinforcements) Trigger.AfterDelay(DateTime.Seconds(5), SendJeepReinforcements)
Trigger.AfterDelay(DateTime.Seconds(10), SendJeepReinforcements) Trigger.AfterDelay(DateTime.Seconds(10), SendJeepReinforcements)
Camera.Position = ReinforcementsEntryPoint.CenterPosition Camera.Position = ReinforcementsEntryPoint.CenterPosition
TimerColor = player.Color TimerColor = player.Color
ConvoyTimer(DateTime.Seconds(3), "TenMinutesRemaining") ConvoyTimerAnnouncements()
ConvoyTimer(DateTime.Minutes(5), "WarningFiveMinutesRemaining")
ConvoyTimer(DateTime.Minutes(6), "WarningFourMinutesRemaining")
ConvoyTimer(DateTime.Minutes(7), "WarningThreeMinutesRemaining")
ConvoyTimer(DateTime.Minutes(8), "WarningTwoMinutesRemaining")
ConvoyTimer(DateTime.Minutes(9), "WarningOneMinuteRemaining")
end end

View File

@@ -33,32 +33,26 @@ Options:
StartingCash: 5700 StartingCash: 5700
ConfigurableStartingUnits: False ConfigurableStartingUnits: False
ShortGame: False ShortGame: False
Difficulties: Easy, Normal, Hard, Real tough guy
Players: Players:
PlayerReference@USSR: PlayerReference@USSR:
Name: USSR Name: USSR
Faction: soviet Faction: soviet
ColorRamp: 3,255,127 ColorRamp: 3,255,127
Allies: Ukraine
Enemies: Greece, France Enemies: Greece, France
PlayerReference@France: PlayerReference@France:
Name: France Name: France
NonCombatant: True NonCombatant: True
Faction: allies Faction: allies
ColorRamp: 115,115,143 ColorRamp: 115,115,143
Allies: Greece, France Allies: Greece
Enemies: USSR, Ukraine Enemies: USSR
PlayerReference@Neutral: PlayerReference@Neutral:
Name: Neutral Name: Neutral
OwnsWorld: True OwnsWorld: True
NonCombatant: True NonCombatant: True
Faction: allies Faction: allies
PlayerReference@Ukraine:
Name: Ukraine
Faction: soviet
ColorRamp: 3,255,127
Allies: USSR
Enemies: Greece, France
PlayerReference@Greece: PlayerReference@Greece:
Name: Greece Name: Greece
Playable: True Playable: True
@@ -71,7 +65,7 @@ Players:
LockSpawn: True LockSpawn: True
LockTeam: True LockTeam: True
Allies: France Allies: France
Enemies: USSR, Ukraine Enemies: USSR
Actors: Actors:
EntryPoint: t06 EntryPoint: t06
@@ -255,16 +249,9 @@ Actors:
Actor60: powr Actor60: powr
Location: 57,62 Location: 57,62
Owner: USSR Owner: USSR
Actor61: barr
Location: 56,66
Owner: USSR
Actor62: powr Actor62: powr
Location: 59,62 Location: 59,62
Owner: USSR Owner: USSR
Actor63: kenn
Location: 58,68
Owner: USSR
Health: 99
Actor64: brl3 Actor64: brl3
Location: 65,59 Location: 65,59
Owner: USSR Owner: USSR
@@ -395,7 +382,7 @@ Actors:
SubCell: 0 SubCell: 0
Actor103: e1 Actor103: e1
Location: 77,74 Location: 77,74
Owner: Ukraine Owner: USSR
Facing: 128 Facing: 128
SubCell: 2 SubCell: 2
Actor104: e1 Actor104: e1
@@ -408,11 +395,6 @@ Actors:
Owner: USSR Owner: USSR
Facing: 160 Facing: 160
SubCell: 3 SubCell: 3
Actor106: e1
Location: 50,72
Owner: USSR
Facing: 160
SubCell: 4
Actor107: e1 Actor107: e1
Location: 73,60 Location: 73,60
Owner: USSR Owner: USSR
@@ -428,31 +410,6 @@ Actors:
Owner: USSR Owner: USSR
Facing: 64 Facing: 64
SubCell: 0 SubCell: 0
Actor110: e1
Location: 49,58
Owner: USSR
Facing: 192
SubCell: 0
Actor111: e1
Location: 51,58
Owner: USSR
Facing: 32
SubCell: 1
Actor112: e1
Location: 60,78
Owner: USSR
Facing: 192
SubCell: 4
Actor113: e2
Location: 62,79
Owner: USSR
Facing: 160
SubCell: 4
Actor114: e1
Location: 57,82
Owner: USSR
Facing: 160
SubCell: 1
Actor115: e1 Actor115: e1
Location: 60,64 Location: 60,64
Owner: USSR Owner: USSR
@@ -463,11 +420,6 @@ Actors:
Owner: USSR Owner: USSR
Facing: 96 Facing: 96
SubCell: 0 SubCell: 0
Actor117: e1
Location: 48,72
Owner: USSR
Facing: 96
SubCell: 0
Actor118: e1 Actor118: e1
Location: 57,69 Location: 57,69
Owner: USSR Owner: USSR
@@ -505,58 +457,19 @@ Actors:
SubCell: 1 SubCell: 1
Actor125: dog Actor125: dog
Location: 78,75 Location: 78,75
Owner: Ukraine Owner: USSR
Facing: 160 Facing: 160
SubCell: 1 SubCell: 1
Actor126: e1 Actor126: e1
Location: 71,61 Location: 71,61
Owner: Ukraine Owner: USSR
Facing: 160 Facing: 160
SubCell: 0 SubCell: 0
Actor127: dog Actor127: dog
Location: 70,61 Location: 70,61
Owner: Ukraine Owner: USSR
Facing: 96 Facing: 96
SubCell: 4 SubCell: 4
Actor128: e1
Location: 50,46
Owner: Ukraine
Facing: 32
SubCell: 1
Actor129: e1
Location: 49,47
Owner: Ukraine
Facing: 64
SubCell: 0
Actor130: e2
Location: 49,49
Owner: Ukraine
Facing: 160
SubCell: 1
Actor131: e2
Location: 47,46
Owner: Ukraine
Facing: 96
SubCell: 3
Actor132: e2
Location: 48,63
Owner: Ukraine
SubCell: 1
Actor133: e1
Location: 49,63
Owner: Ukraine
Facing: 96
SubCell: 2
Actor134: e1
Location: 74,81
Owner: Ukraine
Facing: 64
SubCell: 3
Actor135: e2
Location: 75,83
Owner: Ukraine
Facing: 96
SubCell: 0
Actor136: e2 Actor136: e2
Location: 69,66 Location: 69,66
Owner: USSR Owner: USSR
@@ -668,6 +581,13 @@ Actors:
Actor170: fenc Actor170: fenc
Location: 50,51 Location: 50,51
Owner: USSR Owner: USSR
SovietKennel: kenn
Location: 58,68
Owner: USSR
Health: 99
SovietBarracks: barr
Location: 56,66
Owner: USSR
SovietWarfactory: weap SovietWarfactory: weap
Location: 60,66 Location: 60,66
Owner: USSR Owner: USSR
@@ -676,6 +596,80 @@ Actors:
Owner: USSR Owner: USSR
Health: 50 Health: 50
Facing: 160 Facing: 160
PathGuard1: e1
Location: 50,72
Owner: USSR
Facing: 160
SubCell: 4
PathGuard2: e1
Location: 49,58
Owner: USSR
Facing: 192
SubCell: 0
PathGuard3: e1
Location: 51,58
Owner: USSR
Facing: 32
SubCell: 1
PathGuard4: e1
Location: 60,78
Owner: USSR
Facing: 192
SubCell: 4
PathGuard5: e2
Location: 62,79
Owner: USSR
Facing: 160
SubCell: 4
PathGuard6: e1
Location: 48,72
Owner: USSR
Facing: 96
SubCell: 0
PathGuard7: e1
Location: 50,46
Owner: USSR
Facing: 32
SubCell: 1
PathGuard8: e1
Location: 49,47
Owner: USSR
Facing: 64
SubCell: 0
PathGuard9: e2
Location: 49,49
Owner: USSR
Facing: 160
SubCell: 1
PathGuard10: e2
Location: 47,46
Owner: USSR
Facing: 96
SubCell: 3
PathGuard11: e2
Location: 48,63
Owner: USSR
SubCell: 1
PathGuard12: e1
Location: 49,63
Owner: USSR
Facing: 96
SubCell: 2
PathGuard13: e1
Location: 74,81
Owner: USSR
Facing: 64
SubCell: 3
PathGuard14: e2
Location: 75,83
Owner: USSR
Facing: 96
SubCell: 0
PathGuard15: e1
Location: 57,82
Owner: USSR
Facing: 160
SubCell: 1
TruckEntryPoint: waypoint TruckEntryPoint: waypoint
Location: 49,44 Location: 49,44
Owner: Neutral Owner: Neutral
@@ -748,6 +742,9 @@ Rules:
GenericVisibility: Enemy, Ally, Neutral GenericVisibility: Enemy, Ally, Neutral
GenericStancePrefix: false GenericStancePrefix: false
ShowOwnerRow: false ShowOwnerRow: false
HARV:
Buildable:
Prerequisites: weap
APWR: APWR:
Buildable: Buildable:
Prerequisites: ~disabled Prerequisites: ~disabled
@@ -805,9 +802,6 @@ Rules:
E7: E7:
Buildable: Buildable:
Prerequisites: ~disabled Prerequisites: ~disabled
HIJACKER:
Buildable:
Prerequisites: ~disabled
FACF: FACF:
Buildable: Buildable:
Prerequisites: ~disabled Prerequisites: ~disabled