The 3rd Age

Game Enhancement Mod

Game Enhancement Mod

Enhances the expansion by adding new units, new features, and a new faction: Arnor!

Button for The 3rd AgeButton for The Dwarf HoldsButton for The Elven AllianceButton for Helm's Deep Last HopeButton for GothmogtheOrcButton for BFME+Button for The Four AgesButton for HDR HeadquartersButton for Middle Earth CenterButton for Project Perfect Mod

Become an affiliate!

   

Quick Lists

Top Rated Popular New Updated Last Comments Users

Register and log in to move these advertisements down

-mod Command advice for beginners

Tutorial for Battle for Middle-earth BFME

Avatar of Ganon

Ganon

Category: Code
Level: Beginner
Created: Thursday January 13, 2011 - 10:11
Updated: Friday January 14, 2011 - 6:36
Views: 8788
Summary: This tutorial should help you avoid causing the game to crash when using -mod command.

Rating

Staff says

4.0

Members say

4.5

Average

4.3/5.0

3 votes

This tutorial covers the topic of moving code and files within your mod.

I find that it's not uncommon for modders to "rip" object code for units, OUT of those messy files, that are overflowing with object code, for many different objects.
An example:
              
Code
Data\ini\object\evilfaction\evilfactionunits.ini

That particular file is easily one of the worst files, in terms of how hard it is to find what you're looking for (even with the Find function of your text editing program), and general ease of use.
So, naturally, one solution is to cut each object from there and give it, it's own file. And there's nothing wrong with that, in fact it is SO much easier to mod that way.

The problem starts when you've successfully pulled every object from there and decide, "Oh, this file is empty, no need to have empty files in my mod". And you DELETE it! NEVER, and I mean NEVER, delete an empty .ini file from your mod once you've pulled something from it and moved it somewhere else! If you want, just put a little note for yourself in it like this: (In fact, you have to leave something in it. It can't be completely empty.)
              
Code
;EVERYTHING MOVED TO IT'S OWN FILE!


And here's why.
I'm sure you've noticed how, many things in object code have a "ModuleTag_x", sometimes it may look like "HitReactionBehaviorModuleTag", at any rate these are both module tags.

And NO TWO module tags within a SINGLE object's code are alike, and never should be.

Now, this is how the -mod command works when you KEEP the file, even if it's empty. (With a note)
It reads the file that you moved all your object code to, along with ALL the module tags, and THEN the file that is now empty. (It could be the other way around, it depends on the setup of your directory...but that's not important).

And THEN it reads the "Vanilla" or "Original" program files. And when it finds the file that you've emptied in your mod, it basically says, "Wow, THIS file is full of stuff! But I already read a file with this same exact NAME and PATH in the mod. And THAT takes priority, so I'm going to ignore this stuff here and use the mod file." (Even though the mod file is empty. (with a note))

...

However, when you DELETE that pesky empty file, -mod command reads the files the same way except, since you deleted that empty file from your mod, when it comes to the "Vanilla" one, it reads ALL of the code.
But, because you have COPIES of everything in that file, in each of their own files, in your mod, in effect it reads BOTH. And then it starts seeing double.
So now, each object effectively has TWO of every behavior, animation, module tag, and everything else.
But because each module tag is supposed to be unique within each object, it craps out.
And the game crashes.

...

The same can happen if you move an entire FILE from one folder in your mod to another.
Let's say you want to organize the files a little, and you see:
              
Code
Data\ini\object\goodfaction\units\gondor\aragorn.ini

And think, "Wait, Aragorn isn't a Gondor hero ingame. I think I'll move this file to the Rohan folder." So it looks like this:
              
Code
Data\ini\object\goodfaction\units\rohan\aragorn.ini


Even though you didn't move any CODE, and you merely moved the FILE, -mod command isn't "smart" enough to know that the file was simply moved not deleted.

So, ultimately, this works out the same way as if you moved CODE from one file to another and deleted the original file. And you've already read what happens then.

...

So there you have it folks. I hope this helped, especially if you've been having this problem.

Comments

Display order: Newest first

Unknown - Friday January 14, 2011 - 2:20

Yes, i really like this, thx Ganon

clank234 - Friday January 14, 2011 - 2:20

:) this is good

Go to top

 

"One site to rule them all, one site to find them,
one site to host them all, and on the network bind them."

 
5:58:11