[MOD] Shipyard and Player Shipyard - Ship recycling v0.07 (6 Apr 2017)

The place to discuss scripting and game modifications for X Rebirth.

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

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7411
Joined: Mon, 15. Dec 03, 18:53
x4

Post by BlackRain » Sat, 4. Apr 15, 03:48

BerserkKnights Build shipyards was downloaded a lot because it was the first mod out that allowed building shipyards. My version is a continuation of Berserk's work since Berserk is no longer around. Berserks mod is not supported any more.

Also, JTH, the reason you couldn't load your save when you were using the buildshipyards mod is because it gets added as a dependency in the save file. Editing the save file and removing the small line at the top where it says buildshipyards would allow you to load the save without the mod active.

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Sun, 5. Apr 15, 15:06

Requiemfang wrote:Noticing something odd and I am not sure if it's been reported. When I go to recycle a ship at a shipyard has 2 or more dockyards. If one of the dockyards/drydocks is occupied by a ship being built and the other yard is free and I choose that one to recycle the ship, the ship in question goes to the dock yard where the ship that's currently being built is located instead of going to the free one. It's a bit of an annoying bug.

The issue is consistent with shipyards that have the 2 large ship dockyards as the two times it happened I tried to recycle Rehannas I capped. Each time one of the dockyards was not currently being used to build a ship by NPC factions.

Edit:

Small question of course is... will this work with Blackrains player shipyard mod? I couldn't figure out if I should or could from the post made about it.
It hasn't been reported yet, so thanks :)

Are you running the preliminary test patch of version 0.03 ? if not please try it. The test patch should cope better than version 0.02 with two L ship cradles with one caveat.

Known issues

"Using multiple ShipTraders at the same time may have unfortunate consequences, do not attempt to recycle two ships at the same time."

what it probably should say is

"Using multiple ShipTraders at the same time may have unfortunate consequences, do not attempt to recycle two ships or build/repair/modify one ship and recycle another at the same time ."

The reason for me saying this is that I think the NPC_Shiptrader script uses global variables for controlling ship movement and detecting when a ship has arrived in a cradle and each ship dealer runs their own copy of the script, so they can upset each other. So two L cradles equals two copies of the script, two L cradles plus an XL equals 3 copies of the script. The medium ships use a different script NPC_Shiptrader_Small. The medium ship dealers could potentially upset each other too.

Do both L cradles recycle with the ships going to the right cradle if nothing else is happening in the other cradle(s) ?

This mod was intended for use with BlackRain's player shipyard mod.

jth

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Mon, 14. Dec 15, 18:54

- [10.12.2015 - V0.04 Public Beta]
Completely rewrote the ship selection user interface using customised versions of menu_property.lua and menu_buildcost.lua
Moved ship selection logic out of md script and into the GUI
This means that you cannot select a ship for recycling that does not fit in the ShipTraders cradle unlike previous versions where this was allowed initially but detected later and the process aborted
RecycleCostMenu checks the shipyard prerequisites before allowing you to OK which again avoids a later abort for lack of ShipTrader resources
The GUI API calls can get the shields and turrets from a ship that is Out Of Zone (OOZ) so the restriction on the recycled ship being in the same zone as the player has gone
No longer shares the sellship confirm menu so it makes one less change to ShipTrader.xml
Now recycles installed drones, ammunition and cargo
When recycling cargo it pays the full price for any wares that will fit in station storage and 50% if they do not fit or are not standard wares for a shipyard
When cloning the crew to the shipyard bar it now keeps their original names
Now multi lingualwhich means that a lot of the messages will have changed subtly to fit existing translated words
Now makes a single fund transfer for all crew contracts to cut down on event monitor messages
Now uses the FormatThousands library to format the money amounts with a separator between thousands
Removed ship selection logic and its event monitor messages from md script
Removed ship building ware estimate code from md script as this is now done in the RecycleCostMenu lua script which means that it no longer builds a dummy ship to find the necessary wares
Removed ship turret and shields finding code from md script as this is now done in the RecycleCostMenu lua script
Modified the station stocking code to use the less complicated array that RecycleCostMenu creates
Replaced the turret and shields stocking code with a simple loop that adds the drones, ammunition and cargo to the station from another array that RecycleCostMenu creates

Reaperxvii
Posts: 357
Joined: Thu, 29. May 14, 19:03
x3ap

Post by Reaperxvii » Mon, 11. Jan 16, 01:04

So I tried a standard construction vessel and it let me bring up the menu (I didn't try it yet though)

but when I tried recycling a Heavy sul I got the same error as I posted on the steam workshop link :/

I don't know if it matters but the shipyard being used is a BTO line that builds behemoths (from black rains CWIR mod)

The script works fine on non player owned shipyards though :)

**EDIT**

I just realized something, can you recycle a ship if it isn't constructed at that station?

I'm testing this theory now, waiting on a shipyard to build.

**EDIT 2**

The light sul didnt work, I just got these errors

Code: Select all


[gamestart: 1] - [01/11/16 01:14:12]: Error: UI::ICom::PointOfInterestSink::IsMessageBlocked() - Invalid state. We tried to retrieve the representative component for a POI which has been removed already. Fallback to not blocking the message.

[gamestart: 1] - [01/11/16 01:15:08]: Error: shiprecycle_menu_cost Recycling - Light Sul

[gamestart: 1] - [01/11/16 01:15:08]: Error: Error while executing onEvent script for event: showShipRecycle_CostMenu.
Errormessage: [string "extensions/shiprecycle/ui/shiprecycle/shiprec..."]:216: attempt to compare nil with number
Could a mod I have running cause these errors? I have quite a few on including the fighters mod which makes fighters able to dock at carriers, going to try a regular rahana now

**EDIT 3**

Sorry for the spams of editing haha, but I got the same error :/

Code: Select all

[gamestart: 2] - [01/11/16 01:24:58]: Error: shiprecycle_menu_cost Recycling - Rahanas (Container)
"We are the middle children of History. Born too late to explore the earth, born to early to explore the stars."

"Time is the fire in which we burn"

Reaper's Mod Index

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Mon, 11. Jan 16, 13:27

Thanks for posting over here.

As far as recycling is concerned if it fits in the dock then it should recycle and it will tell you if it doesn't fit and won't let you select it.

I did most of my testing in an NPC shipyard in Darned Hot Air just because it was there and had L and XL docks then tried a few ships through one of mine and they all worked.

They were standard ships though Rahamas, Titurel, CV, Taranis

I was more concerned with whether it did the drones, wares and weapons and even then that took a horrendous amount of time

The shipyard should not matter at all although I did find a few things with player shipyards that did not work at the same speed (much slower)

It shouldn't matter where they were built the recycling shipyard just has to understand them .......

My guess is that some piece of data is not coming back which is upsetting the gui if I can work out what it is then I may be able to compensate

Things like

Error: shiprecycle_menu_cost Recycling - Light Sul

actually are not errors it just that the lua command to log stuff sticks "Error:" on the front

DebugError("shiprecycle_menu_cost Recycling - " .. GetComponentData(menu.recycledship, "name"))

From what you are saying it sounds like a bigger problem

The big problem with this stuff is reproducing the fault so I have something that I can debug

Do you have a save game that I could have ? a dropbox link would be ideal you can PM it to me

Otherwise I think that I may have some more save games somewhere with a larger player shipyard

jth
EDIT Might have spotted something

Is your player shipyard essentially empty of wares ?

EDIT2 Found it - happens if the station has zero food or energy which would be true for a brand new player station

EDIT3 Did test if the player shipyard didn't have enough of the two wares but not if it had none at all. Oops :(

Fixed - v0.05 released on Nexus and Steam
Last edited by jth on Mon, 11. Jan 16, 16:01, edited 5 times in total.

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Mon, 11. Jan 16, 15:27

- [11.1.2016 - V0.05 Public Beta]
shiprecycle_menu_cost gui - Fixed failure to recycle any ships when there was zero energycells or foodrations on the shipyard which will happen with a brand new player shipyard

Reaperxvii
Posts: 357
Joined: Thu, 29. May 14, 19:03
x3ap

Post by Reaperxvii » Mon, 11. Jan 16, 19:14

Worked Like a charm, thanks! I never though about it being completely empty as a factor :oops:
"We are the middle children of History. Born too late to explore the earth, born to early to explore the stars."

"Time is the fire in which we burn"

Reaper's Mod Index

Aranov
Posts: 134
Joined: Mon, 3. Jun 13, 23:08
x4

Post by Aranov » Wed, 3. Feb 16, 19:38

Quick question, is this compatible with 4.0 Beta 7?
I'm not getting the option the recycle a ship at any shipyard.

I've tried disabling all my mods but that didn't help, so unless something is baked in my save, i can only see Beta 7 or the Player Shipyard mod itself as the culprit.

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Wed, 3. Feb 16, 20:42

Aranov wrote:Quick question, is this compatible with 4.0 Beta 7?
I'm not getting the option the recycle a ship at any shipyard.

I've tried disabling all my mods but that didn't help, so unless something is baked in my save, i can only see Beta 7 or the Player Shipyard mod itself as the culprit.
I have just tried it with 4.00 Beta 7 and the option appeared and it managed to recycle a Rahanas OK at the RoC BTO shipyard at Darn Hot Air so I am going to provisionally say it works. FYI My version is not from Steam.

Anything useful in the debug.log ?

Egosoft are releasing so many Beta versions that I can't test everything against every one of them. I tested everything against 4.00 beta 3 and am only testing the mods that I am working on against the newest beta

I just hope that I get enough notice to have one quick go with everything at their final Beta before 4.00 gets released.

Regards

jth
PS What I have found with Beta 5 is that if you have anything in the extensions\md folder from a previous beta then it can do nasty things

Aranov
Posts: 134
Joined: Mon, 3. Jun 13, 23:08
x4

Post by Aranov » Wed, 3. Feb 16, 22:37

Ok false alarm, problem was between chair and keyboard.

Somehow updates for this mod and player shipyards were disabled in the extensions menu, so my version from the workshop was horribly out of date.

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Thu, 4. Feb 16, 00:14

Aranov wrote:Ok false alarm, problem was between chair and keyboard.

Somehow updates for this mod and player shipyards were disabled in the extensions menu, so my version from the workshop was horribly out of date.
At least you are going now and I can say that it works with 4.00 Beta 7

Please let me know what you think of the new GUI, it was a lot of work and nobody has said a thing about how nice it is :)

jth

Aranov
Posts: 134
Joined: Mon, 3. Jun 13, 23:08
x4

Post by Aranov » Fri, 5. Feb 16, 03:22

Well the new UI seems flawless.
Quick and easy to use, and perfectly integrated in to the existing UI.

Seriously fantastic mod, makes playing a pirate so much more fun.

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Sun, 14. Feb 16, 13:02

[OCN] Mandrid on Steam wrote:I think this is a great idea to restock materials into shipyards. But it makes no sense that you can sell a ship for say 10 million, or recycle it for 15 million plus giving the materials to the station.

If anything, if selling gives you 10 million, then recycling should only get you 50-75% of the ship's value. Not 150%. Because now there's no reason to ever sell a ship the vanilla way.


The reason for the discrepancy is that the selling price pays half for the cargo and nothing for drones and missiles and the latest version of Ship Recycle uses the shipyard to do nominal for cargo if its usable by the shipyard or 1/2 if not + nominal price for drones and missiles. Its surprising how much drones and missiles are worth.

Without the ship recycling I think that ES were hoping that you would work this out and empty the ship before selling it at which point you should get a similar amount of money. Note that if you sell drones and missiles at a shipyard then it pays you 100%. EDIT actually it doesn't see below

It would obviously take you a lot longer which is fine for a few times but I found it a pain after that.

The material recovery was put in for the pirate scenario although I felt that NPC shipyards should be able to do this too as it made the game economy a touch more realistic.

I may have been too generous with my prices on usable wares, I will think about it.

However I do feel that shipyards are the ideal place to efficiently recycle and the actual value and quantity of the wares that you get is not as high as you might think which is why you get 100% of the building wares. It does charge you the energy and food costs of doing it.

Maybe I ought to charge a convenience tax on drones and missiles for saving the player time and effort .... :)

jth

EDIT 24 Feb

I have revisited the sums and you are right they are dodgy as of v0.04 :(

Managed to loose the tracking of what shipbuilders pay to buy back ships (80%), drones (85%) and ammunition (90%)
Have also done a 90% recycling factor, shipyards should be better at it than construction vessels but they shouldn't be perfect
Also did the handling charge for busy players

Sums should be about right now.

My feelings on payment is that if you sell to an NPC shipdealer then you should be paid about the same amount and then the shipdealer should be allowed to break up the ship and get 90% of the wares back.

For player shipyards you don't get paid but do break up the ship and get 90% of the wares back. You don't pay the handling fee as you own the shipyard.

Have fixed them in v0.06

Apply a 90% recycling factor to ship hull wares
Rebalance prices to track what shipbuilders pay to buy back ships (80%), drones (85%) and ammunition (90%)
Add an extra 10% handling charge to wares that could be sold to the station by the player before the ship is recycled. As the Teladi say "time is money".
Last edited by jth on Wed, 24. Feb 16, 17:48, edited 4 times in total.

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Wed, 24. Feb 16, 17:22

- [24.2.2016 - V0.06 Public Beta]

shiprecycle_menu_cost gui - Add remote logging via md script to remove false positive Error messages, caused by DebugError logging commands, in debug.log that were actually informational
shiprecycle_menu_cost gui - Compensate for parameter changes to Encyclopaedia API in 4.00 RC2 to prevent Encyclopaedia buttons crashing the GUI
shiprecycle_menu_cost gui - Apply a 90% recycling factor to ship hull wares
shiprecycle_menu_cost gui - Rebalance prices to track what shipbuilders pay to buy back ships (80%), drones (85%) and ammunition (90%)
shiprecycle_menu_cost gui - Add an extra 10% handling charge to wares that could be sold to the station by the player before the ship is recycled. As the Teladi say "time is money".
shiprecycle_menu_cost gui - Changed API call used for calculating free space to take into account the available space for the ware instead of total available space
shiprecycle_menu_cost gui - Fix issue with calculating refund when recycling where there is no storage space for a specific ware. Now correctly refunds 50%
shiprecycle_menu_cost gui - Adjusted on screen messages a litle for when ware doesn't all fit into shipyard storage
shiprecycle_menu_cost gui - Suppress Drone section when there are no drones

User avatar
eMYNOCK
Moderator (DevNet)
Moderator (DevNet)
Posts: 2060
Joined: Thu, 21. Aug 03, 10:37
x4

Post by eMYNOCK » Tue, 15. Mar 16, 18:38

Cheers jth,

i am not longer able to use your Ship Recycle and any Player Shipyard Mod (based on BlackRains Mod) together.

It still works with the slightly outdated Player Shipyards Mod but not with his Updated Ship Dealers from CWIR.

Would be sweet if both were working together again.

Regards

edit:
me self @ steam wrote: ...
Because the only file that both Mods share is the NPC_Shiptrader... and me not knowing how to match both Mods User Interface...
...
Well, we are here now and hoping for Support :D
Last edited by eMYNOCK on Tue, 15. Mar 16, 22:59, edited 2 times in total.

Requiemfang
Posts: 3206
Joined: Thu, 16. Jul 09, 12:24
x4

Post by Requiemfang » Tue, 15. Mar 16, 20:57

I can confirm what eMYNOCK is saying, noticed it broke after eMYNOCK updated his combined mod and said so on Steam. Might as well say it here. Hope a fix comes ASAP.

User avatar
eMYNOCK
Moderator (DevNet)
Moderator (DevNet)
Posts: 2060
Joined: Thu, 21. Aug 03, 10:37
x4

Post by eMYNOCK » Wed, 16. Mar 16, 01:46

Okay... mea culpa... You can scratch that report.

I've accidentally broke something in my own Mods, to be xact i included the Shiptraders into a Mod that depends on my Shipyard Mod (and that messed the whole stuff up).

Should be sorted now.

Sorry for all the Confusion and thanks for the patience.

Requiemfang
Posts: 3206
Joined: Thu, 16. Jul 09, 12:24
x4

Post by Requiemfang » Wed, 16. Mar 16, 02:29

:lol: sucks when that happens

erfan2333
Posts: 3
Joined: Thu, 9. Jun 16, 05:17
x4

Post by erfan2333 » Wed, 5. Apr 17, 13:58

this is a bug in 4.10 RC3.
when I select the ship then click "recycle" button,but recycle cost menu didn't appear.And pressing any key does not respond, except "esc".
in case I removed the other mod,but the problem still exists.
:) By the way,the mod is good,thanks for your nice work!

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Wed, 5. Apr 17, 14:11

Thanks for providing some detail on what is happening and letting me have the exact version. Looks like we are getting close to the final release.

That should save me a lot of time and help me to avoid fixing the wrong problem :-)

I have been thinking about making this mod more 4.00 as far as the Recycle cost menu is concerned as it doesn't have any context sensitive help as its based on an Egosoft 3.60 menu. I did that to make sure it was 3.60 and 4.00 compatible but most people should be onto 4.x by now. Might look at that too and set a minver of 4.00

jth

Post Reply

Return to “X Rebirth - Scripts and Modding”