Proof of concept: merging ships

Started by kajacx, December 04, 2016, 05:10:02 AM

Previous topic - Next topic

kajacx

Last week I wrote about how to create custom ships in PRPL and now I have expanded on that and created a script that will take your ships and merge them into a lerger one, in-game! How it looks:



This is how it currently works: You move 5 ships you want to merge together into the highlighted area. Then, you go to the script menu and hit "Compile" (it only works in level editor for now) and if you have your ships aligned properly (I reccomend sliding ships with E pressed to avoid any rotation), then the merged ship will be added to yout stock (make sure you have room there). You can then build it and have fun with it.

Now for the problems, as there are many: I have not found many PRPL functions that i needed to make this work as I wanted (for example, how to insta-build your ship, or how to get what modules are on a ship and where), so I will be making a suggestion post, asking for addition of these functions. If those functions are added, I will remake the script so it isn't so terrible.

However, I said last week that I will make merging of ships, so there you go! By the way, you can create ships with size larger than 35x25 with this!
Why do work yourself, when you can write a program that will do the work for you.

GoodMorning

Interesting.

I think that we may need ExtractPlanFromShip, and a function or two to set the build state of hull/modules.
A narrative is a lightly-marked path to another reality.

Oblivion

Someones going to make a huge command ship now with this. Im counting on it.
~Memes have been scientifrically proven to be the very essence of life unto itself~

GoodMorning

Thought: PRPL (Custom Module) Joint

Place two joint modules together, and the ships will fuse. Both CMs must remain operational. If the joint is broken, the ships divide. Possibly each CM continues to request power.
A narrative is a lightly-marked path to another reality.

Oblivion

Wouldn't the new Joint ship just have one CM after the merge?
~Memes have been scientifrically proven to be the very essence of life unto itself~

GoodMorning

I am suggesting a new module, probably PRPLed (at least to begin with). I was envisioning a Joint as some sort of coupling module, which could be used/reused mid-game.
A narrative is a lightly-marked path to another reality.

kajacx

If you want to create uber large ships, this is not yet the way to go, since the merging unfortunately works only for the in-game ships for now.

The reason for that is the lack of GetShipModules and GetShipCMLocation functions, so you cannot read what modules does a ship have with PRPL. Instead I used the front center hull piece to distinguish between different ships, with the module lists and CM locations hardwired into the code.

The same can be said for the joits idea: a good idea, but it would be too much work to program now.

If you want to create a supidly large ship, use the Java code I add here instead, it has examples for Lathe and Cruiser, so it should be pretty straight-forward, just keep in mind that the first line of the hull (in the code) is acctually the bottom line of the hull (on the ship), and the module coordinates are 0-index from the bottom-left of the ship. After you get the base64-encoded string, just feed it into the "AddCustomShipToInventory" PRPL function and there you go.
Why do work yourself, when you can write a program that will do the work for you.

TonnyT

So if one command module goes, what happens? Does the whole ship go? Or does the particulate need to destroy all 5?
Novus Imperium Corporation
CEO: Tony Carlisle

Today our concern must be with the future. For the world is changing. The old era is ending. The old ways will not do.

-President John Fitzgerald Kennedy

planetfall

If you look at the example screenshot, it appears all CMs except the center one are replaced with energy tanks.
Pretty sure I'm supposed to be banned, someone might want to get on that.

Quote from: GoodMorning on December 01, 2016, 05:58:30 PM"Build a ladder to the moon" is simple as a sentence, but actually doing it is not.

GoodMorning

Perhaps I wasn't clear. This was a related concept, not the one already under discussion.
A narrative is a lightly-marked path to another reality.