Map Scripting Error

Information and discussion for custom maps and mods.
Post Reply
thebestwes
Posts: 18
Joined: Fri Jul 17, 2015 7:08 pm

Map Scripting Error

Post by thebestwes »

Hey, y'all. I've been trying to script a map based on this tutorial, and I'm running into some problems. I'm not entirely unfamiliar with Lua (I used to do some basic modding of Bungie's Marathon in it), but I'm definitely unfamiliar enough that I'm confident I'm just making a stupid mistake.

I suspect that the issue is related to the ways I've tried to adapt the script from the mod it was written for to Tiberium Dawn (and possibly left in inconsistency somewhere, although I can't find it if it exists), but I could be wrong about that.
Any help you can provide would be awesome. I can provide the map files themselves if necessary. Below is the error code I got, followed by the map.yaml and script:

Code: Select all

Fatal Lua Error: 
   at OpenRA.Scripting.ScriptContext.FatalError(System.String message)
   at System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod , System.Object , System.Object[] , System.Exception ByRef )
   at System.Reflection.MonoMethod.Invoke(System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(System.Object obj, System.Object[] parameters)
   at Eluant.LuaRuntime+MethodWrapper.Invoke(System.Object[] parms)
   at Eluant.LuaRuntime.MakeManagedCall(IntPtr state, Eluant.MethodWrapper wrapper)
   at Eluant.LuaRuntime.MethodWrapperCallCallback(IntPtr state)
   at Eluant.LuaRuntime.MethodWrapperCallCallbackWrapper(IntPtr state)
   at Eluant.LuaApi.lua_pcall(IntPtr , Int32 , Int32 , Int32 )
   at Eluant.LuaRuntime.Call(IList`1 args)
   at Eluant.LuaRuntime.Call(Eluant.LuaFunction fn, IList`1 args)
   at Eluant.LuaFunction.Call(IList`1 args)
   at Eluant.LuaFunction.Call(Eluant.LuaValue[] args)
   at OpenRA.Scripting.ScriptContext..ctor(OpenRA.World world, OpenRA.Graphics.WorldRenderer worldRenderer, IEnumerable`1 scripts)
   at OpenRA.Mods.Common.Scripting.LuaScript.WorldLoaded(OpenRA.World world, OpenRA.Graphics.WorldRenderer worldRenderer)
   at OpenRA.World.LoadComplete(OpenRA.Graphics.WorldRenderer wr)
   at OpenRA.Game.StartGame(System.String mapUID, WorldType type)
   at OpenRA.Network.UnitOrders.ProcessOrder(OpenRA.Network.OrderManager orderManager, OpenRA.World world, Int32 clientId, OpenRA.Order order)
   at OpenRA.Network.OrderManager.TickImmediate()
   at OpenRA.Sync+<CheckSyncUnchanged>c__AnonStorey0.<>m__0&#40;&#41;
   at OpenRA.Sync.CheckSyncUnchanged&#40;OpenRA.World world, System.Func`1 fn&#41;
   at OpenRA.Sync.CheckSyncUnchanged&#40;OpenRA.World world, System.Action fn&#41;
   at OpenRA.Game.InnerLogicTick&#40;OpenRA.Network.OrderManager orderManager&#41;
   at OpenRA.Game.LogicTick&#40;&#41;
   at OpenRA.Game.Loop&#40;&#41;
   at OpenRA.Game.Run&#40;&#41;
   at OpenRA.Program.Run&#40;System.String&#91;&#93; args&#41;
   at OpenRA.Program.Main&#40;System.String&#91;&#93; args&#41;

Code: Select all

MapFormat&#58; 7

RequiresMod&#58; cnc

Title&#58; Stable Test

Description&#58; Goal&#58; Stable Test

Author&#58; Your name here

Tileset&#58; WINTER

MapSize&#58; 66,66

Bounds&#58; 16,12,38,49

Visibility&#58; MissionSelector

Type&#58; Mission

Videos&#58;

Options&#58;

Players&#58;
	PlayerReference@GDI&#58;
		Name&#58; GDI
		Playable&#58; True
		AllowBots&#58; False
		Required&#58; True
		LockRace&#58; True
		Race&#58; gdi
		LockColor&#58; True
		ColorRamp&#58; 31,222,183
		LockSpawn&#58; True
		LockTeam&#58; True
		Allies&#58; GDI
		Enemies&#58; Nod
	PlayerReference@Nod&#58;
		Name&#58; Nod
		Race&#58; nod
		ColorRamp&#58; 3,255,127
		Allies&#58; Nod
		Enemies&#58; GDI
	PlayerReference@Neutral&#58;
		Name&#58; Neutral
		OwnsWorld&#58; True
		NonCombatant&#58; True
		Race&#58; gdi
	PlayerReference@Creeps&#58;
		Name&#58; Creeps
		NonCombatant&#58; True
		Race&#58; Random
		Enemies&#58; Nod, GDI

Actors&#58;
	Outpost&#58; fact
		Owner&#58; GDI
		Location&#58; 33,32
	NodRally&#58; waypoint
		Owner&#58; Neutral
		Location&#58; 34,44
	GDIRally&#58; waypoint
		Owner&#58; Neutral
		Location&#58; 34,21
	GDIEntry&#58; waypoint
		Owner&#58; Neutral
		Location&#58; 35,13
	NodEntry&#58; waypoint
		Owner&#58; Neutral
		Location&#58; 34,54
	<snip because there's a million of these and i'm fairly confident they're not relevant>

Smudges&#58;

Rules&#58;
	Player&#58;
		-ConquestVictoryConditions&#58;
		MissionObjectives&#58;
			EarlyGameOver&#58; true
	World&#58;
		-CrateSpawner&#58;
		-SpawnMPUnits&#58;
		-MPStartLocations&#58;
		LuaScript&#58;
			Scripts&#58; stabletest.lua
		ObjectivesPanel&#58;
			PanelName&#58; MISSION_OBJECTIVES

Sequences&#58;

VoxelSequences&#58;

Weapons&#58;

Voices&#58;

Notifications&#58;

Translations&#58;

Code: Select all

JeepReinforcements = &#123;"jeep", "jeep"&#125;
JeepReinforcementsPath = &#123; GDIEntry.Location, GDIRally.Location &#125;
JeepDelay = 12
JeepInterval = 2


Force = &#123; "e1", "e1", "e1", "e1", "e2"&#125;
ForcePath = &#123; NodEntry.Location, NodRally.Location &#125;
ForceDelay = 15
ForceInterval = 2

SendJeeps = function&#40;&#41;
    Reinforcements.Reinforce&#40;player, JeepReinforcements, JeepReinforcementsPath, DateTime.Seconds&#40;2&#41;&#41;
    Media.PlaySpeechNotification&#40;player, "ReinforcementsArrived"&#41;   
end


SendNodInfantry = function&#40;&#41;
    local units = Reinforcements.Reinforce&#40;nod, Force, ForcePath, ForceInterval&#41;
    Utils.Do&#40;units, function&#40;unit&#41;
        BindActorTriggers&#40;unit&#41;
    end&#41;
    Trigger.AfterDelay&#40;DateTime.Seconds&#40;5&#41;, SendNodInfantry&#41;
end

BindActorTriggers = function&#40;a&#41;
    if a.HasProperty&#40;"Hunt"&#41; then
        if a.Owner == nod then
            Trigger.OnIdle&#40;a, a.Hunt&#41;
        else
            Trigger.OnIdle&#40;a, function&#40;a&#41; a.AttackMove&#40;Outpost.Location&#41; end&#41;
        end
    end
end

OutpostDestroyed = function&#40;&#41;
    MissionFailed&#40;&#41;
end

MissionAccomplished = function&#40;&#41;
    Media.PlaySpeechNotification&#40;player, "Win"&#41;
end

MissionFailed = function&#40;&#41;
    Media.PlaySpeechNotification&#40;player, "Lose"&#41;
    player.MarkFailedObjective&#40;SurviveObjective&#41;
    nod.MarkCompletedObjective&#40;DestroyObjective&#41;
end

WorldLoaded = function&#40;&#41;
    player = Player.GetPlayer&#40;“GDI”&#41;
    nod = Player.GetPlayer&#40;“Nod”&#41;

    Trigger.OnObjectiveCompleted&#40;player, function&#40;p, id&#41;
        Media.DisplayMessage&#40;p.GetObjectiveDescription&#40;id&#41;, "Objective completed"&#41;
    end&#41;

    Trigger.OnObjectiveFailed&#40;player, function&#40;p, id&#41;
        Media.DisplayMessage&#40;p.GetObjectiveDescription&#40;id&#41;, "Objective failed"&#41;
    end&#41;

    Trigger.OnKilled&#40;Outpost, OutpostDestroyed&#41;

    SurviveObjective = player.AddPrimaryObjective&#40;"The outpost must survive."&#41;
    DestroyObjective = nod.AddPrimaryObjective&#40;"The GDI outpost must be destroyed."&#41;

    Trigger.AfterDelay&#40;DateTime.Seconds&#40;60&#41;, function&#40;&#41;
        MissionAccomplished&#40;&#41;
        player.MarkCompletedObjective&#40;SurviveObjective&#41;
        nod.MarkFailedObjective&#40;DestroyObjective&#41;
    end&#41;

    Trigger.AfterDelay&#40;DateTime.Seconds&#40;5&#41;, SendJeeps&#41; --Sending Allied reinforcements  
    SendNodInfantry&#40;IndiaEntry.Location, Force, ForceInterval&#41; --Sending Nod ground troops every 15 seconds   

    Trigger.AfterDelay&#40;DateTime.Seconds&#40;2&#41;, function&#40;&#41; Actor.Create&#40;"camera", true, &#123; Owner = player, Location = NodRally.Location &#125;&#41; end&#41;
    Camera.Position = Outpost.CenterPosition

end
Last edited by thebestwes on Mon Jul 20, 2015 1:24 am, edited 1 time in total.

User avatar
Murto the Ray
Posts: 487
Joined: Mon Nov 10, 2014 4:34 pm

Re: Map Scripting Error

Post by Murto the Ray »

Trigger.AfterDelay(DateTime.Seconds(5), SendJeeps) --Sending Allied reinforcements
SendNodInfantry(IndiaEntry.Location, Force, ForceInterval) --Sending Nod ground troops every 15 seconds



Shouldn't IndiaEntry.Location be NodEntry.Location?

btw, this is near the end of your LUA code.

thebestwes
Posts: 18
Joined: Fri Jul 17, 2015 7:08 pm

Post by thebestwes »

Dang, good catch. I did a find and replace, but evidently I did it on an older draft of the script. It's still giving me an error, though:

Code: Select all

Fatal Lua Error&#58; 
   at OpenRA.Scripting.ScriptContext.FatalError&#40;System.String message&#41;
   at System.Reflection.MonoMethod.InternalInvoke&#40;System.Reflection.MonoMethod , System.Object , System.Object&#91;&#93; , System.Exception ByRef &#41;
   at System.Reflection.MonoMethod.Invoke&#40;System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object&#91;&#93; parameters, System.Globalization.CultureInfo culture&#41;
   at System.Reflection.MethodBase.Invoke&#40;System.Object obj, System.Object&#91;&#93; parameters&#41;
   at Eluant.LuaRuntime+MethodWrapper.Invoke&#40;System.Object&#91;&#93; parms&#41;
   at Eluant.LuaRuntime.MakeManagedCall&#40;IntPtr state, Eluant.MethodWrapper wrapper&#41;
   at Eluant.LuaRuntime.MethodWrapperCallCallback&#40;IntPtr state&#41;
   at Eluant.LuaRuntime.MethodWrapperCallCallbackWrapper&#40;IntPtr state&#41;
   at Eluant.LuaApi.lua_pcall&#40;IntPtr , Int32 , Int32 , Int32 &#41;
   at Eluant.LuaRuntime.Call&#40;IList`1 args&#41;
   at Eluant.LuaRuntime.Call&#40;Eluant.LuaFunction fn, IList`1 args&#41;
   at Eluant.LuaFunction.Call&#40;IList`1 args&#41;
   at Eluant.LuaFunction.Call&#40;Eluant.LuaValue&#91;&#93; args&#41;
   at OpenRA.Scripting.ScriptContext..ctor&#40;OpenRA.World world, OpenRA.Graphics.WorldRenderer worldRenderer, IEnumerable`1 scripts&#41;
   at OpenRA.Mods.Common.Scripting.LuaScript.WorldLoaded&#40;OpenRA.World world, OpenRA.Graphics.WorldRenderer worldRenderer&#41;
   at OpenRA.World.LoadComplete&#40;OpenRA.Graphics.WorldRenderer wr&#41;
   at OpenRA.Game.StartGame&#40;System.String mapUID, WorldType type&#41;
   at OpenRA.Network.UnitOrders.ProcessOrder&#40;OpenRA.Network.OrderManager orderManager, OpenRA.World world, Int32 clientId, OpenRA.Order order&#41;
   at OpenRA.Network.OrderManager.TickImmediate&#40;&#41;
   at OpenRA.Sync+<CheckSyncUnchanged>c__AnonStorey0.<>m__0&#40;&#41;
   at OpenRA.Sync.CheckSyncUnchanged&#40;OpenRA.World world, System.Func`1 fn&#41;
   at OpenRA.Sync.CheckSyncUnchanged&#40;OpenRA.World world, System.Action fn&#41;
   at OpenRA.Game.InnerLogicTick&#40;OpenRA.Network.OrderManager orderManager&#41;
   at OpenRA.Game.LogicTick&#40;&#41;
   at OpenRA.Game.Loop&#40;&#41;
   at OpenRA.Game.Run&#40;&#41;
   at OpenRA.Program.Run&#40;System.String&#91;&#93; args&#41;
   at OpenRA.Program.Main&#40;System.String&#91;&#93; args&#41;

User avatar
Sleipnir
Posts: 878
Joined: Wed Apr 10, 2002 11:52 pm
Contact:

Post by Sleipnir »

Is that the content of your lua.log file? It should be giving you more context than that, such as the line number of your error. What version of the game and mono are you running?

thebestwes
Posts: 18
Joined: Fri Jul 17, 2015 7:08 pm

Post by thebestwes »

Yeah, I was surprised because in the past it's been fairly easy for me to debug based on the log. I'm running mono version 4.0.2.5, and this is with the newest playtest.

I just tried it with the most recent stable build, and got an almost identical error, but with more specificity at the beginning:

Code: Select all

Fatal Lua Error&#58; Error parsing stabletest.lua. Reason&#58; &#91;string "stabletest.lua"&#93;&#58;1&#58; unexpected symbol near '&#123;'
   at OpenRA.Scripting.ScriptContext.FatalError&#40;System.String message&#41;

After that everything is identical.


I tried adding spaces between the braces/curly brackets and "jeep" in line 1, but still got the same error in my log, although interestingly the playtest is also giving me the "unexpected symbol" bit now.

:?

Maybe I just jinxed it with the overly optimistic name "stable test." That would explain a lot, haha.

Post Reply