Jump to content

Troubleshooting project build


Azworai

Recommended Posts

So, as the next stage of developing my soldier class, I'm integrating some of Lucubrations code(with his blessing), for his Deep Reserves ability. Currently, the class functioned prior to attempting this integration, and when I attempted to build, it failed and I received an error.

 

'Error, Bad class definition 'X2AbilityTemplate';'

 

Being the newbie that I am... the 'class' portion and the general error confuses me.

 

Can anyone shed further light on this? Should I drop the current scripts into a spoiler box for further review?

Link to comment
Share on other sites

I'm newbie/dumb enough to not know what the error is referring to when it says 'class'. It's confusing for me, since my mod is supposed to add a class into the game... but then there's classes in the coding, and I've no clue what that's referring to.

 

Edit: It also does not seem to be referencing a line, or it isn't giving me a 'line number' to refer to.

Edited by Azworai
Link to comment
Share on other sites

Starting to think that attempt somehow broke the entire mod, seeing as modbuddy seems to be losing his mind whenever I do this, creating duplicate scripts and the like and inserting them into the project.

 

Beginning to think I may need to redo the entire mod from scratch... which would be problematic for naming conventions. x.x

Link to comment
Share on other sites

In programming, a class is like a blueprint. It is the definition of a conceptual thing, including data associated with the class, functions that can be invoked on the class, and usually there are class hierarchies...a class can inherit/extend from another class, meaning it is the same as its parent class, but defines additional stuff (data and functions) that differentiates it.

 

Everything in the XComGame/Classes folder is a class. You can see that the idea of a class is very important, and a core part of this language (and many others too).

 

A class is different than an instance of a class (also known as an instance object, and you're working with an instance every time you see "new class'ClassName'" being used). This is similar to how a blueprint on how to build a house, what is included in a house, and what you can do with a house, is different than an actual house built in accordance with the blueprint. While a class declares data associated with it (vars and such), you don't set those on the class itself. Similar to how a house blueprint might say that the garage is designed to have room for two cars, but when adding the cars, you don't add them to the blueprint, that's nonsense, you drive them into the garage in the actual house (the instance).

 

Another example. Car is a class. It defines itself by saying that a Car is a Vehicle (its parent class) has a number of doors, a number of wheels, an engine, windows, locks, a steering wheel, and so on. But you can't drive a Car class...because a class is a concept of a thing, not an actual thing. What you need is an instance of a Car. So you create a new Car to get your instance. You set the things that make it up, or their number (creating an Engine instance, Tire instances, Doors, etc and attaching them), and when all is constructed, you have a Car instance, a thing that can be entered, driven, parked, washed, bought, or sold (according to functions defined on a Car, and outside code that can do things with Car instances).

 

When key classes, especially XCOM game classes that you do not own (like X2AbilityTemplate) are showing errors like what you encountered, that's a major red flag. For one, you shouldn't be modifying the XCOMGame classes directly. That's a recipe for all kinds of trouble. I'm not sure if this is an error that can come up when attempting to override a class (pretty sure this language has the ability to completely override and replace classes, not just extend them), but if you are doing any overriding like that (as opposed to extending), you may want to try undoing those changes and seeing if that fixes the error.

Edited by Ghostlines
Link to comment
Share on other sites

Starting to think that attempt somehow broke the entire mod, seeing as modbuddy seems to be losing his mind whenever I do this, creating duplicate scripts and the like and inserting them into the project.

 

Beginning to think I may need to redo the entire mod from scratch... which would be problematic for naming conventions. x.x

I have had it do this to me a few times, I have had to just delete the mod and solution and rebuild it ... I don't know what causes it.

Link to comment
Share on other sites

As an alternative, the project file is just an xml file. When it starts to flake out on me, I do the following:

 

1) Close ModBuddy

2) Open *.x2proj file in Notepad++

3) Remove any duplicates, rename things, fix directories, etc

4) Close and save *.x2proj

5) Re-open solution in ModBuddy

Link to comment
Share on other sites

I don't even know where the .x2proj file is located. Starting to suspect that perhaps this is generally beyond me. lol. Thanks for all the help thus far though!

 

Edit: It doesn't appear any files were actually duplicated, modbuddy just created... ghosts? Showing duplicates, and when I attempted to trim them, the project exploded.

Edited by Azworai
Link to comment
Share on other sites

I can't believe that commercial software fails to manage a simple file browser successfully. But I see this happen all the time when I delete a file, or when I click on an error message. What I have found is that if I close the project, (from the file menu, without exiting the whole tool) and then immediately reopen, the duplicates are gone.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...