Getting back into it

Freeform discussion about anything related to modding Transcendence.
Post Reply
bluesaberist
Commonwealth Pilot
Commonwealth Pilot
Posts: 97
Joined: Wed Jan 16, 2008 2:13 am
Location: Pennsylvania

So I forgot the game for a few months. Crysis will do that to you. But now I'm getting back into the swing of things. I go back to the Transcendence site expecting maybe to see .99. Instead I get a minor surprise in that .99c is out!

Boy, the things that can happen when your away.



Anyhow, I decided to update my Phaser mod, and I've got it doing what I want. It's a lot more powerful god weapon now. It also looks more like a phaser. However, there is some more testing that I have to do with it, because I am using the omni-switch code that digdug came upwith to make it switch from a nasty multi-target super weapon, to a forward firing beam that is (almost) safe to use around friendlys without destroying them because you targeted them to dock or that pirate is sitting behind them.

Anyhow, I tried to use another weapon that had switching abilities at the same time, and it messed up my save a little, giving me like five of each weapon that I can't uninstall.

All of this to say, I can't remember how to place weapons from an extension in the default weapons of a playership that is in another extension (If I remember correctly, you can't start with extension weapons in one of the base playerships, right?) It works fine if the ship is in the same extension as the weapon, but I don't really feel like compiling all my weapons and a ship together in one file, and I find myself thinking that I didn't have to before.

Could somebody help?

And this is for digdug specificaly, do you have to make any changes to the weapon switch function to use it with more than one weapon? Would I just change the name of the function and include it at the end of each weapon that I want to have it?
If you drop a bar of soap on the ground, is it dirty?
If a person is legally blind, and can suddenly see, is he breaking the law?
If a friend says he's going outside to get some air, what was he breathing before?
-Brad Stein
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

I think the only condition is that the separate extension containing the ship has to be loaded after the weapon. My guess is if the extension UNID of the ship extension is greater than the UNID of the weapon extension then it will work. If that doesn't work than try arranging them alphabetically so that the weapons one is first.

If I am right, you a perfectly able to redefine one of the base playerships with a custom weapon, I know that when using one extension I can put whatever devices I like in a redefinition of a playership.
Bobby
Militia Captain
Militia Captain
Posts: 675
Joined: Wed Jul 25, 2007 7:39 pm

to place an item from another extension onto a ship, the extension with the ship must have the entity unid of the device being added.
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

the switching function has been updated a few times on xelerus to fix bugs like the multiple "ghost" weapons that cannot be uninstalled.

Please check that you are working with the most recent one.
bluesaberist
Commonwealth Pilot
Commonwealth Pilot
Posts: 97
Joined: Wed Jan 16, 2008 2:13 am
Location: Pennsylvania

Is it possible that the switching function doesn't work in .99c? Because I just tried it with the latest code and it didn't work.
If you drop a bar of soap on the ground, is it dirty?
If a person is legally blind, and can suddenly see, is he breaking the law?
If a friend says he's going outside to get some air, what was he breathing before?
-Brad Stein
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

mmmhh, I think that it works with 0.99, take a look at the locked angle turret weapon I did, it switches between 20 different weapons with an appropriate angle, and it was working with 0.99a.

If you still have problems, try to post the code here or on IRC, I will be glad to help you (as many others) :D
bluesaberist
Commonwealth Pilot
Commonwealth Pilot
Posts: 97
Joined: Wed Jan 16, 2008 2:13 am
Location: Pennsylvania

Your locked angle weapon didn't work. It gave me ghost weapons. Maybe it has to do with the difference between .99a and .99c? Could you test your code in .99c and see if it works?
If you drop a bar of soap on the ground, is it dirty?
If a person is legally blind, and can suddenly see, is he breaking the law?
If a friend says he's going outside to get some air, what was he breathing before?
-Brad Stein
bluesaberist
Commonwealth Pilot
Commonwealth Pilot
Posts: 97
Joined: Wed Jan 16, 2008 2:13 am
Location: Pennsylvania

Another question, will the weapon switch code work with launchers?
If you drop a bar of soap on the ground, is it dirty?
If a person is legally blind, and can suddenly see, is he breaking the law?
If a friend says he's going outside to get some air, what was he breathing before?
-Brad Stein
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

true, it doesn't work, it makes ghost weapons. It should also "not work" with launchers. :lol:
I wonder why... :roll:

THe error i get is:

Code: Select all

Unable to find the item in list ### (objRemoveItem gSource theitem)
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

Perhaps it is a problem with trying to remove an installed item? Perhaps you need to uninstall it first.
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

The problem is that items created in different ways have different properties. I'm not sure if it's the items the ship starts with or the items created in scripts that are abnormal, but they don't match up and the item the ship starts with can't be found by the script for deletion.

I've got a workaround, but I can't get it to work for launchers.

Enhance the object and it works fine.

Code: Select all

(setq intswitchweapon (lambda (theweapon)
			(block (nil)			
(dbgOutput "break")
				(if (eq (itmIsDamaged theitem) Nil)
					(block (status enhweapon theitem)
						(setq theitem gItem)
						(setq status (ItmIsEnhanced theitem))
						(setq enhweapon (itmSetEnhanced theweapon status))
						(objAddItem gSource enhweapon)
						(shpInstallDevice gPlayerShip enhweapon)

						; kludge for new item wierdness
						(shpEnhanceItem gSource theitem status)
						

						; Remove previous weapon
						(shpRemoveDevice gSource (itmSetEnhanced theitem status))
						(objRemoveItem gSource (itmSetEnhanced (itmCreate (itmGetUNID theitem) 1) status) 1)
					)
					(objSendMessage gSource Nil "Device non-functional: Error!")
				)
			)
  
		))
But I can't get it to work for launchers yet.
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

Got it. That doesn't mean there's not something wrong, though. There's fishy stuff going on with objectStructs generated in script not matching objectStructs generated on ships, and there's something else fishy with launchers not matching objectStructs at all and needing to be referenced by itemListCursors.

Code: Select all

(setq intswitchweapon (lambda (theweapon)
			(block (nil)			
				(if (eq (itmIsDamaged theitem) Nil)
					(block (status enhweapon theitem)
						(setq theitem gItem)
						(setq status (ItmIsEnhanced theitem))
						(setq enhweapon (itmSetEnhanced theweapon status))
						(objAddItem gSource enhweapon)

						; even worse kludge to handle launchers
						(if(itmMatches theitem "l")
							(block (nil)
								(objEnumItems gSource "Il" variable 
									(block (nil)
										(shpEnhanceItem gSource theitem status)
									))
						))

						(shpInstallDevice gPlayerShip enhweapon)

						; kludge for new item wierdness
						(shpEnhanceItem gSource theitem status)

						; Remove previous weapon
						(shpRemoveDevice gSource (itmSetEnhanced theitem status))
						(objRemoveItem gSource (itmSetEnhanced (itmCreate (itmGetUNID theitem) 1) status) 1)
					)
					(objSendMessage gSource Nil "Device non-functional: Error!")
				)
			)
  
		))
Enhancing an item allows it to be matched by the itemStruct created by itmCreate and deleted properly. For launchers I'm grabbing them in an enumeration before they're replaced, relying on the fact that there's only ever one launcher installed, and using the enum to throw an enhancement at it.
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

I see... so you are using shpEnhanceItem AND ItmSetEnhanced.

NOTE: To all gamers, please note that there are now various mods that uses the function intSwitchWeapon and they conflict with each other!

Second note: my function gives an error at the first use (unable to find item in list etc...), however it's not generating a ghost weapon. THen at the second use it works well.

However Atarlost fixed it! Thanks Atarlost! :D I'm not sure why it works, but it works! (I'm still unsure why i get the error the first time i use mine)
bluesaberist
Commonwealth Pilot
Commonwealth Pilot
Posts: 97
Joined: Wed Jan 16, 2008 2:13 am
Location: Pennsylvania

Thanks Atarlost for your solution. Now my god-ish weapon will work without annoying me to death!
If you drop a bar of soap on the ground, is it dirty?
If a person is legally blind, and can suddenly see, is he breaking the law?
If a friend says he's going outside to get some air, what was he breathing before?
-Brad Stein
Post Reply