omniswitch weapon update

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

I've re-uploaded my version of the omniswitch turbo laser so that it works in .99c. I didn't change the UNIDs so you should remove the last one if you were using it.

To digdug, if you haven't already done it yourself, this is the version to use in your weapon extended 2 mod.

And for all those aspiring modders (including myself), I used the version of the function that should work with launchers, just in case you want to copy the code.

Credit goes to digdug first, me second and Atarlost for the working function code.

I'm testing now to see if the function names need to be changed to work with digdugs at the same time.
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

Ok, it works with two other switchable weapons at the same time, not ghost weapons, no errors. I also descovered that weapons can be switched to a launcher and back again. I'm uploading this other weapon. It's a really cool god weapon, but, it's still a god weapon. It switches between three weapons, a laser-ish weapon, to a "destroy everything on the screen" gun, to a launcher that shoots fuel rods (which requires credit to whoever it was that came up with that idea first) and back again. Its called the Superlaser, because god weapons should have lame names.

I was also thinking of combining all three switchable weapons into one mod-pack download, but I wanted digdug's permission first to use an updated version of his weapon.
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

I also descovered that weapons can be switched to a launcher and back again.
this is absolutely awesome! :D
never thought about that ! Good job bluesaberist.

About the WE2, the weapon should work as is with my mod.

[EDIT]
I'm testing now to see if the function names need to be changed to work with digdugs at the same time.
yes, please, change the name of the function to something unique (I usually add a prefix like "blu" taken from your name, or add a prefix unique for the mod. Otherwise conflicts can happen)
bluesaberist
Commonwealth Pilot
Commonwealth Pilot
Posts: 97
Joined: Wed Jan 16, 2008 2:13 am
Location: Pennsylvania

I will change function names, but I found that I didn't need to in my initial testing. I was using two weapons at once, and they both had exactly the same function, literally copy-pasted from one to the other. This may have caused one usable to switch both guns, or I might have been just imagining it the first time because I couldn't get it to happen again.

I'm going to try to get to this tonight (I'm on Eastern Time, so its 2:38 PM), but no promises. Crysis draws a lot of attention, and then there are real-world callings.
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
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

I think if you have two copies of a function it selects one unpredictably. If they're identical it doesn't matter, but if one changes you wind up with a serious and difficult to debug problem.
bluesaberist
Commonwealth Pilot
Commonwealth Pilot
Posts: 97
Joined: Wed Jan 16, 2008 2:13 am
Location: Pennsylvania

I put the mods through some more testing. I haven't found any problems yet. I changed the function names just in case. All of mine have BLUx on the end of them. I was running all four switching weapons at once. Both omniswitch turbolasers (digdugs updated with the last version of Atarlost's code), my superlaser god gun and another god gun with switching capability.

I'm updating the all downloads on xelerus. digdug, have you updated your download with the latest version of the code? This is what I'm using in yours:

Code: Select all

<Globals>
   
  (block Nil
		; Define the function for switching weapon.
		
		(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!")
            )
         )
 
      ))
  
	)
 </Globals>
EDIT: digdug came up with a good point in his xelerux comment on the superlaser. I tested, and when you switch it to a launcher, it will uninstall a previously installed launcher.
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