[SCRIPT] Weapons Changer v2.50 [Updated 15/07/07]

The place to discuss scripting and game modifications for X³: Reunion.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

Bunny
Posts: 2014
Joined: Mon, 1. Dec 03, 19:44
x3ap

[SCRIPT] Weapons Changer v2.50 [Updated 15/07/07]

Post by Bunny » Sat, 30. Sep 06, 17:55

Weapons Changer v2.50

What it does:
It allows the ship to store and switch between up to 3 user defined weapons configurations for all turrets. The ship can also automatically switch to and from a 4th configuration that is only used out of sector (a useful feature for patrol craft).

Thanks to Gazz for the auto swap script.

Download Cycrow spk and zip bundle
Hosted by Xai Corporation - Download

Features:
- Hotkeys for weapons configuration swapping on the playership (direct selection or cycling)
- Broadcast feature enables all ships in sector to match the player ships weapons configuration by use of a single hotkey
- Audio confirmation of selected configuration for playership
- Works on all ships both in and out of sector
- Weapons are swapped to the 4th configuration when the ship is OOS. It reverts to the old setting when back in sector.
- Player log messages indicate software status
- Ship name is updated to show selected weapons configurations (not
on playership)
- Clone feature enables the weapon changer settings on one to be transferred to all other identical ships in the sector. So buy 10 ships, set up one and then transfer the information to the others.

This script has 5 hotkeys:
Cycle Config - This will cycle through the three weapon configuration A, B & C on the playership. If these have not been programmed then it will do this instead. If the player manually alters the loaded weapons and presses this key then the script will detect this and reprogram the selected configuration to match. All this is much easier to understand after using this function :)

Broadcast Config - This commands all ships in sector to switch to the same weapons configuration as the player. This means that if the player has A selected then the other ships will also switch to A. The weapons that are loaded depend on how each ship was programmed.

Select Config A - Select Weapons loadout A for player ship
Select Config B - Select Weapons loadout B for player ship
Select Config C - Select Weapons loadout C for player ship

How to set the player ship weapons configurations
Hotkey method
1. Place the weapons in the turrets which you want the ship to use OOS
2. Start Weapons changer by pressing the cycle hot key.
3. Press the cycle hot key, the ship will say "A", swap in the weapons you want for config A and press the cycle key again.
4. Press the cycle hot key, the ship will say "B", swap in the weapons you want for config B and press the cycle key again.
5. Press the cycle hot key, the ship will say "C", swap in the weapons you want for config C and press the cycle key again.
6. Done

Advanced method
1. Run Weapons changer input script, enter 7 to start the script on the ship.
2. Put the weapons you want for configuration A into the turrets
3. Run Weapons changer input script, enter 4 to program configuration A
4. Put the weapons you want for configuration B into the turrets
5. Run Weapons changer input script, enter 5 to program configuration B
6. Put the weapons you want for configuration C into the turrets
7. Run Weapons changer input script, enter 6 to program configuration C
8. Run Weapons changer input script, enter 8 to program configuration D. This configuration is used OOS

Th advanced method can be used to program ships you are not in (either IS or OOS).

How do I get the ship to swap weapons in and out of sector?
The ship will do this automatically. It will select setting D on going OOS and then revert to the old setting when IS.

How do I select a weapons configuration on a ship I am not in?
Run the weapons changer input script with 1 for A, 2 for B or 3 for C.

What happens when I enter or leave a ship running weapons changer?
When the player enters the ship it will remember the weapons configuration it was using. It will revert to this when the player leaves the ship. While the player is in the ship the selected configration will not be shown in the ship's name.

How do I command all other ships to swap weapons?
Use the broadcast settings hotkey. All other ships in sector will switch to same configuration the playership is using.

How do setup weapons changer on multiple ships?
If the ships are identical then the clone feature can be used. Program the weapons changer on one of the ships and then run input mode 12 to broadcast this information to all other identical ships in the sector.

Can I get weapons to swap based on my target?
Yes - run Gazz's autochanger script (hww.bunny.autoswitch)
See Gazz post for details
http://forum.egosoft.com/viewtopic.php? ... c&start=75

How to switch off weapons changer?
Select "Weapons Changer" mode 0 will just stop it, configurations will not be forgotten. Use mode 10 if you want to clear these configurations as well.

I've uninstalled the script, how do I get rid of the hotkeys?
Run hww.bunny.removekey.

List of input modes for weapons changer script
0 = Terminate weapons changer (P)
1 = Select weapons configuration A
2 = Select weapons configuration B
3 = Select weapons configuration C
4 = Program weapons configuration A (P)
5 = Program weapons configuration B (P)
6 = Program weapons configuration C (P)
7 = Normal operation - Start weapons changer (P)
8 = Program weapons configuration D (OOS configuration) (P)
9 = Select next weapons configuration (hotkey triggered)
10 = Terminate weapons changer and delete weapon configurations(P)
11 = Select weapons configuration D (test mode not intended to general use)
12 = Clone settings

(P) = Mode sends a confirmation message to the Player log.

Required Equipment
Fight command software mk2

Known issues
The laser bank display on the left of the screen does not update with hotkey swapping (although the ammo counters do).
This is a game bug. A work around is to either open a menu or change the view to refresh the display.

Version History
2.50 - Clone settings function added
- Improved weapon setting programming via hotkey
- Repeated weapon configuration tag in ship name bug removed
- Now possible to change ship name with no problem when the script is running
- Gazz's autochanger script now included

2.01 - Bug fix of incorrect loadout with small number of weapons
2.00 - Weapon configurations now stored in local memory (they are not forgotten if the script is restarted)
- The cycle hot key can be used to select/program/reprogram weapon configurations
- IS/OOS weapon swapping is automatically done provided weapon configuration D has been programmed
- Name of ship shows the selected weapons configuration (not on playership)
- If the player enters the ship then it will remember its current weapons configuration. This will be restored when the player leaves the ship.
- Hotkeys added to allow direct selected of weapon configurations A, B & C.
- Hotkey added to broadcast player ship weapon configuration to all other ships in the sector that are also running weapons changer.
- Restart code added for future upgrades
- Minor change in audio
1.45 Orignal release

Uses text file 8956
Command slot fight 55

[EDIT] 18-1-07
Orka on the German forum developed a similar script over a year ago http://forum3.egosoft.com/viewtopic.php ... 86&start=0
Last edited by Bunny on Sun, 15. Jul 07, 23:58, edited 30 times in total.

Jimby
Posts: 232
Joined: Wed, 22. Feb 06, 15:43
x3

Post by Jimby » Sun, 1. Oct 06, 23:36

Will you have a cycrows script install version?

User avatar
vampirecosmonaut
Posts: 329
Joined: Thu, 17. Aug 06, 21:23
x4

Post by vampirecosmonaut » Mon, 2. Oct 06, 02:35

Jimby wrote:Will you have a cycrows script install version?
It's in the zip file. :lol:
The first documented attempt in human history to use a rocket for spaceflight
was made in the 16th century by a Chinese Ming dynasty official named Wan Hu.
The resultant explosion presumably killed him.

Jimby
Posts: 232
Joined: Wed, 22. Feb 06, 15:43
x3

Post by Jimby » Mon, 2. Oct 06, 20:55

:lol: Thanks. Guess I should learn to read more carefully in the future.

Bunny
Posts: 2014
Joined: Mon, 1. Dec 03, 19:44
x3ap

Post by Bunny » Wed, 4. Oct 06, 14:37

Looks fine, so this gets upgraded to release version.

Nightmariner
Posts: 95
Joined: Tue, 24. Feb 04, 06:38
x3

Post by Nightmariner » Fri, 10. Nov 06, 05:09

Bunny,

Your script looks great so far. I have used it for one configuration and it seems to solve the whole weapons switching dilemma simply and elegantly. Keep up the great work! :thumb_up:
It's not that I don't trust you. I just don't trust you.

User avatar
ezra-r
Posts: 3420
Joined: Fri, 14. Oct 05, 21:04
x4

Post by ezra-r » Fri, 10. Nov 06, 13:21

yet another quality script by Bunny.

Installing!

Puruco
Posts: 527
Joined: Tue, 6. Dec 05, 00:09
x3

Post by Puruco » Fri, 10. Nov 06, 16:09

Hi: It said for turrets only. Can you make it that includ the front main weapons? Thanks...

Bunny
Posts: 2014
Joined: Mon, 1. Dec 03, 19:44
x3ap

Post by Bunny » Fri, 10. Nov 06, 16:19

Front weapons are swapped as well so it works all ships.

The script was created to allow quick swapping between loadouts for capping or killing with extreme prejudice.

Thanks for the feedback guys :thumb_up: .

xalien
Posts: 2252
Joined: Fri, 12. Mar 04, 01:03
x4

Post by xalien » Sat, 11. Nov 06, 17:51

An idea - while it changes loadout nicely you still have to re-assign turret commands manually. Could they be associated with each config as well?

Bunny
Posts: 2014
Joined: Mon, 1. Dec 03, 19:44
x3ap

Post by Bunny » Mon, 13. Nov 06, 11:34

It could be done (eventually...time is pushed at the moment).

You could also try RS turret commands script which does a good job 8) .

Streaks
Posts: 174
Joined: Wed, 16. Aug 06, 09:08
x3

Post by Streaks » Mon, 11. Dec 06, 06:20

The the function of this script should have been part of the vanilla game.
EGOSOFT pls take note.

Anyways, I tried using this script according to the instructions in the readme....I must be doing something wrong.

I stop dead in space to try the Weapons Changer. I choose a hotkey for the Weapons Changer. After that I find the Weapons Changer in the Combat menu of the player's ship, that is where the weapons changer is. I select that command and it tells me to input a number. I type in 7. Then the ship's voice tells me "autopilot on" but its not on; I'm dead in space trying to get the weapons changer to work.

Uhm....er....someone please give me a clue. :cry: This is embarrasing.

--------------------
Various ships passing me by: "Oooh lookie at the big mean guy in that captured Xenon LX, trying to get his Weapons Changer to work! Hahahaha! Hehehe!"

fud
Posts: 9837
Joined: Wed, 25. Jan 06, 14:26
x3

Post by fud » Mon, 11. Dec 06, 14:24

"Auto pilot on" doesn't actually mean what it says. You'll get that announcement on several (if not all) custom ship (new) commands, it's normal.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22197
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Mon, 11. Dec 06, 21:55

its jsut something thats hardcoded into the game. When you activate any ship command, no matter waht it does, it will always say the autopilot is activated. tHe only exception is when you are using the Ships Additional Commands, which work abit differently

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Thu, 1. Feb 07, 20:28

Ah, it's this time of the year again. I be wishlisting! =)

The script works exactly as advertised but it could be a more... elegant weapon. (not as clumsy or random as a blaster)

1. 4 savable configs, please, with the 4th being OOS only and not accessible via the quickchange hotkey from the cockpit.
With 3 player usable ones I could have Anti-Fighter, Anti-Cap-Ship, and Anti-Fighter/missile-with-AE.

2. Drop all Save Config options. (Yes, I'm serious =)
The script knows which config number is current so when another config is requested (whether manually or auto) it always saves the current one first before loading the new one in.
So whenever the player alters a config, the script remembers the weapon changes without the player manually having to "save" it.

2.1 Since hotkey switching to empty configs is currently not done (and would be silly) there needs to be another way to start a new config without a Save feature.
Selecting 1-4 from the regular Script command would do that and allow selecting of an empty slot without loading "empty".
Since saving is always done when exiting that config, the current loadout can already be considered the content of the new slot.

3. IS/OOS Auto Switching (IOAS =) should not be disabled by so many things but rather paused.
I can see no need to permanently turn off IOAS without direct player order.
Once the ship went IS and Config1 is loaded, IOAS is already dormant and not doing anything. Whether the player enters the ship or other Configs are loaded is inconsequential until the ship goes OOS again.

3.1 When the ship goes IS it loads Config 1. Always. Having a working fighter defense is très chique.

3.2 When the player selects a config for this ship, the order is executed and a 10 min timer started.
Only after the timer has expired IOAS can resume normal operations.
This is for altering Config1 on an OOS ship without the script frantically trying to put GPPC into all turrets. =)
Absolutely worst case: for a few minutes the ship is cruising around (maybe fighting) OOS with somewhat reduced IS weapon power. *shrug*

4. Eye candy.
The script could add [x] (x being the number) to the end of the ship name to designate which turret config is running.
Arguably useful in IS battles where you run cap ships with different roles. But when you have enough cap ships to get confused you can prolly just overrun the enemy.
The main benefit I see is that I can tell if I forgot to turn on IOAS for the new patrol M6. Oops.
Easy to do but might be a useless feature. I dunno.


All in all the script would require less typing to use and maintain. v1.45 works but I find myself re-activating the IOAS a lot and having to do things *for* a script is an odd concept. =)
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

Bunny
Posts: 2014
Joined: Mon, 1. Dec 03, 19:44
x3ap

Post by Bunny » Thu, 1. Feb 07, 20:52

Thanks for the suggestions, I'll look into it :thumb_up: .

Snus
Posts: 209
Joined: Wed, 27. Sep 06, 22:52
x3tc

Post by Snus » Wed, 14. Feb 07, 20:59

Thank you Bunny for a very smart script :)

It should be in the script library, as its very useful and v. 2.002 compatible (atleast it works fine for me)

Keep up the good work :wink:

russbo
Posts: 862
Joined: Sat, 12. Nov 05, 21:53
x4

Post by russbo » Thu, 15. Feb 07, 09:08

Yes, it is a superb script. Shame it can't be more "user friendly", but that's probably my own problem. Just can't seem to remember the different numbers and what they do, LOL. I use it all the time, and find it indispensable.

Snus
Posts: 209
Joined: Wed, 27. Sep 06, 22:52
x3tc

Post by Snus » Thu, 15. Feb 07, 11:16

russbo wrote:Yes, it is a superb script. Shame it can't be more "user friendly", but that's probably my own problem. Just can't seem to remember the different numbers and what they do, LOL. I use it all the time, and find it indispensable.
Hehe yea that can be a problem :lol:

I placed the heaviest weaponry on "1" and the lesser on "2"
That way i use to remember which is which :roll:

On my python 1 is for capital ships and 2 for fighters :)
Havent used the third loadout option yet...

8)

Xenon_Slayer
EGOSOFT
EGOSOFT
Posts: 13087
Joined: Sat, 9. Nov 02, 11:45
x4

Re: [SCRIPT] Weapons Changer v1.45

Post by Xenon_Slayer » Thu, 15. Feb 07, 11:47

Bunny wrote:Technical Note:
There appears to be a slight bug with script editor command <RefObj>switch laser in turret <Var/Number> gun <Var/Number> to <Var/Ware>. A null ware does not clear the weapons slot (that was fun to work around :P)
I hope this helps you and other people. If you set the ware as string variable it should clear the turret. e.g

Code: Select all

$TestVar = 'Test'
<[PLAYERSHIP]>switch laser in turret <1> gun <1> to <$TestVar>. 
I tried loads of things. Setting variables as constants, numbers, scripts, ship classes e.t.c. This was the last thing possible and thank god it worked. Very odd bug that one.
Come watch me on Twitch where I occasionally play several of the X games

Post Reply

Return to “X³: Reunion - Scripts and Modding”