Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: Solatar on December 26, 2010, 09:47:50 pm

Title: Way to check if a player has a weapon?
Post by: Solatar on December 26, 2010, 09:47:50 pm
I see it's straightforward to check if a player has bank 1 or 2 selected.  However, in a single mission I'm trying to make, there will be several ways to accomplish the objectives.  If the player has armed himself with TAG missiles, I'd like to have a training message show up to tell him what ships will respond.  If he doesn't have any armed, then I don't want the training message to appear.  Is there any way to do this? 
Title: Re: Way to check if a player has a weapon?
Post by: FUBAR-BDHR on December 26, 2010, 10:09:43 pm
Like has-primary-weapon or has-secondary-weapon?
Title: Re: Way to check if a player has a weapon?
Post by: Solatar on December 26, 2010, 10:23:17 pm
Yes.  To my knowledge neither exists, right?  :nervous:
Title: Re: Way to check if a player has a weapon?
Post by: FUBAR-BDHR on December 26, 2010, 11:35:11 pm
Then your knowledge be lacking.  :P

(http://fubar5.fubar.org/fubar/FS2/has-weapon.jpg)
Title: Re: Way to check if a player has a weapon?
Post by: ssmit132 on December 26, 2010, 11:51:28 pm
Yep, that's the sexp to use. I've used it for something very similar to what Solatar wants to do (I was replicating the Mjonlir system that was in Vassago's Dirge, but only wanted the Mjonlirs to respond to tagged ships if the player had TAG-A or TAG-B missiles).
Title: Re: Way to check if a player has a weapon?
Post by: Solatar on December 26, 2010, 11:55:27 pm
I've been using a FRED executable from August.  Whoops.  :nervous:
Title: Re: Way to check if a player has a weapon?
Post by: karajorma on December 27, 2010, 02:33:53 am
Which year? I coded that SEXP in over a year ago IIRC. :p
Title: Re: Way to check if a player has a weapon?
Post by: General Battuta on December 27, 2010, 08:12:59 am
wait really? i remember spoon and i begging for it like a month ago.
Title: Re: Way to check if a player has a weapon?
Post by: karajorma on December 27, 2010, 09:09:45 am
Maybe I'm confusing it with one I coded then. Probably the ammo rather than weapon one.
Title: Re: Way to check if a player has a weapon?
Post by: Solatar on December 30, 2010, 08:45:21 pm
Doesn't show up in a FRED build from August of this year, but it's plain-as-day-I'm-a-dumbass in a recent build.  Seems to suggest it's kind of recent. And that I'm an idiot for not noticing. :P

EDIT: btw, works perfectly.  It even fires if I have another weapon mounted and use debug codes to switch to the one referenced in the SEXP.  At that point the message fires.  :yes:
Title: Re: Way to check if a player has a weapon?
Post by: General Battuta on December 30, 2010, 09:59:26 pm
yes it is recent, kara only coded it up a little while back for mr. spoon