replace GDI/Nod player reference variables with player/enemy
fixes unit production in nod02a and nod02b (killed infantry wouldn't get rebuilt)
This commit is contained in:
@@ -42,9 +42,9 @@ getActors = function(owner, units)
|
||||
end
|
||||
|
||||
InsertNodUnits = function()
|
||||
Media.PlaySpeechNotification(Nod, "Reinforce")
|
||||
Reinforcements.Reinforce(Nod, NodUnits, { UnitsEntry.Location, UnitsRally.Location }, 15)
|
||||
Reinforcements.Reinforce(Nod, { "mcv" }, { McvEntry.Location, McvRally.Location })
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Reinforcements.Reinforce(player, NodUnits, { UnitsEntry.Location, UnitsRally.Location }, 15)
|
||||
Reinforcements.Reinforce(player, { "mcv" }, { McvEntry.Location, McvRally.Location })
|
||||
end
|
||||
|
||||
OnAnyDamaged = function(actors, func)
|
||||
@@ -66,14 +66,14 @@ CheckForBase = function(player)
|
||||
end
|
||||
|
||||
DfndTriggerFunction = function()
|
||||
local list = GDI.GetGroundAttackers()
|
||||
local list = enemy.GetGroundAttackers()
|
||||
Utils.Do(list, function(unit)
|
||||
IdleHunt(unit)
|
||||
end)
|
||||
end
|
||||
|
||||
Atk2TriggerFunction = function()
|
||||
local MyActors = getActors(GDI, { ['e1'] = 3 })
|
||||
local MyActors = getActors(enemy, { ['e1'] = 3 })
|
||||
Utils.Do(MyActors, function(actor)
|
||||
Atk2Movement(actor)
|
||||
end)
|
||||
@@ -82,7 +82,7 @@ end
|
||||
Atk3TriggerFunction = function()
|
||||
if not Atk3TriggerSwitch then
|
||||
Atk3TriggerSwitch = true
|
||||
MyActors = getActors(GDI, { ['e1'] = 4 })
|
||||
MyActors = getActors(enemy, { ['e1'] = 4 })
|
||||
Utils.Do(MyActors, function(actor)
|
||||
Atk3Movement(actor)
|
||||
end)
|
||||
@@ -90,28 +90,28 @@ Atk3TriggerFunction = function()
|
||||
end
|
||||
|
||||
Atk5TriggerFunction = function()
|
||||
local MyActors = getActors(GDI, { ['e1'] = 3 })
|
||||
local MyActors = getActors(enemy, { ['e1'] = 3 })
|
||||
Utils.Do(MyActors, function(actor)
|
||||
Atk2Movement(actor)
|
||||
end)
|
||||
end
|
||||
|
||||
Atk6TriggerFunction = function()
|
||||
local MyActors = getActors(GDI, { ['e1'] = 4 })
|
||||
local MyActors = getActors(enemy, { ['e1'] = 4 })
|
||||
Utils.Do(MyActors, function(actor)
|
||||
Atk3Movement(actor)
|
||||
end)
|
||||
end
|
||||
|
||||
Atk7TriggerFunction = function()
|
||||
local MyActors = getActors(GDI, { ['e1'] = 3 })
|
||||
local MyActors = getActors(enemy, { ['e1'] = 3 })
|
||||
Utils.Do(MyActors, function(actor)
|
||||
Atk4Movement(actor)
|
||||
end)
|
||||
end
|
||||
|
||||
Pat1TriggerFunction = function()
|
||||
local MyActors = getActors(GDI, { ['e1'] = 3 })
|
||||
local MyActors = getActors(enemy, { ['e1'] = 3 })
|
||||
Utils.Do(MyActors, function(actor)
|
||||
Pat1Movement(actor)
|
||||
end)
|
||||
@@ -153,32 +153,32 @@ Pat1Movement = function(unit)
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
GDI = Player.GetPlayer("GDI")
|
||||
Nod = Player.GetPlayer("Nod")
|
||||
player = Player.GetPlayer("Nod")
|
||||
enemy = Player.GetPlayer("GDI")
|
||||
|
||||
Trigger.OnObjectiveAdded(Nod, function(p, id)
|
||||
Trigger.OnObjectiveAdded(player, function(p, id)
|
||||
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
|
||||
end)
|
||||
|
||||
Trigger.OnObjectiveCompleted(Nod, function(p, id)
|
||||
Trigger.OnObjectiveCompleted(player, function(p, id)
|
||||
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
|
||||
end)
|
||||
|
||||
Trigger.OnObjectiveFailed(Nod, function(p, id)
|
||||
Trigger.OnObjectiveFailed(player, function(p, id)
|
||||
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
|
||||
end)
|
||||
|
||||
Trigger.OnPlayerWon(Nod, function()
|
||||
Media.PlaySpeechNotification(Nod, "Win")
|
||||
Trigger.OnPlayerWon(player, function()
|
||||
Media.PlaySpeechNotification(player, "Win")
|
||||
end)
|
||||
|
||||
Trigger.OnPlayerLost(Nod, function()
|
||||
Media.PlaySpeechNotification(Nod, "Lose")
|
||||
Trigger.OnPlayerLost(player, function()
|
||||
Media.PlaySpeechNotification(player, "Lose")
|
||||
end)
|
||||
|
||||
NodObjective1 = Nod.AddPrimaryObjective("Build a base.")
|
||||
NodObjective2 = Nod.AddPrimaryObjective("Destroy the GDI base.")
|
||||
GDIObjective = GDI.AddPrimaryObjective("Kill all enemies.")
|
||||
NodObjective1 = player.AddPrimaryObjective("Build a base.")
|
||||
NodObjective2 = player.AddPrimaryObjective("Destroy the GDI base.")
|
||||
GDIObjective = enemy.AddPrimaryObjective("Kill all enemies.")
|
||||
|
||||
OnAnyDamaged(Atk3ActorTriggerActivator, Atk3TriggerFunction)
|
||||
Trigger.OnAllRemovedFromWorld(DfndActorTriggerActivator, DfndTriggerFunction)
|
||||
@@ -190,8 +190,8 @@ WorldLoaded = function()
|
||||
Trigger.AfterDelay(Pat1TriggerFunctionTime, Pat1TriggerFunction)
|
||||
|
||||
Trigger.OnEnteredFootprint(Atk1CellTriggerActivator, function(a, id)
|
||||
if a.Owner == Nod then
|
||||
MyActors = getActors(GDI, { ['e1'] = 5 })
|
||||
if a.Owner == player then
|
||||
MyActors = getActors(enemy, { ['e1'] = 5 })
|
||||
Utils.Do(MyActors, function(actor)
|
||||
Atk1Movement(actor)
|
||||
end)
|
||||
@@ -200,8 +200,8 @@ WorldLoaded = function()
|
||||
end)
|
||||
|
||||
Trigger.OnEnteredFootprint(Atk4CellTriggerActivator, function(a, id)
|
||||
if a.Owner == Nod then
|
||||
MyActors = getActors(GDI, { ['e1'] = 3 } )
|
||||
if a.Owner == player then
|
||||
MyActors = getActors(enemy, { ['e1'] = 3 } )
|
||||
Utils.Do(MyActors, function(actor)
|
||||
Atk2Movement(actor)
|
||||
end)
|
||||
@@ -214,22 +214,22 @@ WorldLoaded = function()
|
||||
end
|
||||
|
||||
Tick = function()
|
||||
if GDI.HasNoRequiredUnits() then
|
||||
Nod.MarkCompletedObjective(NodObjective2)
|
||||
if enemy.HasNoRequiredUnits() then
|
||||
player.MarkCompletedObjective(NodObjective2)
|
||||
end
|
||||
|
||||
if Nod.HasNoRequiredUnits() then
|
||||
if player.HasNoRequiredUnits() then
|
||||
if DateTime.GameTime > 2 then
|
||||
GDI.MarkCompletedObjective(GDIObjective)
|
||||
enemy.MarkCompletedObjective(GDIObjective)
|
||||
end
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(1) == 0 and not Nod.IsObjectiveCompleted(NodObjective1) and CheckForBase(Nod) then
|
||||
Nod.MarkCompletedObjective(NodObjective1)
|
||||
if DateTime.GameTime % DateTime.Seconds(1) == 0 and not player.IsObjectiveCompleted(NodObjective1) and CheckForBase(player) then
|
||||
player.MarkCompletedObjective(NodObjective1)
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(3) == 0 and Barracks.IsInWorld and Barracks.Owner == gdi then
|
||||
checkProduction(GDI)
|
||||
if DateTime.GameTime % DateTime.Seconds(3) == 0 and Barracks.IsInWorld and Barracks.Owner == enemy then
|
||||
checkProduction(enemy)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -252,7 +252,7 @@ end
|
||||
|
||||
getStartUnits = function()
|
||||
local Units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
|
||||
return actor.Owner == GDI
|
||||
return actor.Owner == enemy
|
||||
end)
|
||||
Utils.Do(Units, function(unit)
|
||||
if unit.Type == UnitToRebuild then
|
||||
|
||||
Reference in New Issue
Block a user