Non-uninstallable weapon

Freeform discussion about anything related to modding Transcendence.
Post Reply
User avatar
AssumedPseudonym
Fleet Officer
Fleet Officer
Posts: 1190
Joined: Thu Aug 29, 2013 5:18 am
Location: On the other side of the screen.

 Basically, I’m trying to make one as a built-in weapon — a launcher, specifically — on a ship I’m working on. I’ve tried… here, let me just do this, it’ll be easlier:

Code: Select all

<Events>
  <CanBeUninstalled>
    (block nil
      (setq return "This weapon is an integrated part of the hull and cannot be removed.")
    )
    return
  </CanBeUninstalled>
</Events>
 That’s the most recent attempt at it. I’ve tried more variants on that basic idea than I can conveniently recall at two-in-the-morning.

 So far, I haven’t been able to prevent the “built-in” launcher from being removed. Making it a virtual weapon at least keeps stations from removing it on its own, which is better than nothing, but it doesn’t stop stations from removing it when installing a different launcher. A little help in straightening the code into something functional be sincerely appreciated.
Image

Mod prefixes: 0xA010 (registered) and 0xDCC8 (miscellaneous)

My mods on Xelerus: Click here!

Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)
EditorRUS
Militia Lieutenant
Militia Lieutenant
Posts: 148
Joined: Tue Oct 30, 2012 6:30 pm

<CanBeUninstalled>
(block nil
(setq return "This weapon is an integrated part of the hull and cannot be removed.")
)
return
</CanBeUninstalled>

There's no return keyword. In order to return a value just write it with no brackets. Like

(block nil
(print "Blah-blah")
5
)

It will return 5.
User avatar
AssumedPseudonym
Fleet Officer
Fleet Officer
Posts: 1190
Joined: Thu Aug 29, 2013 5:18 am
Location: On the other side of the screen.

 That was just the latest attempt, modeled after something else I had found through searching. If I put every syntax variation I’ve tried up over here, we’d be scrolling for a while. I’ve tried putting stuff in <CanBeUninstalled>, <OnUninstall>, and <OnUninstalled> to prevent removal. At one point, I even including just outright destroying the playership inside those tags for testing purposes — and I couldn’t even get that to work.
Image

Mod prefixes: 0xA010 (registered) and 0xDCC8 (miscellaneous)

My mods on Xelerus: Click here!

Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

try:

Code: Select all

<Events>
  <CanBeUninstalled>
    Nil
  </CanBeUninstalled>
</Events>
OR

Code: Select all

<Events>
  <CanBeUninstalled>
    (block nil
      (setq return "This weapon is an integrated part of the hull and cannot be removed.")
      return
    )
  </CanBeUninstalled>
</Events>
If you want to check if this event is being called then use this and look at debuglog:

Code: Select all

<Events>
  <CanBeUninstalled>
    (block nil
      (PrintTo 'log "Is this being used at all?")
    )
  </CanBeUninstalled>
</Events>
If 'Is this being used at all?' is not showing in the debuglog then this event is not being run/ it is not the right event :/
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
User avatar
AssumedPseudonym
Fleet Officer
Fleet Officer
Posts: 1190
Joined: Thu Aug 29, 2013 5:18 am
Location: On the other side of the screen.

RPC wrote:If you want to check if this event is being called then use this and look at debuglog:

Code: Select all

<Events>
  <CanBeUninstalled>
    (block nil
      (PrintTo 'log "Is this being used at all?")
    )
  </CanBeUninstalled>
</Events>
If 'Is this being used at all?' is not showing in the debuglog then this event is not being run/ it is not the right event :/
 Apparently it’s just not getting called at all. And if that’s not where this sort of thing is supposed to go, then I’m at a total loss.

 …Also, was one of those two suggestions you made supposed to be identical to to the code I’d posted, or was that just a copypasta misfire…?

 EDIT: Ah-ha! Progress! The code I posted up at the top does work. …Kinda. It keeps the launcher from being uninstalled on its own — which I found out when I de-virtual-ized it on a hunch — but it does not keep another launcher from “overwriting” it, so to speak. Apparently <CanBeUninstalled> doesn’t get called when you remove something by installing something else in its place?

 RE-EDIT:

Code: Select all

<Events>
  <CanBeUninstalled>
    "No can do."
  </CanBeUninstalled>
</Events>
 Just that was sufficient to prevent uninstallation by any means other than “overwriting” with another launcher, apparently, without mucking about with all the extra code. I would have that out a lot sooner if I hadn’t made the thing a virtual weapon.
 So. I guess the real question now is, how to do I about convincing the game to not “overwrite” the thing?
Image

Mod prefixes: 0xA010 (registered) and 0xDCC8 (miscellaneous)

My mods on Xelerus: Click here!

Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)
User avatar
AssumedPseudonym
Fleet Officer
Fleet Officer
Posts: 1190
Joined: Thu Aug 29, 2013 5:18 am
Location: On the other side of the screen.

 I have yet to have any success with the “overwriting” issue, but I have uncovered some rather… odd behavior while trying to kludge my way through a workaround.

 Setting the ship’s maxweaponslots value to “0” and adjusting the “built-in” launcher’s deviceslots to “-2” didn’t help, and in fact allowed me to plug in as many weapons as I had device slots open. (At a guess, setting any of the maximum slot values to zero basically works as a delimiter. Nice to know, actually, since I’m used to -1 being a max delimiter value).

 Setting maxweaponslots to “1” and the launcher’s deviceslots to “-1” is what gave me weird results. With a non-launcher weapon equipped, I tried to “overwrite” the launcher, expecting to have the game refuse on the grounds that removing the existing launcher would reduce the number of available weapon slots to zero. Not the case. Instead, it went ahead with the “overwrite,” effectively giving the ship more weapons than it should be able to have. Removing the launcher worked as normal, and subsequently trying to reinstall it would have required removal of the non-launcher, as expected.

 Sort of as a last-ditch effort (and out of curiosity), I de-virtual-ified and increased the mass of the launcher to higher than the capacity of the cargo bay — 25 tons, in this case, since this thing is a light fighter — and got more unexpected behavior. I wound up taking the launcher mass up to around 27½ tons before any of the stations stopped offering to remove it to install a new launcher, even with an empty cargo hold. (It didn’t do maneuverability any favors, either, but I would have been more surprised if it hadn’t.)

 To borrow from Carroll, “Curioser and curioser.” Is any of this bug-report-worthy material?
Image

Mod prefixes: 0xA010 (registered) and 0xDCC8 (miscellaneous)

My mods on Xelerus: Click here!

Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

A lot of the behavior is interesting at least. You should make bugthreads on the bugthreads forum and see if George has a good explanation for why the engine is wonky.
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
Arkheias
Commonwealth Pilot
Commonwealth Pilot
Posts: 95
Joined: Mon Jun 02, 2014 8:06 pm

I'm not sure if this counts as necromancy, what with this thread technically still being on the first page and all, but I've been using this code at the end of the <ShipClass> section on a ship I've been designing to prevent certain devices from being removed. If you add the attribute category "ShipStructure;" to a device then that device can't be removed from that specific ship. I based this on the code for the auton bay on the constellation-class player ship so you shouldn't be able to remove the devices either directly or via replacing them with a different device of the same type at a station.

The only problems with this code are that it requires at least version 1.3b1 which was released on 8 March 2014, and that I have no idea what the current opinion of Transcendence modders is on one random person deciding that if a device has the attribute category "ShipStructure;" then it shouldn't be removable from a ship by any means.

Code: Select all

<Events>
	<CanRemoveItem>
		(if (itmMatches gItem "*I +ShipStructure;")
			(cat "This device is too integrated into the ship's structure to be removed.")
			True
		)
	</CanRemoveItem>
</Events>
Cabbage Corp, the only mod with cabbages!

Please feel free to submit bug reports or issues related to the Cabbage Corp mod on the GitHub page, the forum thread, in a private message or even on the Xelerus page. Suggestions are fine too.
User avatar
AssumedPseudonym
Fleet Officer
Fleet Officer
Posts: 1190
Joined: Thu Aug 29, 2013 5:18 am
Location: On the other side of the screen.

 Not technically necromancy yet, I don’t think, but I’ve already dealt with the issue by making <CanInstallItem> disallow installation of launchers (which was also a 1.3b1 fix). Thanks for chiming in though, and it might be useful to someone else wanting to keep something else from being uninstalled.
Image

Mod prefixes: 0xA010 (registered) and 0xDCC8 (miscellaneous)

My mods on Xelerus: Click here!

Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)
User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

I wasn't aware of the change nor the availability of this event. It means I can finally create 'cursed' versions of items :twisted:

~Pixelfck
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de
PM
Fleet Admiral
Fleet Admiral
Posts: 2570
Joined: Wed Sep 01, 2010 12:54 am

Yes, you can make cursed items. A cursed item could even be a one-way upgrade that cannot be undone.
Download and Play in 1.9 beta 1...
Drake Technologies (Alpha): More hardware for combat in parts 1 and 2!
Star Castle Arcade: Play a classic arcade game adventure, with or without more features (like powerups)!
Playership Drones: Buy or restore exotic ships to command!

Other playable mods from 1.8 and 1.7, waiting to be updated...
Godmode v3 (WIP): Dev/cheat tool compatible with D&O parts 1 or 2.
FourFire
Militia Captain
Militia Captain
Posts: 567
Joined: Sun Aug 12, 2012 5:56 pm

It's still the same year as the last post on the thread, so it's not necromancy as far as I am concerned...
(func(Admin Response)= true){
if(admin func(amiable) = true)
Create func(Helpful Posts)
else func(Keep Calm and Post derisive topics)}
Jeoshua
Militia Lieutenant
Militia Lieutenant
Posts: 163
Joined: Sat Sep 06, 2008 3:48 pm

Cursed items? Sounds awesome. Maybe corrupted with nanotech that welds it permanently to your ship when installed, taking over various functions of the ship, and requiring the skills of a "competent" nanotech engineer who really understands these things to actually remove. Domina would likely have a few of these people in her employ.

Or you could use this for a spine-mounted cannon on a ship. That's definitely integrated into the structure of the ship. Which is what interests me about it, since I have a ship that has exactly that I've been meaning to get back to modding. Thanks for this.
Post Reply