Error trying to mod entirely new races

Post bug reports and ask for support here.

Moderators: Icemania, elliotg

Post Reply
Gray Area
Posts: 15
Joined: Thu Dec 01, 2011 4:45 pm

Error trying to mod entirely new races

Post by Gray Area »

The DW races are great but nothing beats your own imagination for getting really invested, I think.

Anyway, used the original custom theme as a basis and added all my custom races. But I find 39 a bit of an eyesore on the menu.

So, using Igard's fine example (as well as some of your ships, Sir [&o] - tried to put together a mod with just 10 of my custom races to start.

But I always get the same unhandled exception:


Value cannot be null
Parameter: Image

Have any of you gents been down this road before? Or perhaps have some general pearls of wisdom you could throw me so I could cash in?

Kudos to you all,
Gray Area
Gray Area
Bingeling
Posts: 5186
Joined: Thu Aug 12, 2010 11:42 am

RE: Error trying to mod entirely new races

Post by Bingeling »

I have never modded this game, but I would make sure all your race/image indexes are a continuous chain of numbers. Starting at 0 or 1, you want:

0, 1, 2, 3, 4

And not

0, 1, 2, 4, 5

Also make sure your image IDs match the race ID or whatever. It gets null when it looks for an image, and that could be because the image does not exist, or that it looks in the wrong folder. Or quite possible, but unlikely - the permission of that folder.
Gray Area
Posts: 15
Joined: Thu Dec 01, 2011 4:45 pm

RE: Error trying to mod entirely new races

Post by Gray Area »

Thanks Bingeling,

It is the basics that sometimes we miss, or certainly I do. I hope that I have. Unless I have developed a dyslexic eye and keep missing the same simple error. I'll follow your advice and do a test again.

Appreciate you giving this a think,
Gray Area
Gray Area
Bingeling
Posts: 5186
Joined: Thu Aug 12, 2010 11:42 am

RE: Error trying to mod entirely new races

Post by Bingeling »

It is incredible how much a stupid error can hurt you if you got no proper debug feedback.

For instance:

Image is null

vs

Image is null. getRaceImage, raceIndex=1, imageIndex=3.
Gray Area
Posts: 15
Joined: Thu Dec 01, 2011 4:45 pm

RE: Error trying to mod entirely new races

Post by Gray Area »

Yeah, I hear that. Bias text was a mess, so I'm glad you posted. But still not the mystery image value [8|].

The lack of specifics in bug reports is bugging.

Gray Area
User avatar
Darkspire
Posts: 1986
Joined: Thu Jun 12, 2003 8:07 pm
Location: My Own Private Hell

RE: Error trying to mod entirely new races

Post by Darkspire »

Not sure from your last post or the first one where you are or what file you have a problem with, but ill try to help.

This lines from the character folder, the file for your races characters.

5, Korbi Hassari, 5,image.png, yourracename, 40, 16, 41, 14, 42, 18, 43, 12, 49, 67, 56

This ones from the races folder, the file for your race.

'Picture index: index of picture used for this race from race pictures contained in Images\units\races\ folder or Customization\YourTheme\raceImages\ folder
PictureIndex ;22

If you can tell me which one looks the most likely culprit ill try to help to find whats gone wonky.

Darkspire
Gray Area
Posts: 15
Joined: Thu Dec 01, 2011 4:45 pm

RE: Error trying to mod entirely new races

Post by Gray Area »

Thanks Darkspire,

As a relative newbie I'm not too sure myself. What I've done is use the original custom theme as a template and added my custom races+shipsets+troopimages+policies+biases, then deleted the old ones.

I know my races are fine because I can add them to the original custom theme and play each race. Only problem is there are too many at 39. Maximum I seem to get is 33. Which is slightly too many for the screen I feel. Anyway, I know the files are OK - so I thought...

Here is the exception error, hope it doesn't take too long to spot what it is:

System.ArgumentNullException: Value cannot be null.
Parameter name: image
at System.Drawing.Graphics.DrawImage(Image image, Int32 x, Int32 y, Int32 width, Int32 height)
at System.Drawing.Graphics.DrawImage(Image image, Rectangle rect)
at DistantWorlds.Controls.InfoPanel.PrescaleImage(Bitmap originalBitmap, Int32 width, Int32 height)
at DistantWorlds.Controls.InfoPanel.InitializeImages(CharacterImageCache characterImageCache, Bitmap[] troopImages, Bitmap[] resourceImages, Bitmap[] raceImages, Bitmap[] builtObjectImages, Bitmap[] fighterImages, Bitmap[] ruinImages, Bitmap[] habitatImages, Bitmap[] facilityImages, Bitmap approvalSmileImage, Bitmap approvalNeutralImage, Bitmap approvalSadImage, Bitmap approvalAngryImage, Bitmap developmentImage, Bitmap colonyImage, Bitmap firepowerImage, Bitmap shipGroupLeadShipImage, Bitmap capitalColonyImage, Bitmap regionalCapitalColonyImage, Bitmap automateImage, Bitmap blockadeImage)
at DistantWorlds.Main.UCItnSSqgm()
at DistantWorlds.Start.kGin8N08v(String , Boolean , Boolean )
at DistantWorlds.Start.ga7nMHaDgU(Object , EventArgs )
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at DistantWorlds.Controls.GlassButton.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at DistantWorlds.Controls.GlassButton.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)



Cheers,
Gray Area
Gray Area
User avatar
Darkspire
Posts: 1986
Joined: Thu Jun 12, 2003 8:07 pm
Location: My Own Private Hell

RE: Error trying to mod entirely new races

Post by Darkspire »

Doesnt help to much, I tried to replicate the problem and think it is your character file, which kind of makes sense if you say your races worked in the other mod. Could you upload a file, one of your custom race files for characters that you created in your mod folder for characters, I hopefully should then be able to fix it for you and tell where it went wonky so you can learn from there.

Darkspire
Gray Area
Posts: 15
Joined: Thu Dec 01, 2011 4:45 pm

RE: Error trying to mod entirely new races

Post by Gray Area »

That would be outstanding Darkspire,

Problem is I don't have character files. I wanted to strip things down to basics to test. So I have: Policy, raceImages, races, shipImages, troopImages folders and files and a biases text file.

My troop images are a little large at about 600x200+ pixels. Could it be that?

Everything is labelled sequentially without gaps and sized like other files. And as I say tested so I know they work added on individually to the original theme.

To be honest I don't know what I'm looking at in the exception error...

Thanks for giving me a hand so far dude
Gray Area
User avatar
Darkspire
Posts: 1986
Joined: Thu Jun 12, 2003 8:07 pm
Location: My Own Private Hell

RE: Error trying to mod entirely new races

Post by Darkspire »

Well in that case there are a few things that it could be, and yes those troop images are way to big, mine are 81x51 [:'(] the easiest thing to do is to set up a free account here and send me the link by PM to the file and ill take a look through it, there are four possible things that may be causing the problem in the list you gave. Ill go through it and then explain what the problem was. Not meant as an insult, just wondering did you give the new 'Distant Worlds Legends - Modding Guide.pdf' a good read? Like yourself I reverse engineered to start to learn and that guide filled all the blanks in. Dont worry though we will get you making your own mods [:D]

Darkspire
Gray Area
Posts: 15
Joined: Thu Dec 01, 2011 4:45 pm

RE: Error trying to mod entirely new races

Post by Gray Area »

Cheers Darkspire,

Honestly I couldn't take your critique as an insult - clearly I've gone wrong somewhere or overlooked something.

I uploaded the races, raceImages, troopImages folders and the biases file. My shipImages are got from other peoples' contributions so it could only be the filenames at fault. My policy files were ok when tested individually and since they don't ref pics as far as I can see I haven't included these either. I figure there's just got to be good manners in using up another man's time. I'll PM you as I can't upload link because of some number of days since 10th post restriction. I haven't sought permissions but please feel free to use if you like. I did read through the manually but not page by page. Thanks for the suggestion, I'll get on that.

Again, appreciate your help. I'm still hoping for a Distant World's Christmas!

,Gray Area
Gray Area
Post Reply

Return to “Tech Support”