Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: wistler on June 18, 2012, 03:41:59 pm

Title: Changing secondary loadouts
Post by: wistler on June 18, 2012, 03:41:59 pm
Hi,
Is there any way of locking a missile bank on the players ship until a set time when it can be unlocked, used, and then relocked when its empty.

I'm trying out an idea I had about rewarding the player certain missiles during the game, but I can only get it to work by changing the load out of a missile bank already in use. It's a bit more clumsy then the idea I had in mind, which was a missile bank that was offlimits to the player until he achieved a particular goal.

Basically I'm asking there's a lock / unlock secondary banks command in FRED that affects specific banks rather then all missiles.
Title: Re: Changing secondary loadouts
Post by: headdie on June 18, 2012, 03:46:57 pm
probably not, might make a nice request.  In the mean time secondary ammo looks to be your best bet.
Title: Re: Changing secondary loadouts
Post by: Legate Damar on June 18, 2012, 04:01:39 pm
You could make two versions of a ship, one with the extra bank and one without, and then switch the ship in mid-mission
Title: Re: Changing secondary loadouts
Post by: Aginor on June 19, 2012, 05:15:06 am
That could work. But you would have to have a lot of ships in your table if you start combining.
Title: Re: Changing secondary loadouts
Post by: mjn.mixael on June 19, 2012, 08:48:02 am
When
   is-secondary-selected
    Playership
    Bank to lock (#)
  lock-secondary-weapon

with a high trigger count.

To unlock do the same event but with the other bank and use unlock-secondary-weapon... or just use an if-then-else argument to do it all in one event.

You can put further checks in place to find out which bank has the weapon to lock if you need to.
Title: Re: Changing secondary loadouts
Post by: bigchunk1 on June 19, 2012, 11:53:09 pm
Have you tried  the set-secondary-ammo sexp under subsystems and cargo? You could set the player's ammunition to 0 when you don't want them using the weapon and give him/her back the weapon's ammuition (saved as a variable using get-secondary-ammo) when you want to.
Title: Re: Changing secondary loadouts
Post by: wistler on June 24, 2012, 01:44:08 pm
I'll give that a try next chance I get, thanks.
Title: Re: Changing secondary loadouts
Post by: karajorma on June 24, 2012, 08:47:02 pm
Personally, I'd create a weapon called "Locked" and make that the weapon the player has when you don't want them using their missiles.

I think that's a much more elegant solution than simply changing the number of missiles available.  Although there may be some flaw in that plan I've failed to consider.
Title: Re: Changing secondary loadouts
Post by: wistler on June 25, 2012, 07:18:45 pm
As a work around, is there a way to check what missile is in a bay before i change it, and then have the bay change back to that original missile.

Seems a bit more practical then making the player loose an entire bay for a mission, and it would also allow the player to pick their load-out.
Title: Re: Changing secondary loadouts
Post by: karajorma on June 26, 2012, 01:13:40 am
When-argument
-any-of
--list of missiles allowed in the mission
-has-secondary-weapon
--ship-name
--Weapon Bank
--<argument>
-modify-variable
--Locked-Missile[None]
--<argument>

Should do it. You can later use that string variable to add the missile back.
Title: Re: Changing secondary loadouts
Post by: wistler on July 01, 2012, 06:38:11 pm
That's worked great, thanks Kara.  :yes: