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
		
			
			- 
				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.
 
 $Formula: ( when 
 ( secondary-fired-since
 "Alpha 1"
 3
 60000
 )
 ( change-ship-class
 "GTF Falcon"
 "Alpha 1"
 )
 )
 +Name: Event name
 +Repeat Count: 1
 +Interval: 1
- 
				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... ;)
			
- 
				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:
    ( 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.
- 
				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.
			
- 
				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! :)