Official Mod Code Error Thread - For Mod Authors

That is it’s version number I believe, so it is swift loading v4

Ok, unrelated question. (Well, kinda) I am gonna make a mod that replaces some vauge researches (advanced physics) with more precise ones (Realistic gravity, rag-doll, friction) Where are the original researches so I can change them? Is it even possible?

It’s tech level. I’m pretty sure higher tech levels mean better review scores, console sales etc.

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.

You can use 1 or any even number from 2 to 14 as the value.

4 Likes

And what about my other question? Is it possible? I And how do I make so that if your game has advanced ragdoll, you cannot also have basic ragdoll selected?

It’s possible, I’m just not sure how it’s done

1 Like

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",