[MOD] Repair Drone Control

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

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

Post Reply
siath70
Posts: 459
Joined: Sun, 11. Jan 04, 03:03
x4

[MOD] Repair Drone Control

Post by siath70 » Sat, 21. May 22, 17:03

First things first, wall of text incoming, this is my first mod for X4. I am used to modding for X3, X4 is a bit different.
With that being said, I have tested this as best as I can, and I see no issues. Not saying there isn't any, but that is why I am releasing it.
Please report any issues here or any suggestions.

This was supposed to be a simple thing to do, it turned out very different than what I thought it would. With being new to the coding scene, even more so.

How this works:
It cancels the repair drone mass traffic when you turn it off, this removes all the VARs. (This is the default mechanic, not something I do.)
The only way I found to restart the mass traffic was to check the ship when the drones are activated and relaunch them based on the damage.
I only ADD code, I do not change anything in the base file, which means it should be compatible with all mods. The only exception to this will be when you restart the drones, it will use the base code, it will ignore (when it restarts) any changes to the part of the code where
it checks for damage. It should then fall into the original code as the restart code is only used to restart the drones (this code is actually the original code that checks for damage).

I tried to use labels when restarting to just make the ship restart all over and I couldn't get it to work, so I resorted to this. It only runs on the player ship and only when you reactivate the drones, so minimal impact.

Some things to be aware of.
I can not control when the drones return, they have orders and they will follow them.
Sometimes they will wander a short distance from the ship before returning.
Mod is only in English, it's all I speak, feel free to translate and I'll add them.
If the AI started the drones they might act weird for a bit, but once you take control they return and launch rather quickly.

I would like to thank kuertee and DeadAir for answering my questions, it helped me with this mod. I used parts of their code here and there to learn the API/MD stuff.

Now with that out of the way...

This mod REQUIRES, SirNukes Mod Support APIs. Either the Steam or NEXUS version will work.

This mod can be safely removed at any time or added at any time, so safe to test and remove if you do not like it.

To access the controls (for those who do not know how) esc->extension options, in there you'll find a menu for drone control.

For now, I am releasing this on dropbox, I will be putting it up on NEXUS and STEAM once I am satisfied everything is in working order. It will be loose files so people can see the code and if they have a better way to do it they can suggest it. I am all about learning.

Some things I found out:
If you just set an arg to stop the drones in the base code, they will not restart when you turn them back on. This is because the code clears everything and then to restart the ship has to take damage to trigger the repair code.
I tried saving the VARs, while this worked to some extent, it didn't work right all the time.

You can also buy new drones for a ship that lost all their drones and reactivate them using this mod. I find this useful for ships in battle that lose all their repair drones and after the battle I stock back up.

So, something are beyond my control with my current skills. I did the best I could here and made it as light weight as I could. Is there easier ways, probably. Some of the Guru coders (kuertee, DeadAir and a few others) could have probably did this in a whole different way.

Anyway, sorry about the wall of text but I wanted to try to hit on everything I could and couldn't do to minimize questions and such.

So, that being said here is the link to the MOD.
https://www.dropbox.com/s/gyth27wup0ybc ... l.rar?dl=0

Link on Nexus:
https://www.nexusmods.com/x4foundations/mods/898

Steam:
I am not sure of Steam Release, I was looking at it and it looks a bit complex. I'll keep looking into it though.

Couple last things:
If you are in control of a ship and have the drones off, I would suggest turning them back on for the AI pilot. If you don't they will have to wait until they get hit again before launching, it's just how the base code works.
The control shows up on any ship, I do not know (well I have an idea) how to make it only show up on ships with repair drones. I am not concerned with this at this moment.
If you have repair drones disabled and take control of a ship that has drones out, it will not recognize they're disabled; you must toggle it. -- this one I have no idea how to fix with out changing code somewhere else, I would love for it to recognize your setting when you take control and Enable drones when you leave. Again though this is a minor point for me.
I suggest hitting ESC, pause the game, change the setting if you are in the middle of a battle or something dangerous.

Thanks to everyone who read this far and thanks to EGOSOFT (for the game and support) and those mentioned above for their help and support.

05/21/2022 -- initial release (beta)
Nexus Link Added
Last edited by siath70 on Sun, 22. May 22, 14:23, edited 5 times in total.

siath70
Posts: 459
Joined: Sun, 11. Jan 04, 03:03
x4

Re: [MOD] Repair Drone Control

Post by siath70 » Sat, 21. May 22, 17:40

Other mods I am working on, I will add links to the posts here when I am ready to release them.
Bail script, completely configurable. --Technically I could release this one. It is based on an existing script but is heavily modified where not much is left from the original. I'll probably give recognition to the original author and release it if haven't heard back from them in a few days or so.

Status:
Script is done, now I am building the menus (you can edit the file to set the settings, no menus yet). Does everything from setting different bail params per ship type to allowing bails from caps if you want it (captain). Ship component destruction randomly on bail, including engines if so desired, will always leave one engine though. I am Also adding crew damage that removes crew instead of them bailing, like a critical failure in a section of a ship.

I am also working on bringing back Terra Corps Fleet Package, this one is in the beginning stages and will be released in stages. Not yet ready for even a beta. I still have the original code from X3 and am using that as a guide.
Status:
Semi started.

I also have updates to mods not being updated anymore that I have released.
Economy Overhaul, viewtopic.php?f=181&t=436267 --Haven't heard from the author, so I'll maintain a patch to make the mod work in the mean time. There are things I can fix if he is just going to abandon it, if he does I'll probably take it over and update it, I am hoping he is just away and will be back though.

And a couple others I am taking a look at.

Post Reply

Return to “X4: Foundations - Scripts and Modding”