[ X ]
Map crashes
Post new topic   Reply to topic Page 1 of 1
View previous topic :: View next topic  
Author Message
SethXXX
Level: 51


Position: Registered User
Joined: 30 Aug 2014
Posts: 5
Kel: 8  [ Donate ]

Online Status: Offline
PostPosted: Tue Nov 14, 2017 8:14 pm    Post subject: Map crashes Reply with quote

Dear community, it's me again, probably with a similarly easily fixable problem, but I cannot find the solution.

My custom map crashes with the following error in its Lua script:

Code:
Fatal Lua Error: Error parsing rollingthunder.lua. Reason: [string "rollingthunder.lua"]:245: 'end' expected (to close 'function' at line 221) near '<eof>'
  at OpenRA.Scripting.ScriptContext.FatalError (System.String message) [0x00000] in <771c3876cf2a484a81272dd7e11c4f46>:0
  at System.Reflection.MonoMethod.InternalInvoke (System.Reflection.MonoMethod , System.Object , System.Object[] , System.Exception& ) [0x00000] in <73ee1b14c2fa4d61b481096ff3d8d6d7>:0
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <73ee1b14c2fa4d61b481096ff3d8d6d7>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <73ee1b14c2fa4d61b481096ff3d8d6d7>:0
  at Eluant.LuaRuntime+MethodWrapper.Invoke (System.Object[] parms) [0x00000] in <c8bc0b4612b543268b8307855c69585a>:0
  at Eluant.LuaRuntime.MakeManagedCall (System.IntPtr state, Eluant.LuaRuntime+MethodWrapper wrapper) [0x00000] in <c8bc0b4612b543268b8307855c69585a>:0
  at Eluant.LuaRuntime.MethodWrapperCallCallback (System.IntPtr state) [0x00000] in <c8bc0b4612b543268b8307855c69585a>:0
  at Eluant.LuaRuntime.MethodWrapperCallCallbackWrapper (System.IntPtr state) [0x00000] in <c8bc0b4612b543268b8307855c69585a>:0
  at Eluant.LuaApi.lua_pcall (System.IntPtr , System.Int32 , System.Int32 , System.Int32 ) [0x00000] in <c8bc0b4612b543268b8307855c69585a>:0
  at Eluant.LuaRuntime.Call (System.Collections.Generic.IList`1[T] args) [0x00000] in <c8bc0b4612b543268b8307855c69585a>:0
  at Eluant.LuaRuntime.Call (Eluant.LuaFunction fn, System.Collections.Generic.IList`1[T] args) [0x00000] in <c8bc0b4612b543268b8307855c69585a>:0
  at Eluant.LuaFunction.Call (System.Collections.Generic.IList`1[T] args) [0x00000] in <c8bc0b4612b543268b8307855c69585a>:0
  at Eluant.LuaFunction.Call (Eluant.LuaValue[] args) [0x00000] in <c8bc0b4612b543268b8307855c69585a>:0
  at OpenRA.Scripting.ScriptContext..ctor (OpenRA.World world, OpenRA.Graphics.WorldRenderer worldRenderer, System.Collections.Generic.IEnumerable`1[T] scripts) [0x00000] in <771c3876cf2a484a81272dd7e11c4f46>:0
  at OpenRA.Mods.Common.Scripting.LuaScript.WorldLoaded (OpenRA.World world, OpenRA.Graphics.WorldRenderer worldRenderer) [0x0001d] in <873ffb3d96084d8eb6211bef70b4ce72>:0
  at OpenRA.World.LoadComplete (OpenRA.Graphics.WorldRenderer wr) [0x00000] in <771c3876cf2a484a81272dd7e11c4f46>:0
  at OpenRA.Game.StartGame (System.String mapUID, OpenRA.WorldType type) [0x00000] in <771c3876cf2a484a81272dd7e11c4f46>:0
  at OpenRA.Network.UnitOrders.ProcessOrder (OpenRA.Network.OrderManager orderManager, OpenRA.World world, System.Int32 clientId, OpenRA.Order order) [0x00000] in <771c3876cf2a484a81272dd7e11c4f46>:0
  at OpenRA.Network.OrderManager.TickImmediate () [0x00000] in <771c3876cf2a484a81272dd7e11c4f46>:0
  at OpenRA.Sync+<CheckSyncUnchanged>c__AnonStorey0.<>m__0 () [0x00000] in <771c3876cf2a484a81272dd7e11c4f46>:0
  at OpenRA.Sync.CheckSyncUnchanged[T] (OpenRA.World world, System.Func`1[TResult] fn) [0x00000] in <771c3876cf2a484a81272dd7e11c4f46>:0
  at OpenRA.Sync.CheckSyncUnchanged (OpenRA.World world, System.Action fn) [0x00000] in <771c3876cf2a484a81272dd7e11c4f46>:0
  at OpenRA.Game.InnerLogicTick (OpenRA.Network.OrderManager orderManager) [0x00000] in <771c3876cf2a484a81272dd7e11c4f46>:0
  at OpenRA.Game.LogicTick () [0x00000] in <771c3876cf2a484a81272dd7e11c4f46>:0
  at OpenRA.Game.Loop () [0x00000] in <771c3876cf2a484a81272dd7e11c4f46>:0
  at OpenRA.Game.Run () [0x00000] in <771c3876cf2a484a81272dd7e11c4f46>:0
  at OpenRA.Program.Run (System.String[] args) [0x00000] in <771c3876cf2a484a81272dd7e11c4f46>:0
  at OpenRA.Program.Main (System.String[] args) [0x00000] in <771c3876cf2a484a81272dd7e11c4f46>:0


The map's Lua file is:

Code:
--VARIABLEN

SovietInfantryTypes = { "e1", "e1", "e1", "e2", "e2", "e4", "e4", "shok" }
SovietArmorTypes = { "3tnk", "3tnk", "3tnk", "3tnk", "v2rl", "4tnk", "ttnk" }
SovietAircraftType = { "yak", "yak", "yak", "mig" }
SovietHeliType = { "hind" }

RadarDome = { RadarDome }
SubPens = { SubPen1, SubPen2, SubPen3, SubPen4 }
AirFacilities = { Airfield1, Airfield2, Airfield3, Helipad1, Helipad2, Helipad3 }
ForwardCommand = { SovietForwardCommand }

IdlingUnits = { }
--AttackGroupSize = 3

SovietAttackPathGround = { { Rallypoint, AttackMoveSouth1, AlliedBaseEast, AlliedBaseWest }, { Rallypoint, AttackMoveNorth1, AlliedBaseWest, AlliedBaseEast } }
SovietAttackAir = { { AlliedBaseWest, AlliedBaseEast }, { AlliedBaseEast, AlliedBaseWest } }

InfAttack = { }
TankAttack = { }
AirAttack = { }
HeliAttack = { }

MCVReinforcement = { "mcv" }
TransportBoatReinforcement = { "lst" }

Rallypoints = { Rallypoint }
Barracks = { Rax }
Warfactory = { Wafa }

BuildVehicles = true
TrainInfantry = true
Attacking = true


--Tick = function()
---   if ussr.HasNoRequiredUnits() then
   --   allies.MarkCompletedObjective(KillAll)
   --end
--end

--keine Ahnung ob das was bewirkt

IdleHunt = function(unit) if not unit.IsDead then Trigger.OnIdle(unit, unit.Hunt) end end

--KI-SKRIPTE

ProduceInfantry = function()

   local delay = Utils.RandomInteger(DateTime.Seconds(3), DateTime.Seconds(9))
   local toBuild = { Utils.Random(SovietInfantryTypes) }
   local Path = Utils.Random(SovietAttackPathGround)
   ussr.Build(toBuild, function(unit)
      InfAttack[#InfAttack + 1] = unit[1]

      if #InfAttack >= 9 then
         SendUnits(InfAttack, Path)
         InfAttack = { }
         Trigger.AfterDelay(DateTime.Minutes(3), ProduceInfantry)
      else
         Trigger.AfterDelay(delay, ProduceInfantry)
      end
   end)
end

ProduceTanks = function()

   local delay = Utils.RandomInteger(DateTime.Seconds(12), DateTime.Seconds(15))
   local toBuild = { Utils.Random(SovietArmorTypes) }
   local Path = Utils.Random(SovietAttackPathGround)
   ussr.Build(toBuild, function(unit)
      TankAttack[#TankAttack + 1] = unit[1]

      if #TankAttack >= 3 then
         SendUnits(TankAttack, Path)
         TankAttack = { }
         Trigger.AfterDelay(DateTime.Minutes(3), ProduceTanks)
      else
         Trigger.AfterDelay(delay, ProduceTanks)
      end
   end)
end

ProducePlanes = function()

   local delay = Utils.RandomInteger(DateTime.Seconds(12), DateTime.Seconds(15))
   local toBuild = { Utils.Random(SovietAircraftType) }
   local Path = Utils.Random(SovietAttackAir)
   ussr.Build(toBuild, function(unit)
      AirAttack[#AirAttack + 1] = unit[1]

      if #AirAttack >= 1 then
         SendUnits(AirAttack, Path)
         AirAttack = { }
         Trigger.AfterDelay(DateTime.Minutes(3), ProducePlanes)
      else
         Trigger.AfterDelay(delay, ProducePlanes)
      end
   end)
end

ProduceHelis = function()

   local delay = Utils.RandomInteger(DateTime.Seconds(12), DateTime.Seconds(15))
   local toBuild = { Utils.Random(SovietHeliType) }
   local Path = Utils.Random(SovietAttackAir)
   ussr.Build(toBuild, function(unit)
      HeliAttack[#HeliAttack + 1] = unit[1]

      if #HeliAttack >= 1 then
         SendUnits(HeliAttack, Path)
         HeliAttack = { }
         Trigger.AfterDelay(DateTime.Minutes(3), ProduceHelis)
      else
         Trigger.AfterDelay(delay, ProduceHelis)
      end
   end)
end

SendUnits = function(units, waypoints)
   Utils.Do(units, function(unit)
      if not unit.IsDead then
         Utils.Do(waypoints, function(waypoint)
            unit.AttackMove(waypoint.Location)
         end)
         unit.Hunt()
      end
   end)
end

InitProductionBuildings = function()
   if not Wafa.IsDead then
      Wafa.IsPrimaryBuilding = true
      Trigger.OnKilled(Wafa, function() BuildVehicles = false end)
   else
      BuildVehicles = false
   end

   if not Rax.IsDead then
      Rax.IsPrimaryBuilding = true
      Trigger.OnKilled(Rax, function() TrainInfantry = false end)
   else
      TrainInfantry = false
   end
end

ActivateAI = function()

   InitProductionBuildings()

   Trigger.AfterDelay(DateTime.Seconds(10), function()
      ProduceInfantry()
      ProduceTanks()
      ProducePlanes()
      ProduceHelis()
   end)
end

--TRIGGER WÄHREND DER MISSION

SetupTriggers = function()

   --Ziel 1: Radaranlage zerstört
   Trigger.OnKilled(RadarDome, function()
      allies1.MarkCompletedObjective(objDestroyRadar)
      --allies2.MarkCompletedObjective(objDestroyRadar2)
      --Media.PlaySpeechNotification(allies2, "AlliedReinforcementsArrived")
      Media.PlaySpeechNotification(allies1, "AlliedReinforcementsArrived")
      Reinforcements.Reinforce(allies1, TransportBoatReinforcement, { TransportBoatSpawn.Location, TransportBoatMove.Location })
      --Reinforcements.Reinforce(allies2, TransportBoatReinforcement, { TransportBoatSpawn.Location, TransportBoatMove.Location })
      Reinforcements.Reinforce(allies1, MCVReinforcement, { MCVSpawn.Location, MCVMove.Location })
      --Reinforcements.Reinforce(allies2, MCVReinforcement, { MCVSpawn.Location, MCVMove.Location })

      Trigger.AfterDelay(DateTime.Minutes(10), ActivateAI)
   end)

   --Sekundärziel 1: U-Boot-Werften
   Trigger.OnAllKilledOrCaptured(SubPens, function()
      allies1.MarkCompletedObjective(objSubPens)
      --allies2.MarkCompletedObjective(objSubPens2)
   end)

   --Sekundärziel 2: Luftwaffe
   Trigger.OnAllKilledOrCaptured(AirFacilities, function()
      allies1.MarkCompletedObjective(objAirpower)
      --allies2.MarkCompletedObjective(objAirpower2)
   end)

   --Hauptziel: Vorposten erobern
   Trigger.OnCapture(ForwardCommand, function()
      allies1.MarkCompletedObjective(objCaptureFC)
      --allies2.MarkCompletedObjective(objCaptureFC2)
   end)


   --IDIOT
   Trigger.OnKilled(ForwardCommand, function()
      allies1.MarkFailedObjective(objCaptureFC)
      --allies2.MarkFailedObjective(objCaptureFC2)
   end)
end


--MISSIONSZIELE PRÄSENTIEREN

InitObjectives = function()

   ussrObj = ussr.AddPrimaryObjective("Deny the Allies.")
   objCaptureFC = allies1.AddPrimaryObjective("Capture the Soviet Forward Command.")
   --objCaptureFC2 = allies2.AddPrimaryObjective("Capture the Soviet Forward Command.")
   objDestroyRadar = allies1.AddPrimaryObjective("Destroy the Soviet radar station.")
   --objDestroyRadar2 = allies2.AddPrimaryObjective("Destroy the Soviet radar station.")
   objAirpower = allies1.AddSecondaryObjective("Destroy all of the Soviets' air capabilities.")
   --objAirpower2 = allies2.AddSecondaryObjective("Destroy all of the Soviets' air capabilities.")
   objSubPens = allies1.AddSecondaryObjective("Destroy all of the Soviets' submarine production facilities.")
   --objSubPens2 = allies2.AddSecondaryObjective("Destroy all of the Soviets' submarine production facilities.")
end



WorldLoaded = function()

   allies1 = Player.GetPlayer("Allies1")
   --allies2 = Player.GetPlayer("Allies2")
   ussr = Player.GetPlayer("USSR")
   
   Trigger.OnObjectiveAdded(allies1, function(p, id)
      Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
   end)

   Trigger.OnObjectiveCompleted(allies1, function(p, id)
      Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
   end)
   Trigger.OnObjectiveFailed(allies1, function(p, id)
      Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
   end)

   Trigger.OnPlayerLost(allies1, function()
      Media.PlaySpeechNotification(player, "Lose")
   end)
   Trigger.OnPlayerWon(allies1, function()
      Media.PlaySpeechNotification(player, "Win")
   end)
   SetupTriggers()
   InitObjectives()
end


seems to be some kind of silly parsing error (I mean, there is an "end", just not in line 245, but 246...

Any help would be greatly appreciated.


Attachment:
 Filename:  rollingthunderSP.zip
21.85 KB :: Downloaded 2 Time(s) :: [ Download ]

Back to top
View user's profile Find all posts by SethXXX Send private message ICQ Number
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1