Help with custom research please

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

ice-design
Posts: 23
Joined: Fri, 29. Nov 13, 19:08
x4

Help with custom research please

Post by ice-design »

Hi guys,

I need some help with my mod and hopefully someone here could give me a hint or straight up help me with the code.
So I have created a new ship for X4 which already works and is buildable where I want it to be.
Now I would like to create a new research which the player has to finish first before the ship gets unlocked in the game, to make it a little bit challenging to the player to actually unlock that ship.
But I fail in creating a new research and disabling/enabling the ship building possibility.

I already have created a new ware in the wares.xml but I don't know how to actually add the research to the research menu.
Also some help would be great to understand how to actually activate the ship to be build, as soon as the research is completed. Therefore I would need to disable it in the beginning. And by disabling I mean not just hide it from the player, but actually disable the new ship for all the other factions as well, so that they only start building it as soon as the player has finished the research.

So basically I need help with these 3 points:
  • Create a new custom research.
  • Deactivate a ship for all faction, so that nobody can build it.
  • Activate a ship for the allowed factions (including player) as soon as the research is finished.

I've looked in the original game's files but I can not find a working solution for my problem. My main focus was on the casino research and on the HQ warp but I can't get it to work at all.
Hopefully someone could help me on this one.
ice-design
Posts: 23
Joined: Fri, 29. Nov 13, 19:08
x4

Re: Help with custom research please

Post by ice-design »

OK, got the research working now.

And ran into a bigger problem.
It seems like I can not activate or deactivate a ship from the wares list.
I tried it with a custom licence, that should be unlocked through the research. But 4 hours into fiddeling around with the source files I realized that it is not possible to create custom licences as the schema does not allow it.
So I tried changing the faction owner of the ship. Changed the owning faction to "ownerless". This holds the ship ware still in the game, but it is not accessible through the wharfs anymore. Perfect. That worked.
Then I tried to set the ware's owner directly through the md script after the research finishes. Which is not possible, at least not to my understanding.

Does anybody know how I can add an owner to a ware in the wares.xml without setting it there directly. Is it maybe possible to execute a diff on the wares.xml directly out from the md script?
Maybe I am totally wrong in my approach. So any idea or hint would be helpfull.
Realspace
Posts: 1640
Joined: Wed, 15. Nov 06, 10:21
x4

Re: Help with custom research please

Post by Realspace »

Hope I got right but...isn't it just simple as adding the tags to the ware? To make a ware excluded or having specific conditions. In my rem mod I excluded some engines from equip/shipyards (bc they have been simplified into 3 types instead of 9) so that the player can use only 3 out of 9, the other 6 being identical to one of the 3. This still allows to spam them at the beginning but are not built during the game. Don't remember the tags now but they are to be found in the ware files
ice-design
Posts: 23
Joined: Fri, 29. Nov 13, 19:08
x4

Re: Help with custom research please

Post by ice-design »

Hmm ... I have never used tags, so not sure how they could work.
Can I add and remove tags later on?
The thing is that I don't want to hide the ship from the shipyards forever. As soon as the player has done the research, the ship should appear in the shipyard.

Return to “X4: Foundations - Scripts and Modding”