Device slot code help please

Freeform discussion about anything related to modding Transcendence.
Post Reply
relanat
Militia Captain
Militia Captain
Posts: 941
Joined: Tue Nov 05, 2013 9:56 am

I'm trying to get two non-launcher weapons to shoot from either side of a playership. Total of 3 weapon slots. One launcher out the front as usual. The next two for weapons. One shooting left, one shooting right.

I can make it work like this:

Code: Select all

	<Device deviceID="&itLaserCannon;"	minFireArc="350" maxFireArc="190" posAngle="55"  posRadius="20" posZ="5"/>
	<Device deviceID="&itLaserCannon;"	minFireArc="170" maxFireArc="10"  posAngle="305" posRadius="20" posZ="5"/>
But if I install another weapon it loses the properties and shoots out the front.

==============
This works for a weapon on one side and a launcher on the other, but that isn't what I'm looking for.

Code: Select all

	<DeviceSlot	criteria="p"	posAngle="55"   posRadius="20" posZ="5" minFireArc="350" maxFireArc="190"/>
	<DeviceSlot	criteria="l" 	posAngle="305" posRadius="20" posZ="5" minFireArc="170" maxFireArc="10"/>
==============
In theory this should work;

Code: Select all

	<DeviceSlot	criteria="p"	posAngle="55"   posRadius="20" posZ="5" minFireArc="350" maxFireArc="190"/>
	<DeviceSlot	criteria="p"	posAngle="305" posRadius="20" posZ="5" minFireArc="170" maxFireArc="10"/>
	<DeviceSlot	criteria="l" 	posAngle="0"	posRadius="40"/>
but in reality the game ignores the second "p" device slot and both weapons shoot out the left hand side.

==============
CabbageCorp, AP's Mongoose playership and PSD6 give examples;

Code: Select all

	<DeviceSlot criteria="w +cabbageCorp" minFireArc="345" maxFireArc="15"	posAngle="0" posRadius="52" posZ="2"/>
	<DeviceSlot criteria="w -cabbageCorp"						posAngle="0" posRadius="52" posZ="2"/>

	<DeviceSlot criteria="w~l" 	posAngle="0" posRadius="20" hpBonus="25"/>

        <DeviceSlot criteria="w +EI;"	posAngle="0" posRadius="20" omnidirectional="true"/>
        <DeviceSlot criteria="w"		posAngle="0" posRadius="20"/>
so it is possible to set device slots to certain limits. I just don't know the specifics or haven't got them right.

========================
In the Wolfen/A mod, gunship256 uses;

Code: Select all

		; Make it fire from the right side of the ship
		(objSetItemProperty gSource chosenWeapon 'pos (list 322 20))
to do something like it, but it needs to be enable manually or in code. I'm looking to make it a permanent part of the ship.

Can anyone tell me if there is a way of setting the 2 weapon slots so that there is one on either side of the ship each with a 160 degree firing arc?
Stupid code. Do what I want, not what I typed in!
gunship256
Militia Commander
Militia Commander
Posts: 451
Joined: Sat Jul 25, 2015 11:41 pm
Location: repairing armor

I had a similar problem trying to set up linked-fire weapon slots. We probably looked at the same mods: PSD6 and Cabbage Corp, among others.

None of the examples I saw actually set up the slots in the XML directly. I assume that it's been tried and it didn't work, just as I failed when I tried.

I thought about setting up a virtual device that places one installed weapon on each side of the ship and re-checks the setup either OnUpdate or on a timer, in either case without the player's intervention. The problem with this is that the player can potentially install more than two main weapons, in which case the algorithm has to choose which of the weapons becomes linked-fire. I had to resort to using a dockscreen because I couldn't figure out a clean way to resolve the problem.
NMS
Militia Captain
Militia Captain
Posts: 569
Joined: Tue Mar 05, 2013 8:26 am

I don't think Transcendence really has slots, in the sense of distinct locations in which devices can be installed. The number of "slots" a device uses is just a way of counting how many devices can be installed. The "slots" you see in dock services are just a way of choosing a category of device. The <DeviceSlot> XML elements just add certain properties to any installed devices that match the criteria. So it doesn't do any good to create multiple elements with the same criteria (it just picks the first one that matches).
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.

 NMS seems to have it pretty much right. The tl;dr version is that there’s no easy XML way to do it, you have to roll up your sleeves and dig into the tLISP side of things. It’s doable — and in a few different ways, even — but it’s never going to be a simple or pretty piece of code. …You should see the ginormous block of code I had to kludge together for an automated weapon linking system on one of my playerships… @.@;
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!)
relanat
Militia Captain
Militia Captain
Posts: 941
Joined: Tue Nov 05, 2013 9:56 am

NMS wrote:I don't think Transcendence really has slots, in the sense of distinct locations in which devices can be installed. The <DeviceSlot> XML elements just add certain properties to any installed devices that match the criteria.
Cheers. I wish I'd known that before I wasted all that time :lol: . I'll put the idea on the backburner for now.
Would it be worth a Ministry request for a way to place device slots on ships? Would it help anyone out (esp PM with PSD) assuming it's possible or worth it.? I don't know enough to make an informed decision and don't want to needlessly clutter up the Ministry.
Stupid code. Do what I want, not what I typed in!
gunship256
Militia Commander
Militia Commander
Posts: 451
Joined: Sat Jul 25, 2015 11:41 pm
Location: repairing armor

relanat wrote:
NMS wrote:I don't think Transcendence really has slots, in the sense of distinct locations in which devices can be installed. The <DeviceSlot> XML elements just add certain properties to any installed devices that match the criteria.
Cheers. I wish I'd known that before I wasted all that time :lol: . I'll put the idea on the backburner for now.
Would it be worth a Ministry request for a way to place device slots on ships? Would it help anyone out (esp PM with PSD) assuming it's possible or worth it.? I don't know enough to make an informed decision and don't want to needlessly clutter up the Ministry.
Yes, that would help! If a ship has a swivel platform at the front, the swivel should be associated with the ship, not the installed weapon.

I'm not speaking for anyone else, but I've had to make some messy workarounds in order to get linked-fire and swivel weapons to function properly. For example, when the player makes a weapon linked-fire, I'm wiping linked-fire options from all the installed weapons and then re-enabling linked-fire for only the weapon that the player chooses.

https://forums.kronosaur.com/viewtopic.php?f=5&t=7559

This could cause all sorts of problems down the line, including incompatibilities with other mods that use linked-fire weapons. It's the reason I'm confining linked-fire to a special playership rather than making a linked-fire enhancer that can be installed on any ship.

If anyone has a cleaner way to deal with this, please let me know. I'll be able to do more if I'm not getting in the way of other people's code.
Post Reply