[ASK] adding R&D lab research item with only gdt-modAPI

is it possible to add R&D lab research item with just gdt-modAPI? if yes, how to do it?

i’m still new for this, but i want to try to make a mod that could be fun (at least for me :sweat_smile:) to be implemented to GDT… :smile:

Thanks…
sorry for my poor english…

They’re is not. You have to use the code from the code.js to do that.

Here’s an example:

Research.AAAMarketingCampaign = {
      // This has to be a unique ID
		id : "AAAMarketingCampaign",
     // What will be displayed as the name
		name : "Marketing Campaign".localize(),
    // How many points it takes to research
		pointsCost : 1000,
    /* 
     "canResearch" is when it can be researched.
     Basically, the function below checks that everything returns true.
     So if you had something like: return GameManager.company.cash > 50000 
     then it wouldn't be available to research until you have more than 50000 dollars.
     */
		canResearch : function (GameManager.company) {
			return GameManager.company.currentGame && (GameManager.company.currentGame.gameSize == "aaa" && !GameManager.company.currentGame.flags.AAAMarketingCompleted)
		},
      // This is the path to whatever the image icon is for the research
		iconUri : "./images/projectIcons/superb/aaa-marketing.png",
     // Just something that describes what the research is about
		description : "Let's use our in-house skills to design a special marketing campaign for our AAA title.".localize(),
     // targetZone can either be 0 or 2
     // 0 is for Hardware Lab Research
     // 2 is for R&D Lab research
		targetZone : 2,
    // The function that will be launched when research is complete
		complete : function (GameManager.company) {
			if (GameManager.company.currentGame)
				GameManager.company.currentGame.flags.AAAMarketingCompleted = true
		},
    // The function that will be launched if you cancel the project
		cancel : function (GameManager.company) {
			if (GameManager.company.currentGame)
				GameManager.company.currentGame.flags.AAAMarketingCompleted = true
		},
          // Whether or not you can research it more than once
		isRepeatable : true
	};


Research.bigProjects.push(Research.AAAMarketingCampaign);

It’s important that you push the research after you define it.

I haven’t tested this, but it should work.

1 Like

nice, thanks… i’ll try it… :+1:

i tried to add R&D lab item based on example you given, but always getting error (syntax error unexpected token) when i launch the game with my mod installed… i even tried using the exact copy of your example, but still same…
i intended to add R&D item to be research and it will become custom console part, just like 3D Grapics V6 & V7…

thanks :slight_smile:

This works, just tested it:

Research.MMMMarketingCampaign = {
      // This has to be a unique ID
		id : "MMMMarketingCampaign",
     // What will be displayed as the name
		name : "Marketing Campaign".localize(),
    // How many points it takes to research
		pointsCost : 1000,
    /*
     "canResearch" is when it can be researched.
     Basically, the function below checks that everything returns true.
     So if you had something like: return company.cash > 50000
     then it wouldn't be available to research until you have more than 50000 dollars.
     */
		canResearch : function (company) {
			return company.currentLevel > 1
		},
      // This is the path to whatever the image icon is for the research
		iconUri : "./images/projectIcons/superb/aaa-marketing.png",
     // Just something that describes what the research is about
		description : "Let's use our in-house skills to design a special marketing campaign for our AAA title.".localize(),
     // targetZone can either be 0 or 2
     // 0 is for Hardware Lab Research
     // 2 is for R&D Lab research
		targetZone : 2,
    // The function that will be launched when research is complete
		complete : function (company) {
			if (company.currentGame)
				company.currentGame.flags.MMMMarketingCompleted = true
		},
    // The function that will be launched if you cancel the project
		cancel : function (company) {
			if (company.currentGame)
				company.currentGame.flags.MMMMarketingCompleted = true
		},
          // Whether or not you can research it more than once
		isRepeatable : true
	};
Research.bigProjects.push(Research.MMMMarketingCampaign);

It was just a simple syntax error is all.

Syntax error simply meaning somewhere in your mod file theyre was mess up in text by you.

No it was on me. I received the same error. It’s fixed though.

@Fyan_Muhamad I have a working mod file that showcases the example above. If you wish to have it, message me, and I’ll send it to you.