New to Modding OpenRA - Crash becuase of new unit

crash when clicing on new building options

Information and discussion for custom maps and mods.
Remuneration
Posts: 46
Joined: Sun Mar 09, 2014 3:49 pm

Post by Remuneration » Wed Mar 19, 2014 5:27 am

scorp wrote: and my unit works fin
Can I look at your code you have added to the unit?

scorp
Posts: 96
Joined: Sat Mar 08, 2014 9:35 pm

Post by scorp » Thu Mar 20, 2014 8:45 pm

this is for RA Mod (note that the code formatting will be ruined by the Forum formatting)

rules/vehicles.yaml

FTNK:
Inherits: ^Vehicle
Buildable:
Queue: Vehicle
BuildPaletteOrder: 150
Prerequisites: ftur
Owner: soviet
Hotkey: f
Valued:
Cost: 900
Tooltip:
Name: Flamer Tank
Description: Tank with Flamethrower\n Strong vs Infantry, Buildings\n Weak vs Tanks, Aircraft
Health:
HP: 200
Armor:
Type: Heavy
Mobile:
Speed: 6
RevealsShroud:
Range: 5
RenderUnit:
Armament:
Weapon: Flamer
AttackFrontal:
AutoTarget:
Explodes:
Weapon: SCUD
EmptyWeapon:

sequences/vehicles.yaml

ftnk:
idle:
Start: 0
Facings: 32
muzzle: gunfire2
Start: 0
Length: 5
icon: ctnkicon
Start: 0

note that i use a placeholder Icon here
and it's a non-turreted unit. sequences depend a lot on the unit type you want to add.

i think that's it. Getting a working custom Icon is still to be done. The main issue is probably the .SHP files. I got it to work for the actual unit with a lot of Trial and error so i can't advise on that subject.

Information on SHP conversion is around these Forums, maybe you can find the correct how-to.

Matt
Posts: 1024
Joined: Tue May 01, 2012 12:21 pm
Location: Germany

Post by Matt » Sat Mar 22, 2014 1:32 pm

You can use

Code: Select all

 to display it with indentions although there be an invalid tabs to spaces conversion.

scorp
Posts: 96
Joined: Sat Mar 08, 2014 9:35 pm

Post by scorp » Sat Mar 22, 2014 4:18 pm

thanks for the info. will try that in case i need to post more code...

as for my unit, i'm gonna have to convert the flamer tank Icon from CnC to the RA Format i guess so i can get rid of using the placeholder Picture i'm currently using.

*edit*

Looks like that's harder than i thought. those .tem files may be used in RA as well, but i don't get the Palette right for that cameo pic :\

scorp
Posts: 96
Joined: Sat Mar 08, 2014 9:35 pm

Post by scorp » Wed Apr 02, 2014 9:19 pm

So... this error message is too cryptic for me to figure out..

game crashes after load Screen. Mod uses a different custom unit with its own turretet sprite - the error message probably relates to that, but if anyone can give me a more accurate meaning of it, i'd be very glad :oops:

Red Alert Mod at Version release-20131223
Operating System: Windows (Microsoft Windows NT 6.1.7601 Service Pack 1)
Runtime Version: .NET CLR 2.0.50727.5477
Exception of type `System.IndexOutOfRangeException`: Der Index war außerhalb des Arraybereichs.
bei OpenRA.FileFormats.Format80.DecodeInto(Byte[] src, Byte[] dest)
bei OpenRA.FileFormats.ShpReader.Decompress(Stream stream, ImageHeader h)
bei OpenRA.FileFormats.ShpReader..ctor(Stream stream)
bei OpenRA.FileFormats.SpriteSource.LoadSpriteSource(Stream s, String filename)
bei OpenRA.Graphics.SpriteLoader.CacheSpriteFrames(String filename)
bei OpenRA.FileFormats.Cache`2.get_Item(T key)
bei OpenRA.Graphics.Sequence..ctor(String unit, String name, MiniYaml info)
bei OpenRA.Graphics.SequenceProvider.<LoadSequencesForUnit>c__AnonStorey8D.<>m__1BD(KeyValuePair`2 x)
bei System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
bei System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
bei OpenRA.Graphics.SequenceProvider.LoadSequencesForUnit(String unit, MiniYaml sequences)
bei OpenRA.Graphics.SequenceProvider.Initialize(String[] sequenceFiles, List`1 sequenceNodes)
bei OpenRA.ModData.PrepareMap(String uid)
bei OpenRA.Game.StartGame(String mapUID, Boolean isShellmap)
bei OpenRA.Game.LoadShellMap()
bei OpenRA.Mods.RA.DefaultLoadScreen.TestAndContinue()
bei OpenRA.Mods.RA.DefaultLoadScreen.StartGame()
bei OpenRA.Game.InitializeWithMod(String mod)
bei OpenRA.Game.Initialize(Arguments args)
bei OpenRA.Program.Run(String[] args)
bei OpenRA.Program.Main(String[] args)

Matt
Posts: 1024
Joined: Tue May 01, 2012 12:21 pm
Location: Germany

Post by Matt » Thu Apr 03, 2014 7:41 am

Looks like the file format is not understood by the engine. Might be a bug in our parser or the tool you used to create it.

scorp
Posts: 96
Joined: Sat Mar 08, 2014 9:35 pm

Post by scorp » Thu Apr 03, 2014 7:04 pm

alright thx

was just a bad shp once more. :oops:

scorp
Posts: 96
Joined: Sat Mar 08, 2014 9:35 pm

Post by scorp » Sun Apr 06, 2014 8:55 am

i understand this might be a rather generic exception log ...

Red Alert Mod at Version release-20131223
Operating System: Windows (Microsoft Windows NT 6.1.7601 Service Pack 1)
Runtime Version: .NET CLR 2.0.50727.5477
Exception of type `System.InvalidOperationException`: TypeDictionary does not contain instance of type `OpenRA.Mods.RA.ValuedInfo`
bei OpenRA.FileFormats.TypeDictionary.Get[T]()
bei OpenRA.Mods.RA.Widgets.BuildPaletteWidget.DrawProductionTooltip(World world, String unit, int2 pos)
bei OpenRA.Mods.RA.Widgets.BuildPaletteWidget.DrawPalette(ProductionQueue queue)
bei OpenRA.Mods.RA.Widgets.BuildPaletteWidget.Draw()
bei OpenRA.Widgets.Widget.DrawOuter()
bei OpenRA.Widgets.Widget.DrawOuter()
bei OpenRA.Widgets.Widget.DrawOuter()
bei OpenRA.Widgets.Widget.DrawOuter()
bei OpenRA.Widgets.Widget.DrawOuter()
bei OpenRA.Game.Tick(OrderManager orderManager)
bei OpenRA.Game.Run()
bei OpenRA.Program.Run(String[] args)
bei OpenRA.Program.Main(String[] args)

i made a structure buildable that previously wasn't. When i go to the production Queue and mov the mouse cursor over the structure's Icon, the game crashes.

to me it does Sound like something's wong with the Cameo, but the Cameo is shown correctly (and came with RA)

Glad for any help

*Edit*

on a sligthly related note, what are valid InitialActivity entries for a free actor? thanks

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

Post by Sleipnir » Sun Apr 06, 2014 11:00 am

Exception of type `System.InvalidOperationException`: TypeDictionary does not contain instance of type `OpenRA.Mods.RA.ValuedInfo`
Your unit is missing the Valued trait, which holds the cost to build the unit. This is required in order to display the tooltip.

scorp
Posts: 96
Joined: Sat Mar 08, 2014 9:35 pm

Post by scorp » Sun Apr 06, 2014 11:11 am

Many thanks. ;) These not buildable Units tend to miss a few things. And i don't never know which traits are necessary and which are not.

as or my other question about valid, InitialActivity entries... is there a list for such (outside of the code?)

Phrohdoh
Posts: 28
Joined: Wed Apr 09, 2014 2:30 am
Location: Dallas, TX

Post by Phrohdoh » Wed Apr 09, 2014 6:44 pm

The only InitialActivity I know of off-hand is FindResources which can only be given to the resource harvester (whatever that may be for the mod in question) or the engine will crash.

There are probably others but I do now know of them.

scorp
Posts: 96
Joined: Sat Mar 08, 2014 9:35 pm

Post by scorp » Wed Apr 09, 2014 6:53 pm

many thanks.

i made some buildings come with a free unit and was just wondering whether they can be set to doing something automatically. ;)

scorp
Posts: 96
Joined: Sat Mar 08, 2014 9:35 pm

Post by scorp » Mon Apr 28, 2014 1:52 pm

okay... this Crash (see log below) i can't really tie it to any changes i made. happened in the midst of a battle, can't tell what exactly triggered it :oops:


Red Alert Mod at Version release-20131223
Operating System: Windows (Microsoft Windows NT 6.1.7601 Service Pack 1)
Runtime Version: .NET CLR 2.0.50727.5477
Exception of type `System.OverflowException`: Das Negieren des minimalen Wertes einer Ergänzungszahl ist unzulässig.
bei System.Math.AbsHelper(Int32 value)
bei OpenRA.WAngle.ArcTan(Int32 y, Int32 x, Int32 stride)
bei OpenRA.Traits.Util.GetFacing(WVec d, Int32 currentFacing)
bei OpenRA.Mods.RA.Effects.Missile.Tick(World world)
bei OpenRA.World.<Tick>m__B8(IEffect e)
bei OpenRA.WorldUtils.<DoTimed>c__AnonStorey61`1.<>m__142(T x)
bei OpenRA.Exts.Do[T](IEnumerable`1 e, Action`1 fn)
bei OpenRA.WorldUtils.DoTimed[T](IEnumerable`1 e, Action`1 a, String text, Double time)
bei OpenRA.World.Tick()
bei OpenRA.Game.TickInner(OrderManager orderManager)
bei OpenRA.Game.Tick(OrderManager orderManager)
bei OpenRA.Game.Run()
bei OpenRA.Program.Run(String[] args)
bei OpenRA.Program.Main(String[] args)

Matt
Posts: 1024
Joined: Tue May 01, 2012 12:21 pm
Location: Germany

Post by Matt » Mon Apr 28, 2014 1:57 pm

Interesting. Be sure to report that once you know how to trigger it. There is probably a bogus value set of type WRot/WAngle/Facing somewhere and we don't catch that early.

scorp
Posts: 96
Joined: Sat Mar 08, 2014 9:35 pm

Post by scorp » Mon Apr 28, 2014 7:28 pm

don't think i can trigger it on purpose. Could have been anything really

Post Reply