Official Mod Code Error Thread - For Mod Authors

You have to beautify the game code. It’s the codeNw.js file in the folder that’s called “compressed” which is inside the GDT folder.

2 Likes

@Darkly That link appears to be dead, or at-least it does not work for me. I am using firefox, if that matters.

Fixed it :slight_smile:

2 Likes

So how do I mod it? I have hte unbeutified code, now, but how do I mod it via the mods folder?

You can only study the source code, not change it. You can learn how you change game code by reading this page.

If you search for var Research = {}; in the code you will find the research.

3 Likes

Actually, I think I was wrong about the “v” thing. It seems like it’s basically a preset for how expensive it is to research something.

v: 1 means it costs 5K in cash and 10 RP
v: 2 means it costs 10K in cash and 15 RP
v: 4 means it costs 30K in cash and 40 RP

etc.

1 Like

I think the price and RP presets are related to the tech level @Darkly

1 Like

Maybe that too, but according to the game code it mainly depends on the v variable.

2 Likes

If this is true, how do i make research x better than research y?

Use a higher v and/or techLevel value in research X. You can any number from 0-7 for techLevel, and 1 or any even number from 2 to 14 for v.

I moved a post to a new topic: Is it possible to replace generic graphic features (v1, v2) with more realistic alternatives?

Does anyone know how I can store the value of the “GameManager.company.getRandom()” ? I need to store it in a var, so I can show it in a notification later. Sorry if my code is ineffiecent, its just how I learnt it.

GDT.addEvent({  
id: "gridMoneySpikeEvent",
isRandomEvent: true,
trigger: function (company) {
    return GameManager.company.researchCompleted.indexOf(Research.grid) > -1;
    },
complete:
    if (dMultiplayer && dMultiplayer.allowCustomData) {
        var customParams1 = [];
        dMultiplayer.sendCustomData("companyGotMoneySpike", customParams1);
})};
getNotification: function (company) { GameManager.company.adjustCash(1000 + 100000 * GameManager.company.getRandom(), "Successful GRID game"); return new Notification({
        header: "Industry News".localize(),
        text: "A major game has newly been released on GRID. It is already 1st on the rankings. {n}This is surely a masterpiece!",
    });}

});

I also get a syntax error on the “if”, and somewhere in my file there is an unexpected token. sigh

Make a global variable for it, like this line after the (function(){ part at the top of the file. Like this:

var ExtendedGRID = {};
(function(){
    var moneySpikeRandom;

You forgot to add a few braces. Fixed it for ya, and I also made it save the random value:

GDT.addEvent({
    id: "gridMoneySpikeEvent",
    isRandomEvent: true,
    trigger: function (company) {
        return GameManager.company.researchCompleted.indexOf(Research.grid) > -1;
    },
    complete: function () {
        if (dMultiplayer && dMultiplayer.allowCustomData) {
            var customParams1 = [];
            dMultiplayer.sendCustomData("companyGotMoneySpike", customParams1);
        }
    },
    getNotification: function (company) {
        moneySpikeRandom = GameManager.company.getRandom();
        GameManager.company.adjustCash(1000 + 100000 * moneySpikeRandom, "Successful GRID game");
        return new Notification({
            header: "Industry News".localize(),
            text: "A major game has newly been released on GRID. It is already 1st on the rankings. {n}This is surely a masterpiece!",
        });
    }
});

The game claims theres an unexpected identifier on this line.

GDT.addEvent(legalIssues);

This is the start of my event code.

 var legalIssues = { 
            id: "legalIssuesEvent",

You need to make legalIssues a global variable.

Oh, thats right. (That just means taking away the ‘var’ if I recall correctly?

I just read your code and found out that you don’t need to make a global variable (unless you moved GDT.addEvent(legalIssues); or the event code to another function.

I also realized that “unexpected identifier” means code typo, so something’s probably wrong with the line above the one you get an error on.

2 Likes

Hey, I’m new to modding games and, when I test my first mod, this error appears:

Error Uncaught error. Please report this to support@greenheartgames.com: Uncaught TypeError: Object # has no method ‘click’ (file:///C:/Program%20Files%20(x86)/Steam/steamapps/common/Game%20Dev%20Tycoon/compressed/codeNw.js:153) Please restart the game.

Enabled Mods: [“gdt-modAPI”,“UltimateLib”,“CheatMod-kristof1104”,“38ab27c7-8a04-4aef-8788-44b8ef21b493”]

The code.js of this mod is: http://en.textsave.org/xJob

And, with other part of the mod, appers this message:

Error Uncaught error. Please report this to support@greenheartgames.com: Uncaught TypeError: Cannot read property ‘experience’ of null (file:///C:/Program%20Files%20(x86)/Steam/steamapps/common/Game%20Dev%20Tycoon/compressed/codeNw.js:1676) Please restart the game.

Enabled Mods: [“gdt-modAPI”,“UltimateLib”,“CheatMod-kristof1104”,“2ba58bcf-c7c0-44b9-865b-ae69d7629ac3”]

The code.js of this part is: http://txs.io/zJob

Other question: How I make a research can only be unlocked by unlocking a research I created? 'Cause I tried and the only way is if the research already in the original game…

Last question: How I make a R&D Research add a research to a game (like 3D Graphics V7)? And how I make a research can be added to the console i’ll make?

Alright, I know this might not be an error but:

How can you open a HTML window inside the game? Would simplify my UI a little bit. :stuck_out_tongue: