Single-Use Witchdrive OXP

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
ocz
Deadly
Deadly
Posts: 175
Joined: Tue Nov 10, 2015 1:59 pm

Single-Use Witchdrive OXP

Post by ocz »

Here's a little something for owners of ships without a Witchdrive. "Without a Witchdrive?", I sense you thinking, but yupp. There are means to get hold of such a vessel. With the help of [wiki]Illicit Unlock OXP[/wiki] for example or other OXP Ships. Gecko, Kraid and some others just don't have it. But they have a bit cargo space in most cases. For this few occasions, when you need it, I present the "Single-Use Witchdrive" to you.

As the name implies it can only be used one time before it kicks the bucket, but you can repair it at a suited station. It also takes up 2t of cargo space, which is also quite a lot on most of those ships. "Wait.", I sense you again, "What if the Thargoids pull me out of Witchspace in-between systems?" Well, then you are pretty scre*ed. The drive did its job and won't let you escape, but you can also buy a second set of spare coils, which can be use to make 2 jumps into Witchspace before you have to repair them(, at the price of credits naturally and another ton of cargo space.)

This little beast can't be fitted into a ship, that already has a Witchdrive (good ol' Cobra MK.III for example) and why would you want to? It's also quite hightech. You can only buy it at systems with at least Techlevel (TL) 10, but you can repair it in systems with TL 3 and sell it everywhere. (You can't buy it back there though, so be careful when selling it.) "Wait, what about systems with TL 1 or 2?" You again, huh? Guess what. Hitch-hike by using other wormholes, like you would do without it anyway. :D

And here's the link to the wiki:
[wiki]Single-Use Witchdrive[/wiki]

And the download link:
Singel-Use_Witchdrive-0.9.2.oxz

Licence:
This work is licensed under CC BY-NC-SA 4.0
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
Last edited by ocz on Fri Nov 27, 2015 5:06 pm, edited 4 times in total.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Single-Use Witchdrive OXP

Post by Smivs »

Congratulations on the release, and welcome to the Dark Side - have a cookie :)
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: Single-Use Witchdrive OXP

Post by spara »

Great news, ocz. Miners' Guild thanks you 8) .
ocz
Deadly
Deadly
Posts: 175
Joined: Tue Nov 10, 2015 1:59 pm

Re: Single-Use Witchdrive OXP

Post by ocz »

Thanks again. I like cookies. Everything for the miners guild.

I hope this OXP won't turn out be such a troublemaker like my other one. Its scripts should be simple enough to be compatible with nearly any thinkable OXP and to stay that way for a long time. If you still find something, please don't hesitate and post it.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Single-Use Witchdrive OXP

Post by phkb »

Although in normal circumstances you won't need a spare hyperdrive in a Cobbie Mk III, by using Capt Murphy's Breakable witchdrive (which I've replicated in "Ship Configuration") there might be times it could be handy to have a spare. Swap out the damaged item for the pristine one.
ocz
Deadly
Deadly
Posts: 175
Joined: Tue Nov 10, 2015 1:59 pm

Re: Single-Use Witchdrive OXP

Post by ocz »

I didn't consider Breakable 'Standard' Equipment OXPs - Breakable Witch Drive v1.3.1. I take a look into it.
Under normal circumstances you shouldn't be able to buy it for your Cobra. As it stands now, I have no means of checking, if the ship had or hadn't have got a drive before buying the SU-Witchdrive. Once it is aboard it has a Hyperspacemotor. Only the fact, that it's there makes it distinguishable. When it's removed or damaged the ship loses all Witchjump capability until the gamestate is saved and restored. (This restores it from shipdata.plist.) Is there a script method that allows to read data directly from plists? (player.ship.hasHyperspaceMotor flips its value, when the ship gains a Witchdrive.) Guess I have to use a missionVariable when it comes to it. :lol: Ahh, but then player.ship.hasHyperspaceMotor would still be false, when the drive is broken.

Edit: As I see it "Breakable 'Standard' Equipment OXPs" doesn't use player.ship.hyperspaceSpinTime to set a value, as this use of the method is too new. In this case it can't set a Hyperspaceable ship to player.ship.hasHyperspaceMotor === false. Therefore my OXP is spared, but my OXP sets player.ship.hasHyperspaceMotor === true for ships without a normal W-drive, which should lead to a automatic installation of the breakable W-drive without any function, when the SU-W-drive gets removed, even if the breakable W-drive is repaired.

An example: A Cobra Mk.III automaticly gains the breakable W-drive, when a savegame is loaded, but can't be outfitted with a SU-W-drive even when the breakable W-drive is broken. (Until a newer version comes out, which makes use of the player.ship.hyperspaceSpinTime to en-/disable the drive. Then all hell breaks loose.)
A second example: A Gecko won't gain the breakable W-drive, when a savegame is loaded, unless it gained a SU-W-Drive before saving. Then Breakable Witch Drive v1.3.1 will detect it with player.ship.hasHyperspaceMotor and "think" is would be a standard W-drive and install the breakable one onto the Gecko, which should not happen.

I'll check if my assumption are true will implement a workaround, that removes the br. W-drive from ships without normal W-drives after loading.
Last edited by ocz on Fri Nov 20, 2015 7:50 pm, edited 1 time in total.
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Single-Use Witchdrive OXP

Post by Norby »

ocz wrote:
Is there a script method that allows to read data directly from plists?
There is not a general way for all plists, just for shipdata.plist:

Ship.[url=http://wiki.alioth.net/index.php/Oolite_JavaScript_Reference:_Ship#shipDataForKey]shipDataForKey[/url]("cobra3-player")["hyperspace_motor"]

Note the capital "S" at start, this is a must due to it is a static method.
ocz
Deadly
Deadly
Posts: 175
Joined: Tue Nov 10, 2015 1:59 pm

Re: Single-Use Witchdrive OXP

Post by ocz »

Norby wrote:
ocz wrote:
Is there a script method that allows to read data directly from plists?
There is not a general way for all plists, just for shipdata.plist:

Ship.[url=http://wiki.alioth.net/index.php/Oolite_JavaScript_Reference:_Ship#shipDataForKey]shipDataForKey[/url]("cobra3-player")["hyperspace_motor"]

Note the capital "S" at start, this is a must due to it is a static method.
Ahhhhaaaa!!! That might become very handy. Thanks.



Edit:
Ohhh, this is rich. Both OXP missed each other just by pure luck. The breakable W-drive OXP checks in this.startUp if there is a hyperdrive and my OXP add it afterward in "this.startUpComplete".

Just relying on player.ship.hasHyperspaceMotor is too risky. I'll try to implement shipDataForKey.

Edit2: Both OXPs do clash at least at one point. The breakable W-drive gets buy-able when my SU-W-drive is fitted.
On the bright side, for everyone who found this thread and is interested in the data read-out out of the shipdata.plist. Ship.shipDataForKey(player.ship.dataKey)["hyperspace_motor"] will return a "yes" or "no" for the ship you're currently sitting in. Ship.shipDataForKey(player.ship.dataKey)["hyperspace_motor"] will return a "yes" or "no" for the ship you're currently sitting in, if there is the "hyperspace_motor" entry. Other keys instead of "hyperspace_motor" like "name" or "max_flight_pitch" are usable, too. (Just take a look into the shipdata.plist to see the different kinds of keys.)

Edit3: Not every ship that has been specified in the shipdata.plist has a "hyperspace_motor" entry! If it hasn't one the ship just gains one, but Ship.shipDataForKey(player.ship.dataKey)["hyperspace_motor"] === "yes" will still be false!!! If you want to replace "player.ship.hasHyperspaceMotor" please use "!(Ship.shipDataForKey(player.ship.dataKey)["hyperspace_motor"] === "no")". That does look oddly complicated, but just says, "If there is a "hyperspace_motor" entry, that isn't "no", or non at all, that ship has a drive and I return true."
vsfc
Dangerous
Dangerous
Posts: 103
Joined: Wed Jul 10, 2013 12:39 am

Re: Single-Use Witchdrive OXP

Post by vsfc »

Hi All,

Breakable Witchdrive oxp is updated to 1.3.2 version.

Where can I find code for Ship Configuration?

Cheers,

VSFC
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Single-Use Witchdrive OXP

Post by phkb »

What needs to change in Ship Configuration? I've got a minor patch in the works so if a change is needed I'm happy to add it in.

(Incidentally, the links for the OXP/OXZ for Ship Configuration are in the first post of the Ship Config thread).
vsfc
Dangerous
Dangerous
Posts: 103
Joined: Wed Jul 10, 2013 12:39 am

Re: Single-Use Witchdrive OXP

Post by vsfc »

Phkb,

As you mentioned above in this thread that Breakable_Witch_Drive from Capt Murphy is replicated in Ship Configuration. Is the separate oxp for this drive is still relevant?
phkb wrote:
Although in normal circumstances you won't need a spare hyperdrive in a Cobbie Mk III, by using Capt Murphy's Breakable witchdrive (which I've replicated in "Ship Configuration") there might be times it could be handy to have a spare. Swap out the damaged item for the pristine one.
Thanks,
Vsfc
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Single-Use Witchdrive OXP

Post by phkb »

vsfc wrote:
Is the separate oxp for this drive is still relevant?
Absolutely. I don't think Ship Configuration will be to everyone's taste - some players will prefer to have a uber-ship with everything-including-the-kitchen-sink installed. So for those players having a separate OXP is still valuable. I've flagged Ship Config to be incompatible with the various "Breakable" OXP's that are impacted.

I've had a very brief look at the code changes you've made to the other OXP, but I'm not sure I understand the reason behind it. You've essentially changed "player.ship.hasHyperspaceMotor" with "Ship.shipDataForKey(player.ship.dataKey)["hyperspace_motor"]". Is this because you want to distinguish between a witchspace drive that comes with the ship to one that is installed via the single-use drive, in order to restrict the damage control options to one or the other, so the Breakable witchdrive OXP doesn't break and/or repair the Single-use witchdrive?
vsfc
Dangerous
Dangerous
Posts: 103
Joined: Wed Jul 10, 2013 12:39 am

Re: Single-Use Witchdrive OXP

Post by vsfc »

Looks like it is, the code change was done by ocz, he sent the code to me to make this oxp compatible with his single use witch drive. This will still need to be tested. Any suggestions please let me know.
ocz
Deadly
Deadly
Posts: 175
Joined: Tue Nov 10, 2015 1:59 pm

Re: Single-Use Witchdrive OXP

Post by ocz »

Sorry for the late answer. I'm kinda occupied.

Pffftooabbb..."Why" is what you are asking? That's 6 months ago. Frankly, all that is left in my mind of the reasoning behind "Why did I write the code, the way I did?" by now, is a faint blur of a memorysmear. :)

I remember, that there were compatibility issues. My Single-Use Witchdrive should only be installable onto ships without an own standardfitted witchdrive, such as a Krait or a Gecko. To check this I first used player.ship.hasHyperspaceMotor, but that didn't work well, as player.ship.hyperspaceSpinTime was able to flip that value. I needed a reliable way to check if a given ship has a drive fitted. !(Ship.shipDataForKey(player.ship.dataKey)["hyperspace_motor"] === "no" does a good job to determine, if one is installed per shipdata.plist.

As far As I remember vsfc's Breakable Whitchdrive, was written to break the Standarddrive (called Throudrive in the OXP). My S-U Witchdrive OXP was new and interfered with the way Breakable Whitchdrive worked. It made the Throudrive somehow purchasable for exsample. Another thing it messed up was, that SUWitchdrive set the hyperspace capability of a ship to true, which Breakable Whitchdrive would interpret as if a standard Throudrive is installed (which wasn't the case) as it only checked for player.ship.hasHyperspaceMotor being true (, if I recall correctly).

I believed I changed player.ship.hasHyperspaceMotor to Ship.shipDataForKey(player.ship.dataKey)["hyperspace_motor"] for that later reason, so that my OXP and no other OXP messing with the hyperspace capability of a ship might break the Breakable Whitchdrive OXP again.
phkb wrote:
I've had a very brief look at the code changes you've made to the other OXP, but I'm not sure I understand the reason behind it. You've essentially changed "player.ship.hasHyperspaceMotor" with "Ship.shipDataForKey(player.ship.dataKey)["hyperspace_motor"]". Is this because you want to distinguish between a witchspace drive that comes with the ship to one that is installed via the single-use drive, in order to restrict the damage control options to one or the other, so the Breakable witchdrive OXP doesn't break and/or repair the Single-use witchdrive?
ÖÖhhh...Yah. Yah. Exactly. That sounds good. I go with that.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5366
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Single-Use Witchdrive OXP

Post by Cholmondely »

Typos in the Equipment plist:

Singel-Use Witchdrive & Repair: Singel-Use Witchdrive
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
Post Reply