Weapon posAngle

Freeform discussion about anything related to modding Transcendence.
Post Reply
gunship256
Militia Commander
Militia Commander
Posts: 451
Joined: Sat Jul 25, 2015 11:41 pm
Location: repairing armor

Tue Feb 16, 2016 6:49 am

I'm trying to implement linked-fire weapon slots on a modded Wolfen. I have everything working except, of all things, positioning the weapons properly on the ship. I'd like to have the main weapon fire on the left and the secondary weapon on the right, like the way the main weapon and launcher fire on CC's Manticore.

As stabs in the dark, I've tried this:

Code: Select all

<DeviceSlot criteria="p" posAngle="35" posRadius="20"/>
<DeviceSlot criteria="wI~p" posAngle="315" posRadius="20"/>
which gets the main weapon correctly positioned, but the linked-fire weapon also ends up at an angle of 35 degrees.

I've also tried this:

Code: Select all

                ; Make the item we've picked linked-fire
                (objSetItemProperty gSource chosenWeapon 'linkedFireOptions 'always)
				
				; Make the linked-fire weapon fire from the other side of the ship.
				; Why doesn't this work??
				; (objSetItemProperty gSource chosenWeapon 'posAngle '315)
which successfully makes chosenWeapon linked-fire but has no effect on what position it fires from on the ship.

Any idea what I might be doing wrong? Thanks if you can help.

User avatar
Arkheias
Commonwealth Pilot
Commonwealth Pilot
Posts: 95
Joined: Mon Jun 02, 2014 8:06 pm

Tue Feb 16, 2016 10:24 am

I believe that there is a limit to how many criteria you can use in the same block.
Try changing "wI~p" to "wI; ~p".

Code: Select all

<DeviceSlot criteria="p" posAngle="35" posRadius="20"/>
<DeviceSlot criteria="wI; ~p" posAngle="315" posRadius="20"/>
I just woke up in the middle of the night, so I'm not really awake enough to respond to the rest of your post.
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: 1099
Joined: Thu Aug 29, 2013 5:18 am
Location: On the other side of the screen.

Tue Feb 16, 2016 10:45 am

 Actually, the problem is that changing the properties of chosenWeapon make it not chosenWeapon anymore. I’ve run into this one before, myself — same problem exactly, in fact, linking fire and changing the weapon’s position. The way I wound up doing it was to set the position first, then use objEnumItems to find the weapon at that position and set it to 'linkedFireOptions 'always.
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!)

gunship256
Militia Commander
Militia Commander
Posts: 451
Joined: Sat Jul 25, 2015 11:41 pm
Location: repairing armor

Tue Feb 16, 2016 12:29 pm

Thanks - very helpful!

Another question, then: Is there a way to point to an object and have the pointer still work if the object's properties change - for example, if it becomes linked-fire or gets ionized? I'd like to somehow save which item I've made linked-fire so I can keep track of it in case I want to reverse the process later. That would be a lot cleaner than wiping linkedFireOptions from every installed weapon every time I want to change things, which is what I'm doing now. What I'm doing now could mess up other mods, including possibly PSD7 when PM finishes it.

It seems weird to be working with objects but have no way to refer to specific objects even if their attributes change.

EDIT: I'm still having trouble setting the position of the linked-fire weapon. I'm sending a message to myself through the code to verify that objEnumItems works properly, so I think the problem is the way I'm using objSetItemProperty. That's almost certainly the problem, because, as you said earlier, if objSetItemProperty were actually working, the new weapon would no longer be theItem, and objSendMessage wouldn't work!

Code: Select all

				; Set all linked-fire weapons to fire from the other side of the ship
				(objEnumItems gSource "wI~l" theItem
					(block Nil
						(if (objGetItemProperty gSource theItem 'linkedFireOptions)
								(objSetItemProperty gSource theItem 'posAngle '315)
								; For debugging purposes
								(objSendMessage gSource gPlayerShip (itmGetName theItem 32))
							)
						)
					)
Is there a better way to do this?

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

Tue Feb 16, 2016 12:56 pm

gunship256 wrote:…wiping linkedFireOptions from every installed weapon every time I want to change things, which is what I'm doing now.
 That’s pretty much the way I handle it, too. It works, but it’s definitely not a pretty way to go about it. -.-
gunship256 wrote:Is there a better way to do this?
 I use (objSetItemProperty obj item 'pos (list angle radius)) to set my weapon positions. See if maybe that works better for you, but otherwise I got nothin’.

EDIT: I think I was wrong earlier. Apparently changing an items properties doesn’t affect the item, changing its data does. My bad.
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!)

gunship256
Militia Commander
Militia Commander
Posts: 451
Joined: Sat Jul 25, 2015 11:41 pm
Location: repairing armor

Wed Feb 17, 2016 12:21 am

Thanks for your help! The code works great now, though I'm not 100% sure how forward compatible it will be with other mods.

Whatever changes I make to the linked-fire status of side-mounted weapons does not affect how they actually function in the game, so I'm guessing that a weapons' linked-fire and fire arc attributes overwrite weapon slots' attributes and that the slots' attributes overwrite whatever changes I make to the [EDIT: ships] using mods. As Arkheias said in a different thread, this seems to be confusing in a way that ultimately has good results.

Here's the code I'm using now if anyone is curious about what actually solved the problem.

EDIT: And here's the alpha:
https://forums.kronosaur.com/viewtopic.php?f=25&t=7561

Code: Select all

				(setq chosenWeapon (scrGetItem gScreen))
				
				; For debugging purposes
				; (objSendMessage gSource gPlayerShip (itmGetName chosenWeapon 32))
				
				; Remove linked-fire attributes from all weapons and make them fire from the left side of the ship
				(objEnumItems gSource "wI~l" theItem
					(block Nil
						(if (objGetItemProperty gSource theItem 'linkedFireOptions)
								(block Nil
									(objSetItemProperty gSource theItem 'linkedFireOptions Nil)
									(objSetItemProperty gSource theItem 'pos (list 44 20))
									)
							)
						)
					)
 
                ; Make the item we've picked linked-fire
                (objSetItemProperty gSource chosenWeapon 'linkedFireOptions 'always)
				
				; Make it fire from the right side of the ship
				(objSetItemProperty gSource chosenWeapon 'pos (list 322 20))
				
				; Show the next dock screen
				(scrShowPane gScreen "Result")

Post Reply