Official Mod Code Error Thread - For Mod Authors

How do I then add a random event, to only trigger after research is complete?

Another one too: How do I add money? Iā€™m super-stuck.

Error Uncaught error. Please report this to support@greenheartgames.com: Uncaught TypeError: Cannot set property ā€˜completeā€™ of undefined (file:///C:/Program%20Files%20(x86)/Steam/steamapps/common/Game%20Dev%20Tycoon/mods/UltimateLib/UltimateLib.js:1852) Please restart the game.

Enabled Mods: [ā€œgdt-modAPIā€,ā€œUltimateLibā€,ā€œExpPackModā€,ā€œ303bcc71-c7c5-4ebb-9e7e-60a95bb987c9ā€]

seems to happen when using more than 1 mods

You should report that to @alphabit :slight_smile:

Is there any list of possible ā€œcommandsā€ in GDTā€™s API?
Iā€™m sorry, but I donā€™t know how to call itā€¦I Meant ā€œThingsā€ like .isCurrentlyDevelopingGame() etc.

Yes.
Thereā€™s .isCurrentlyDevelopingGame().

:stuck_out_tongue:

There is no list, but the documentation covers all you need to know.

ā€¦I hope You know that I donā€™t meant that.

@Stian wat documentation?

Youā€™ll have to study the GDT source code to find those ā€œthingsā€ (functions) :wink:

1 Like

Damn.
Is it possible with beautifized code?
Or do I need the normal Java code, this, possible to read one?
And, thanks.

Yeah, you can just read the beautified code.

1 Like

hello iā€™m using UME can you please help me how to create a new tab or menu (the things that pop up when you click on the screen)

So looked over the examples and API, all easy enough stuff for me to understand (iā€™ve actually got a Certificat, and soon a Asociates Degree based in Java and Javascript) but Iā€™m wondering if there is a way to change or remove existing components, you see i have this idea for a total overhaul of the topics, genres, and the like as well as a number of other changes but I need to be able to modify not just add and I donā€™t just want to assume the calls for existing code

Hi, youā€™ll have to study GDTā€™s source code. Modifying topics and genres can cause incompatibility with other mods and possibly even errors though, especially if you are deleting them, so my personal advice is not to do that.

The source code is the ā€œcodeNw.jsā€ file in the ā€œcompressedā€ folder which is inside the main GDT folder. Run it through a beautifier and then you can open it in your favourite text editor.

If you havenā€™t read the advanced modding page on the GitHub page of the modding API, I suggest you do that. It contains some information on events and how to extend existing functions (which you will find by reading the GDT source code).

1 Like

yeah Iā€™m going into this know itā€™s pretty much going to require the users to choose this or other mods itā€™s like Requium and Skyre, you cant have both without problems running Skyrim so same sort of thing here, i have tons of experience in java, java script, css, an HTML, Iā€™ve been programing in them for the better part of 2 decades and theres just some core aspects of the otherwise amazing GDT that annoy me and i want to change (Incidently i probably wont be removing topics or genere but Iā€™d liek to rename then and change their weight values, i know strignt up deleting them would break way to much code but i could change them)

For example Iā€™d change Vampire to ā€œsupernaturalā€ which would represent vampires, werewolves, and anything else of the sort, and untimatly i want to add sub topics (sub topics donā€™t do anything in terms of raiting just help the more generic topics be more specific to your project

If you want to change ā€œVampireā€ to ā€œSupernaturalā€ itā€™s pretty simple:

Topics.topics.filter(function(topic) { //filter the topics array
Ā   Ā return topic.id === "Vampire"; //return topics with the ID "Vampire" (there's only one)
})[0].name = "Supernatural"; //change the topic name

Assuming most mods that read/modify the topic list check the ID and not the name, there shouldnā€™t be any incompatibilities here. The problem, however, is that the ā€œSupernaturalā€ string wonā€™t be translated into other languages. You can either ignore this or implement your own localization function (which my mods do nowadays).

Subtopicsā€¦ well, you will have to figure that out on your own :wink:
The div element for the ā€œcreate a gameā€ dialog is #gameDefinitionContentTemplate if youā€™re interested in making UI changes to it.

2 Likes

You should be promoted to moderator for this forum, I feel. You are using a lot of your spare time on this forum, helping other people. Thank you!

1 Like

I Donā€™t think thats possible.

thanks for the tips (and in case your curious in other stuff Iā€™ve done i do have a demo i currently have on hold because my pc is well a POS for a 3d/2d MMO development, buti do have a alpha build of my JAVA code here http://nekollx.deviantart.com/art/JaG-Character-Creator-Alpha-Build-4-371734980)

In this example from the wiki,

GDT.addResearchItem(
    {
        id: "Swift Loading",
        name: "Swift loading".localize(),
        v: 4,
        canResearch: function (company) {
            return LevelCalculator.getMissionLevel('Level Design') > 5 //The 'Level Design' level has to 6 or higher
        },
        category: "Level Design",
        categoryDisplayName: "Level Design".localize()
    });

What does v: 4 mean, and why does any old number not work?

1 Like