I'm working on implementing some helpful info for chopper pilots and passengers. Two of the most common questions in a chopper are 1) who's flying this thing and 2) is everyone out.
Using titlersrc I came up with a graphic representation of how many people are in a chopper and a vehiclechat message is shown to chopper occupants whenever someone exits or enters the vehicle.
Here's a screenshot of my initial attempt:
The red numeral 1 on the chopper graphic represents one person in the chopper. As people enter or exit the chopper the number changes to refelct how many in the chopper.
My last issue (which has a workaround just don't know how to implement it) is I need to control which clients execute the script as currently everyone in the game sees the chopper graphic whether in the chopper or not. I'm sure there is a way, just haven't gotten the syntax correct yet.
The image is done using the rscTitles classes (which you define in the description.ext). Unit53 is one person who uses this to display his title screen at startup (and I have seen on some german maps). You can define what you want your titletext to look like, where it will be placed, color, font, etc. For each subclass you have a block of code (shown at bottom code block 1). In place of the text you can specify an image (same rules apply as for squad logos - jpg or paa).
The event is triggered by using the GetIn and GetOut events. You can attach those events to any vehicle using the following in the init field in mission editor for the vehicle:
this addEventHandler ["GetIn",{_this exec "chopper_in.sqs"}]
this addEventHandler ["GetOut",{_this exec "chopper_out.sqs"}]
(note that the curly brackets can be used interchangeably with double quotes)
The event implicitly passes some info to the script being called:
_this select 0 = the vehicle that had the event
_this select 1 = the position the person got into the vehicle
_this select 2 = the person that triggered the event
You can determine who is in a vehicle or how many crew by using:
_vehicle = _this select 0
_myArray = crew _vehicle
_myCount = count crew _vehicle
the driver would be:
driver vehicle _vehicle
where "driver vehicle" is the command and "_vehicle" is the variable.
You should be able to then compare individual client playernames to the list of crew and exit or run a script based if they match or not. This is the part I'm working on now.
The vehiclechat part should be as simple as the image part but due to some odd bug it's not. You should be able to do this in a script:
unitname vehiclehat "text"
but if you just have that line in a script it won't display the chat at all. Be aware also that for each client to see the text using any of the chat commands (global,side,vehicle) you have to have that script execute on all client machines. Anyhow to get around the bug you can use a trigger to trip your vehiclechat command. It would work to have the vehiclechat command in the action of the trigger but happily it also works to have the trigger set some variable to true and then be waiting for that variable to go true in your vehiclechat script. Why this is different than just doing the chat command in the script I have no idea... This is something that almost no one knows I think (I sure didn't see any helpful info on ofpec or flashpoint1985 on it so will be posting there).
Once I have figured out how to execute only on specific machines I'll put together a tutorial w/example mission. The hardest part honestly is playing around to place the image in the right spot as it's a best guess where the coordinates will put it.
To display the image/text specified below just use: TitleRsc ["1","PLAIN"] (where "1" refers to the subclass and "TitleRsc" refers to the parent class I think).
To clear use: Titletext ["","PLAIN"]
To display other numbers than 1 I just defined more subclasses reusing the image for each one.
code block 1)
class RscTitles
{
class 1
{
idd=-1;
movingEnable=0;
duration=22;
fadein=0;
name="1";
controls[]={"chopper","1"};
class chopper : RscStdText
{
style=48;
text="chopper.paa";
x=0.015;
y=0.50;
w=.15;
h=.175;
};
class 1 : RscStdText
{
text="1";
colorText[]={1,0,0,1};
font="TahomaB48";
size=1;
x=-.31;
y=0.55;
w=0.8;
h=0.05;
};
};
// Next class would go here to display "2"
};