Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: SadisticSid on April 07, 2006, 12:53:23 pm

Title: Weapon modes
Post by: SadisticSid on April 07, 2006, 12:53:23 pm
Thought of a new feature and a possible implementation last night.

Let's say you have three weapons representing the Subach SD-7 firing in different modes - normal mode, shotgun mode, and high field of fire mode. The Subach normal's weapon entry has an extra field, $NextMode, which would reference the weapon to change to when a key/SEXP is triggered. So normal would refer to shotgun mode, shotgun mode to high FOF mode, and high FOF back to normal mode. To ensure that no abuse of this feature occurs (e.g. avoiding the longer reload time for shotgun mode by switching the weapon twice), you have to wait for the value set in $Fire wait until you can fire the new weapon. You could also apply this to missiles - perhaps a swarm mode for Harpoons, or a mode that sacrifices damage for speed and agility.

Should it allow weapon modes with different ammo sizes or ballistic/energy weapons to be switched between? I'd say perhaps to the former and no to the latter. Different ammo sizes are easy to handle if the game calculates the remaining ammo integer in a primary bank on-the-fly, rather than once at the mission start (dividing primary capacity by weapon's cargo size). I don't think switching from energy to ballistic weapons would be realistic though; why would you load extra ammunition on a fighter that uses energy weapons? I'd leave this up to a modder's discretion, however.

As far as I can see, the code for doing this is halfway done - the cheat code that allows you to change your weapons.
Title: Re: Weapon modes
Post by: karajorma on April 07, 2006, 01:21:01 pm
Ummm. The code is all done. You can swap weapons by SEXP at will using the change-primary-weapon SEXP I added about a week back. :)

You'd just need to make 3 versions of the Subach.
Title: Re: Weapon modes
Post by: SadisticSid on April 07, 2006, 01:30:59 pm
But that wouldn't allow a player to change his weapon modes based on his chosen loadout, would it? Even if there is some way to find a particular ship's equipped weaponry, so you could choose appropriate weapons to switch to, you'd use large numbers of sexp nodes.
Title: Re: Weapon modes
Post by: karajorma on April 07, 2006, 03:31:37 pm
Ah. You want to do this to every weapon not just one or two. Fair enough.
Title: Re: Weapon modes
Post by: phreak on April 07, 2006, 04:19:12 pm
would something like ctrl+next weapon and ctrl+prev weapon be the default binding for this

then in the table would be something like

Code: [Select]
$Name: Subach Normal
$Prev Alt Fire Mode: Subach FOF
$Next Alt Fire Mode: Subach Shotgun

$Name: Subach Shotgun
$Prev Alt Fire Mode: Subach Normal
$Next Alt Fire Mode: Subach FOF

$Name: Subach FOF
$Prev Alt Fire Mode: Subach Shotgun
$Next Alt Fire Mode: Subach Normal
Title: Re: Weapon modes
Post by: SadisticSid on April 07, 2006, 06:03:15 pm
Yeah, that'd be awesome. :)
Title: Re: Weapon modes
Post by: Nuclear1 on April 07, 2006, 08:26:52 pm
Oh, awesome idea indeed. Sure would mix things up a bit. :)
Title: Re: Weapon modes
Post by: Galemp on April 08, 2006, 03:02:02 pm
While we're at it. I was discussing with the Star Wars team the possibility of locking a turret to a fixed-forward position for either firepower or defense as necessary. A system like this is the perfect framework to implement it in, where instead of an alt-fire mode it unlocks the turret and locks the weapon bank.

The issues to be resolved are that of the turret geometry reorienting itself to face forward, energy use to ensure the turret drew from the primary weapon energy banks, and whether the AI would use it properly.
Title: Re: Weapon modes
Post by: SadisticSid on April 09, 2006, 05:22:36 am
That sounds like an interesting idea, although I dare say it's more a ship issue than a weapon one. The effect of this would just be to substitute one weapon for another, not configuring firepoints. Could you do something similar by having a primary bank for the fixed lasers, and a primary bank with the firepoints for the turrets when facing forward, then enable/disable the turrets as well?
Title: Re: Weapon modes
Post by: Galemp on April 09, 2006, 09:31:35 am
Not really, as this would require compatibility for 3 primary weapon banks and you would be able to use both the guns and the turret at the same time. What's needed is a primary weapon entry that specifies no projectiles, assigns itself to the turret01 bank on the parent model, and unlocks that turret.