Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: karajorma on February 19, 2006, 12:02:34 pm

Title: Oi! Command! SHUT IT!!!
Post by: karajorma on February 19, 2006, 12:02:34 pm
Well people (including me) have been asking for this one for ages so I figured it was worth trying.

If you have a mission like Lions Den how can you shut command up while still being able get pilot chatter? Until now you couldn't. The only way to shut up command was to shut down all built in messages. Well now you can. The feature isn't available in FRED yet cause I don't have a clue how to use MFC yet but simply open a mission in notepad look for the value following the +Flags: line and add 262144 to whatever it says there (remember to turn off disable built-in messages or it will do nothing).

You can play it with the build I've added to this (http://www.hard-light.net/forums/index.php/topic,38428.0.html) topic on recent builds for now but it will be in CVS as soon as I have access. I've included a copy of Into the Lions Den using this feature. The pilots should now warn you about enemy ships jumping in but you shouldn't ever hear a peep out of command.
Title: Re: Oi! Command! SHUT IT!!!
Post by: Shade on February 19, 2006, 01:40:18 pm
Hot damn. This is really nice  :yes:
Title: Re: Oi! Command! SHUT IT!!!
Post by: Solatar on February 19, 2006, 05:26:16 pm
Sweet.

Along a (somewhat) similar line of thought, is it possible to set Command to be a ship? Say I was in the area with a destroyer and I wanted "Command" to be aboard the ship or something. I'd want all the automatic transmissions to come from that ship. Is it possible with current stuff/a little hackage.
Title: Re: Oi! Command! SHUT IT!!!
Post by: karajorma on February 19, 2006, 05:46:05 pm
It might be possible but it would probably be simpler just to use the normal messaging system and the send the standard command messages that way.

What I'm probably going to look into next is making it so that you can tell individual ships to shut up. It's very easy to have a flag which shuts up all pilots but I'd rather have it so that pilots can be told to maintain radio silence via a SEXP. As you may notice if you play the mission I included you'll occasionally get a warning from Snipes ship with a different voice from Snipes. It would be much better if you could shut him up and just have Alpha 3 and 4 warn you about new wings.
Title: Re: Oi! Command! SHUT IT!!!
Post by: bfobar on February 19, 2006, 06:09:26 pm
Yeah, when you're playing as a vasudan in a FS1 port user campaign, it's really odd to have the FS2 command guy jump in and scream, "Incoming Jump Signature! Hostile configuration!"

Especially when it's a wing launching out of a destroyer's fighter bay. They're not jumping, you're not vasudan, and you haven't even made it out of grade school, Command Guy. What sort of back-to-the-future timewarp crap did the GTVA invent? Quit poking random buttons on that ETAK panel! You don't know what you're doing to the continuum!
Title: Re: Oi! Command! SHUT IT!!!
Post by: WMCoolmon on February 19, 2006, 10:01:54 pm
What I'm probably going to look into next is making it so that you can tell individual ships to shut up. It's very easy to have a flag which shuts up all pilots but I'd rather have it so that pilots can be told to maintain radio silence via a SEXP. As you may notice if you play the mission I included you'll occasionally get a warning from Snipes ship with a different voice from Snipes. It would be much better if you could shut him up and just have Alpha 3 and 4 warn you about new wings.

If you go that route it might be better to remove the flag, rather than have three different ways of incrementally doing the same thing.
Title: Re: Oi! Command! SHUT IT!!!
Post by: karajorma on February 20, 2006, 01:56:01 am
I don't know how easy it would be to do that actually. I can't remove the flag for turning both off since that's used a lot. I was thinking about adding the ability to turn off the radio for ship by creating a new ship property. Since command isn't a ship I've got no idea where I'd put that for them though.

That said doing Command as something other than a mission flag would mean that I could make it SEXP dependent whether they can talk or not too.
Title: Re: Oi! Command! SHUT IT!!!
Post by: WMCoolmon on February 20, 2006, 02:49:02 am
I think you can filter messages based on who sent them. If not then ignore my suggestion.

I just mean that it seems a little silly to have a mission flag to just turn off Command if you can do it another way...since if you can get at the data to figure out who's sending the message, you can probably change who the message shows as it's being sent by. Change "Command" to "Terran Command", or "Alpha 4" to "Mary", for instance.

But that's really thinking ahead. ;)
Title: Re: Oi! Command! SHUT IT!!!
Post by: karajorma on February 20, 2006, 04:02:46 am
Yeah you can filter them. I'm just wondering where would be the correct place to store the information that Command should keep quiet. I couldn't find a struct corresponding to ship for command to store it in.

Any ideas?
Title: Re: Oi! Command! SHUT IT!!!
Post by: WMCoolmon on February 20, 2006, 10:40:49 am
Just store it by name

Code: [Select]
struct my_struct{
char original_sender[NAME_LENGTH];
char replacement_sender[NAME_LENGTH];
}

Then check if(strlen(replacement_sender)) to see whether the message should be sent at all. :)
Title: Re: Oi! Command! SHUT IT!!!
Post by: Goober5000 on February 20, 2006, 10:57:23 am
That said doing Command as something other than a mission flag would mean that I could make it SEXP dependent whether they can talk or not too.

You can link mission flags to sexps too, you know.
Title: Re: Oi! Command! SHUT IT!!!
Post by: karajorma on February 20, 2006, 11:18:00 am
Yeah. I noticed that while poking around today. :)

Pilots should be done via a ship flag rather than a mission flag so that each ship can be set as silenced either directly from the misc properties editor or via a SEXP.

Which brings up another point. I was looking at simply copying and editing the ship-stealthy SEXP code to make the new SEXPs but I've noticed it goes through the sexp_deal_with_ship_flag() function which would mean that I couldn't use it with wings, only individual ships. Is their any reason why Ship-Stealthy has to go through that function or was it just simpler to do it that way?
Title: Re: Oi! Command! SHUT IT!!!
Post by: WMCoolmon on February 20, 2006, 01:23:36 pm
sexp_deal_with_ship_flag deals with setting the flag for all ships for all further SEXP nodes (arguments) for the given SEXP.

Basically you should only use it when:
- You have a SEXP that takes an infinitely long list of ships
- You've already taken care of the other nodes
- You're passing the node location to sexp_deal_with_ship_flag after the other nodes (ie sexp_deal_with_ship_flag(CDR(CDR(n)) )
- You have a ship flag that should be set for parse objects (Ships that haven't entered the mission yet) too.

It might be best to make a subfunction that the main loop in sexp_deal_with_ship_flag calls every time that only deals with a specific ship and use that in your function. You'll have to set the parse object flag if you want to set it in the misc properties editor. (Or if you want to be able to use the SEXP on ships that haven't entered the mission yet) Otherwise you can probably skip the whole sexp_deal_with_ship_flag and just set the flag directly and easily with a for loop.

This whole parse object thing seems screwy...wondering whether it could be consolidated to the Ships array...
Title: Re: Oi! Command! SHUT IT!!!
Post by: Goober5000 on February 20, 2006, 02:57:38 pm
The parse object stuff is weird, but it's necessary if you want to set a ship flag before the ship is actually in the mission.