Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: SF-Junky on July 17, 2014, 07:01:02 am

Title: Change ship class after secondary fired
Post by: SF-Junky on July 17, 2014, 07:01:02 am
Hello,

what I am trying to is to construct a mission event that changes the player's ship class after the player fired secondary weapon bank 3. I tried to accomplish this by using the secondary-fired-since SEXP and, of course, the change-ship-class SEXP (see code tag below).

But this doesn't work.

My next approach would've been to use the secondary-ammo-pct SEXP I see in FRED. The problem here is that I cannot use it (it's locked grey).
A brute way would be to just use the secondaries-depleted SEXP, but I'd really like to avoid that.

Any ideas? I know there must be some way to do this, because in BP2 they have this computer voice telling you "bank # empty". So it's not that the game code couldn't handle such things.

I'm using the latest nightly build from July 15. But I also tried with 3.7.2 RC3.

Code: [Select]
$Formula: ( when
   ( secondary-fired-since
      "Alpha 1"
      3
      60000
   )
   ( change-ship-class
      "GTF Falcon"
      "Alpha 1"
   )
)
+Name: Event name
+Repeat Count: 1
+Interval: 1
Title: Re: Change ship class after secondary fired
Post by: Axem on July 17, 2014, 07:39:45 am
Using secondary-fired since should work since I did exactly what you're trying to do in JAD 2.21. I think the time to check since firing should be in the range of 10-100ms or so, I believe. Check out the mission in FRED to see how I did it (mission 5b!). Hopefully it won't be too messy to read... ;)
Title: Re: Change ship class after secondary fired
Post by: AdmiralRalwood on July 17, 2014, 10:11:02 am
My next approach would've been to use the secondary-ammo-pct SEXP I see in FRED. The problem here is that I cannot use it (it's locked grey).
You can't use it by itself; you have to use it as an argument to, say, a < SEXP.

SEXPs aren't greyed out because they're unusable, they're greyed out because they make no sense in the current context (in this case, because it returns a number, not a boolean).


As for the reason your secondary-fired-since isn't working:
Code: [Select]
   ( secondary-fired-since
      "Alpha 1"
      3
      60000
   )
It counts from the first bay being 0, so 3 would be the fourth secondary bay, which obviously doesn't exist. Sadly, this is mentioned in the help for the secondary-ammo-pct SEXP but not the help for the secondary-fired-since SEXP.
Title: Re: Change ship class after secondary fired
Post by: Dragon on July 17, 2014, 02:10:41 pm
Well, not so "obviously", but merely probably. :) You can have four secondary banks if you so chose, even for the player. That said, "GTF" implies a fighter, and those rarely come with 4 banks.
Title: Re: Change ship class after secondary fired
Post by: SF-Junky on July 17, 2014, 03:11:11 pm
It counts from the first bay being 0, so 3 would be the fourth secondary bay, which obviously doesn't exist. Sadly, this is mentioned in the help for the secondary-ammo-pct SEXP but not the help for the secondary-fired-since SEXP.
Ah, that was it. It works now. Once again I thank the community for their help! :)