I don't know what's wrong with my code

PSWoona

Chieftain
Joined
Apr 21, 2016
Messages
31
Hello, I don't really know what to do on modding Civilization V, I've tried the best to my knowledge but for whatever reason my modded civilization that I have created using ModBuddy will show up for the mods enable/disable list, but when I enable it, and go to the Set-up mode, I don't see my civilization. Could anybody help me please?
https://www.youtube.com/watch?v=JrD05Vm9vYM&feature=youtu.be
 
Hi, welcome to the forums, please do know that you are posting this in the incorrect section of the forum. The correct section for this would probably be the SDK/LUA SubForum, which you can go to by clicking this link. Not that I want to get you in trouble, just letting you know for your own knowledge, and because more people view that forum on a routine basis to get help for specific mod related problems (its subforum for asking specific questions related to coding). :)

Now to answer your question, you seem to have somehow not included xml files in your project, even though they are somehow showing up in the solution explorer... I was not even aware this could happen. I will try to recreate this myself just out of curiosity, for future reference.

The reason I say this, is that you do not seem to have the option to select any file in the OnModActivated ModAction you are trying to create in the beginning of your video. This indicates, to me at least, that you have somehow not included the files in the project or there is something else seriously wrong with the way you have set things up.

The correct way to include files into a project is to Right Click the Project (not the Solution which is the first thing in the Solution explorer list, but the one below that), and hit Add and then either New Item... or Existing Item... options in which you can create a new file through ModBuddy's templates (first option), or add a file you have created in another project or somewhere else outside of the ModBuddy environment (second option).

The later one would be how you would go about adding files that you may have written in a text editor, such as notepad, and not in ModBuddy itself. It is important to also note that, ModBuddy's Existing Item... option allows for loading in multiple files into the project at a time.

To do so, simply click and drag your cursor to create a selection of the files you'd like to import, and they will be added to the "File Name" box at the bottom of the dialogue. Hit "Add" button after that and you should see them all be copied into your project folder or subfolder that you specified. You can right click individual subfolders and hit Existing Item... option as well to add a file or files into that specific folder in your project. :)

Remember to set VFS (stands for Virtual File System) settings for some of the types of files you are putting into your project to true as necessary, otherwise they will not load in game even if you have them activated in a ModAction or in the Content tab! To learn more details about what needs VFS set to "True", see this thread here by Whoward69 which is about VFS settings and other specifics of loading a file into your project.

Hope this helps and answers your question, welcome to CivFanatics bud! :)
 
You are trying to add your files to your mod via your regular browser, such as Explorer. This is a no-go. As OuroborosOrder mentioned, they need to be added to the Project from within the ModBuddy software.
 
Sorry! I am very new to this forum, sorry for posting it in the wrong place!

I think I have done what you have said @OuroborosOrder
However, I built my mod, and it gave me this error:

Error 1 The "PackageMod" task failed unexpectedly.
SevenZip.SevenZipException: The execution has failed due to the bug in the SevenZipSharp.
Please report about it to http://sevenzipsharp.codeplex.com/WorkItem/List.aspx, post the release number and attach the archive.
at SevenZip.SevenZipBase.ThrowException(SevenZipBase handler, Exception[] e)
at SevenZip.SevenZipBase.CheckedExecute(Int32 hresult, String message, SevenZipBase handler)
at SevenZip.SevenZipCompressor.CompressFilesEncrypted(Stream archiveStream, Int32 commonRootLength, String password, String[] fileFullNames)
at SevenZip.SevenZipCompressor.CompressFilesEncrypted(String archiveName, Int32 commonRootLength, String password, String[] fileFullNames)
at SevenZip.SevenZipCompressor.CompressFiles(String archiveName, String[] fileFullNames)
at Firaxis.ModBuddy.Civ5ModBuildTasks.PackageMod.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__1.MoveNext() C:\Program Files (x86)\MSBuild\Firaxis\ModBuddy\Civ5Mod.targets 129 10 Pinkamena

Video:
https://www.youtube.com/watch?v=XBpu25uwie8&feature=youtu.be

Also, what am I doing wrong? It still won't show up as a modded civilization.
 
Reinstall Modbuddy?

I looked it up, well google gave me a few funny looks. But besides that, only thing that it came up with was to just restart ModBuddy, in which I have. Still gives the same error
 
No need to even reinstall ModBuddy, just restart it, BUT - and this is crucial, for some reason - open it by actually navigating to Documents/Firaxis ModBuddy/Your Mod Here (or wherever the project is stored) and double click the .civ5sln file. You'll probably get error message popups. Ignore what they say and just press "OK".

And that for some reason allows mods to actually compile...
 
Thank you @AgressiveWimp I had to restart it twice, but it did work the second time.
However.....My mod still doesn't show up for as a civilization
 
In a word - logging

In several more words - you'll actually have to try the mod again after enabling logging. Enabling logging is like giving someone a pen - the words that the person would've written had they had a pen don't magically appear just because now they do have one.
 
@AgressiveWimp Thank you for this, I will be looking through the code itself, tomorrow.
 
Sorry! I am very new to this forum, sorry for posting it in the wrong place!

I think I have done what you have said @OuroborosOrder
However, I built my mod, and it gave me this error:



Video:
https://www.youtube.com/watch?v=XBpu25uwie8&feature=youtu.be

Also, what am I doing wrong? It still won't show up as a modded civilization.

hmmmm this is interesting....

.civ5mod file extension is a fancy .7z archive

If you don't know what that is, it's the basic file extension of the well known file manager 7zip, which is an open source project used for a wide variety of things.

This particular instance is a reference to a managed library... a very old one and no longer very supported from the looks of it.

The name is SevenZipSharp, it is a wrapper library for 7zip.dll and supports different types of formats. The added "Sharp" at the end is due to it being written in C#. This is a common naming convention by developers of C# applications and libraries... especially those that are ports of a C++ version.

For instance, the C# language has no direct method of using the Microsoft DirectX SDK. Instead there is a port called SharpDX. You get the picture.


This error message is found in the SevenZipSharp source.
Lines 368 - 369 in Common.cs

See the related excerpt here:
Spoiler :
R4mlXJy.png


I am unable to replicate this error... I have tried several different ways of replicating it, nothing has worked. The build always completes for me.

Edit from Author: Added Spoiler tags around image.
 
Okay, so maybe I am building it wrong?
I went ahead and took a working civilization mod, Threw everything into Modbuddy. Then I went ahead saved it all (Making no changes mind you), then built it. Threw it back into the mods, and it doesn't work.

Is right clicking Build [Project Name] not the proper way to do it?

It's the same thing as before, it shows up in the mods list, but doesn't show up as a civilization.
 
It's the same thing as before, it shows up in the mods list, but doesn't show up as a civilization.

Are you clicking "Back" at any point after clicking "Next" from the Mods Browser screen? If so, don't! The "Single Player" entry that looks like a menu title is a button, click it - otherwise you're returning to the main menu and that disables the mod.

Otherwise, enable logging and see what's in the logs (1st link in my sig)

If all else fails, attach the actual mod, so we can see what you've actually done (and not what you think what you've done) - second link in my sig

W
 
The "Single Player" entry that looks like a menu title is a button, click it - otherwise you're returning to the main menu and that disables the mod.

By any chance, would there be a mod that changes that so that it actually looks like a button? (or is that unmoddable?) :p
 
Having watched your video again with a fresh set of eyes, you are loading the mod correctly from the Mods menu.

The Civ is not showing up. I will take a look and see if I can get it to show up in a few minutes.
 
Please just post the mod itself. whoward69's zip your mods and attach tutorial. We can see everything we need to see from the mod itself far more easily and efficiently than we can by trying to parse-from, pause-and-rewind, and attempt to reparse whatever it is you are doing from a youtube video, which still does not actually confirm what it is that the game itself is getting from the mod.
 
Enable logging (first link in my sig), check the logs, fix the errors

Code:
[85638.750] Invalid Reference on Civilization_Leaders.CivilizationType - "CIVILIZATION_ENSLAVED" does not exist in Civilizations

[85638.593] Invalid Reference on Civilizations.AlphaIconAtlas - "CIV_ALPHA_ATLAS_ENSLAVED" does not exist in IconTextureAtlases
[85638.593] Invalid Reference on Civilizations.IconAtlas - "CIV_COLOR_ATLAS_ENSLAVED" does not exist in IconTextureAtlases
[85639.296] Invalid Reference on PlayerColors.TextColor - "COLOR_PINKAMENA_POWER" does not exist in Colors
[85639.296] Invalid Reference on PlayerColors.PrimaryColor - "COLOR_PINKAMENA_POWER" does not exist in Colors
[85639.296] Invalid Reference on Leaders.IconAtlas - "CIV_COLOR_ATLAS_ENSLAVED" does not exist in IconTextureAtlases
[85640.281] Invalid Reference on Unit_AITypes.UnitAIType - "UNITAI_THE_FEARED" does not exist in UnitAIInfos
[85640.281] Invalid Reference on Unit_AITypes.UnitType - "UNIT_STHE_FEARED" does not exist in Units

[85638.625] Invalid Reference on Civilizations.Adjective - "Enslaved" does not exist in Language_en_US
[85638.671] Invalid Reference on Civilizations.ShortDescription - "The Enslaved" does not exist in Language_en_US
[85638.703] Invalid Reference on Civilizations.Description - "Pinkamena's Empire" does not exist in Language_en_US

The first one is fatal - it's not CIVILIZATION_ENSLAVED but CIVILIZATION_PINKAMENA - so your civ has no leader

The ones in the middle may or may not be fatal, but certainly need fixing.

The three at the end are not fatal - they are telling you you haven't used TXT_KEYs for those three entries - but should be fixed (otherwise you end up with many warnings that can hide more serious and fatal errors)
 
Back
Top Bottom