Jump to content
Sign in to follow this  
hellstorm77

Crew Info in vehicles

Recommended Posts

I was wondering if i could get alittle help with a script. I'm looking for a Crew Info in vehicles script that allows me to see who is in the vehicles im in

Share this post


Link to post
Share on other sites

Here you go mate...

Plenty of ways to show the data, from dialogs to hint boxes to titletext like I have...

Just call it as usual from the init.sqf file...

  while {true} do  {

   if(player != vehicle player) then
   {
       _name = "";
       _vehicle = assignedVehicle player;

       {
           if((driver _vehicle == _x) || (gunner _vehicle == _x)) then
           {
               if(driver _vehicle == _x) then
               {
                   _name = format ["%1 %2 %3 %4 %5",_name, (name _x)];
               }

               else
               {
                   _name = format ["%1 %2 %3 %4 %5",_name, (name _x)];
               };

           }
           else
           {
               _name = format ["%1 %2 %3 %4 %5",_name, (name _x)];
           };  

       } forEach crew _vehicle;


         titleText [ Format ["%1 %2 %3 %4 %5",_name], "PLAIN DOWN", 0.1];

   	};
 }; 

Will show like so....

eg8qrk.jpg

Ignore ST_Hud, the names above it are what it shows!

---------- Post added at 20:20 ---------- Previous post was at 19:19 ----------

Or use this one with icons etc and as a silent hint!

      while {true} do  {

   if(player != vehicle player) then
   {
       _name = "";
       _vehicle = assignedVehicle player;
       {
           if((driver _vehicle == _x) || (gunner _vehicle == _x)) then
           {
               if(driver _vehicle == _x) then
               {
                   _name = format ["%1 %2 <img size='0.8' image='a3\ui_f\data\IGUI\Cfg\Actions\getindriver_ca.paa'/><br/>",_name,(name _x)];
               }

               else
               {
                   _name = format ["%1 %2 <img size='0.8' image='a3\ui_f\data\IGUI\Cfg\Actions\getingunner_ca.paa'/><br/>",_name, (name _x)];
               };

           }
           else
           {
               _name = format ["%1 %2 <img size='0.8' image='a3\ui_f\data\IGUI\Cfg\Actions\getincargo_ca.paa'/><br/>",_name, (name _x)];
           };  

       } forEach crew _vehicle;

       hintsilent parsetext  _name;

   	};
 };   

Edited icons, using more viewable ones now!

28wev5.jpg

Edited by marker

Share this post


Link to post
Share on other sites

Hi Marker! Mucho gracias for this feature! (As the utter noob I am) I have tried getting this implemented in our current mission but so far without success.

I copy-pasted your code in our init.sqf but without results.

Subsequently I copy-pasted your code in a seperate vehiclecrew.sqf getting called by null = execVM "vehiclecrew.sqf"; in init.sqf. Also without results.

Am i overlooking something specifically to make this work?

Edited by Slammin
grammar

Share this post


Link to post
Share on other sites

i have a folder called paa with the images in the folder. In my init.sqf i have this to call it "call compile preProcessFile "crewinfo.sqf";

crewinfo.sqf

if (!local player) exitWith { };

private ["_crew", "_text", "_vehicle", "_role", "_name"];

disableSerialization;

#define WCTEXTW		0.80
#define WCTEXTY		0.06
#define WCTEXTHEIGHT	0.50
#define WCTEXTWIDTH	0.30

// controlName ctrlSetPosition [x, y, w, h] 
// SafeZoneX returns the value for the left side of screen.
// SafeZoneY returns the value for the top of the screen.
// SafeZoneW returns the whole width of the screen.
// SafeZoneH returns the whole height of the screen. 

private ["_ctrl"];

uiNamespace setVariable ['crewinfodisplay', objnull];

while { true } do {
	if (isnull (uiNamespace getVariable "crewinfodisplay")) then { cutrsc ["crewinfomessage", "PLAIN"]; };
	if (vehicle player != player) then {
		_text = "";
		_crew = crew (vehicle player);
		_vehicle = vehicle player;
		_name= getText (configFile >> "CfgVehicles" >> (typeOf vehicle player) >> "DisplayName");
		_text= _text + format ["<t size='1.35' shadow='true' color='#AAAAFF'>%1</t><br/>", _name];
		{
			if(!(format["%1", name _x] == "") and !(format["%1", name _x] == "Error: No unit")) then {
				_role = assignedVehicleRole _x;
				switch(_x)do {
					case commander _vehicle: {
						_text=_text+format ["<t size='1.5'><img image='paa\i_commander_ca.paa'></t> <t size='1.35' shadow='true' color='#AAAAFF'>%1</t><br/>", name _x];
					};

					case gunner _vehicle: {
						_text=_text+format ["<t size='1.5'><img image='paa\i_gunner_ca.paa'></t> <t size='1.35' shadow='true' color='#FF8888'>%1</t><br/>", name _x];
					};

					case driver _vehicle: {		
						_text=_text+format ["<t size='1.5'><img image='\paa\i_driver_ca.paa'></t> <t size='1.35' shadow='true' color='#88FF88'>%1</t><br/>", name _x];
					};

					default	{
						if(format["%1", (_role select 0)] != "Turret") then {
							_text=_text+format ["<t size='1.5'><img image='\paa\i_cargo_ca.paa'></t> <t size='1.35' shadow='true' color='#EEEEEE'>%1</t><br/>", name _x];
						} else {
							_text=_text+format ["<t size='1.5'><img image='paa\i_gunner_ca.paa'></t> <t size='1.35' shadow='true' color='#FF8888'>%1</t><br/>", name _x];
						};
					};
				};
			};
		}forEach _crew;
	}; 



	_ctrl = (uiNamespace getVariable 'crewinfodisplay') displayCtrl 10101;
	_ctrl ctrlSetStructuredText parseText _text;
	_text = "";
	_ctrl ctrlCommit 0;
	uiNamespace setVariable ['crewinfodisplay', objnull];
	 sleep 1;

};

I'm getting this error

Warning Message: Resource title crewinfomessage not found

Error in expression <amespace getVariable 'crewinfodisplay') displayCtrl 10101;

_ctrl ctrlSetStructur>

Error position: <displayCtrl 10101;

_ctrl ctrlSetStructur>

Error displayctrl: Type Object, expected Display (dialog)

File C:\Users\Liverpool\Documents\Arma 3 Alpha - Other Profiles\[dR]Hellstorm77\missions\[dR]_Invade_&_Annex.Stratis\crewinfo.sqf, line 81

Share this post


Link to post
Share on other sites

Slammin

Just tested it there, using my pc as host and it worked for me.. Standard [] execvm "crew.sqf";

Hellstorm

Sure that isn't a problem with your dialog?

Also never seen anyone use +format before.. Sure that's right?

Share this post


Link to post
Share on other sites

the script is from MSO and i have seen it working on arma 3 as well as arma 2 jman made it i think

Share this post


Link to post
Share on other sites

I'll grab MSO and have a look, bit cant promise anything. Best contact Jman himself, especially if you are going to use his code in another mission!

Slammin

Try

if (isServer) then { above code inside here };

See if that works!

Share this post


Link to post
Share on other sites
the script is from MSO and i have seen it working on arma 3 as well as arma 2 jman made it i think

Indeed. I've just knocked up a quick standalone version of it for you all. Enjoy!

Download CrewInfo Script

Screenshot Link

Edited by [KH]Jman

Share this post


Link to post
Share on other sites

Nice one Jman...

Couldn't be bothered firing mine into a dialog/hud, they never seem to work for me :)

Nice work!

Share this post


Link to post
Share on other sites

Thanks Jman for taking time out to do this

---------- Post added at 23:29 ---------- Previous post was at 23:10 ----------

just one more question i have class RscTitles in another script having this code as well its making it crash could i change this?

class RscTitles
{
#include <crewinfo\dialog.hpp>
};

Share this post


Link to post
Share on other sites

Thanks Marker and thanks Jman!! Really useful and much wanted feature!

@Marker, it was not your initial scripts that caused this feature not to work on our server. I found out that a piece of the script in init.sqf from " Digital Compass Bearing script [ALPHA] " by BearBison conflicts with this script.

Code :

/* Compass bearing */

//call compile preprocessFile "scripts\BEARB_heading.sqf";

http://www.armaholic.com/page.php?id=19486

http://forums.bistudio.com/showthread.php?150530-Digital-Compass-Script

Perhaps does someone know if there is one way or another to circumvent this conflict.

Share this post


Link to post
Share on other sites
Thanks Jman for taking time out to do this

---------- Post added at 23:29 ---------- Previous post was at 23:10 ----------

just one more question i have class RscTitles in another script having this code as well its making it crash could i change this?

class RscTitles
{
#include <crewinfo\dialog.hpp>
};

Just combine the two includes into one RscTitles class

Share this post


Link to post
Share on other sites

this is the other script how would i combine the two includes into one RscTitles class

stc_include.hpp

#include "colors_include.hpp"
#include "control_include.hpp"

#define DISPLAY_SMALL_BACKGROUND_COLOR  COLOR_HALF_GREY

class UC_Display_Small {
   idc = -1;
   type = CT_STRUCTURED_TEXT;
   style = ST_LEFT;
   colorBackground[] = DISPLAY_SMALL_BACKGROUND_COLOR;
   x=0.3;
   y=safeZoneY;
   w=0.4;
   h=0.2;
   size = 0.024;
   text = "";
   fixedWidth = 1;
   class Attributes{
       font = "TahomaB";
       color = HTMLCOLOR_WHITE;
       align = "left";
       valign = "top";
       shadow = true;
       shadowColor = HTMLCOLOR_BLACK;
       underline = false;
       size = "1";
   };
};

class UC_HideDisplay_Small {
   idc = -1;
   type = CT_STRUCTURED_TEXT;
   style = ST_LEFT;
   colorBackground[] = COLOR_TRANSPARENT;
   x=0.3;
   y=safeZoneY;
   w=0.4;
   h=0.2;
   size = 0.024;
   text = "";
   fixedWidth = 1;
   class Attributes{
       font = "PuristaLight";
       color = HTMLCOLOR_BLACK;
       align = "left";
       valign = "top";
       shadow = true;
       shadowColor = HTMLCOLOR_BLACK;
       underline = false;
       size = "1";
   };
};

class RscTitles
{
   titles[]={};
   class UC_ShowText_small
   {
       idd=-1;
       movingEnable=0;
       duration=10e30;
       fadein = 0;
       name="UC_ShowText1";
       onLoad = "uiNamespace setVariable ['d_UC_ShowText_small', _this select 0]";
       controls[]={"textUC_Show1"};
       class textUC_Show1 : UC_Display_small
       {
           idc = 301;
       };
   };
   class UC_HideText_small
   {
       idd=-1;
       movingEnable=0;
       duration=10e30;
       fadein = 0;
       name="UC_HideText1";
       onLoad = "uiNamespace setVariable ['d_UC_HideText_small', _this select 0]";
       controls[]={"textUC_Hide1"};
       class textUC_Hide1 : UC_HideDisplay_Small
       {
           idc = 301;
       };
   };
};

Edited by hellstorm77

Share this post


Link to post
Share on other sites

just put #include <crewinfo\dialog.hpp> after:

class RscTitles

{

and before:

titles[]={};

Share this post


Link to post
Share on other sites

Jman

You should change your icons to the included ones within A3... Data path is as below..

a3\ui_f\data\IGUI\Cfg\Actions\getindriver_ca.paa

Getingunner.paa, getincargo, getinpilot and getincommander are all there...

Share this post


Link to post
Share on other sites

i tried that but it crashed saying #include <crewinfo\dialog.hpp> not found so i just took out the other script and just used the crewinfo made things easier

Share this post


Link to post
Share on other sites

In the editor if you make a change to the description.ext you MUST reload the mission back into the editor before previewing it or it will not see your changes... that's prob what caused it. Other than that re-check that the crewinfo dir exists in the root of your mission.

Share this post


Link to post
Share on other sites

Thanks for this Jman, the one issue I had with it was that where it came up on the left side of the screen is right where the action menu comes up, making it pretty unreadable when they overlap. So I edited a couple of values in the dialog.hpp file. If anybody using it wants the crew list on the far right instead where it is out of the way of the action menu and also hints, then just replace the part of the dialog.hpp file from line 24 to line 36 with the following:


	class crewinfotext { 
		idc = 10101; 
		type = CT_STRUCTURED_TEXT; 
		style = ST_LEFT; 
		x = (SafeZoneX + 2.25);
		y = (SafeZoneY + 0.40);
		w = 0.3;
		h = 0.6;
		size = 0.018; 
		colorBackground[] = { 0, 0, 0, 0 };
		colortext[] = {0,0,0,0.7};
		text ="";
	};

Hopefully it works the same as it does for me on other monitors and it doesn't depend on monitor size or anything.

Share this post


Link to post
Share on other sites

how would i move this to the left side of the screen?

   while {true} do  {

   if(player != vehicle player) then
   {
       _name = "";
       _vehicle = assignedVehicle player;
       {
           if((driver _vehicle == _x) || (gunner _vehicle == _x)) then
           {
               if(driver _vehicle == _x) then
               {
                   _name = format ["%1 %2 <img size='0.8' image='a3\ui_f\data\IGUI\Cfg\Actions\getindriver_ca.paa'/><br/>",_name,(name _x)];
               }

               else
               {
                   _name = format ["%1 %2 <img size='0.8' image='a3\ui_f\data\IGUI\Cfg\Actions\getingunner_ca.paa'/><br/>",_name, (name _x)];
               };

           }
           else
           {
               _name = format ["%1 %2 <img size='0.8' image='a3\ui_f\data\IGUI\Cfg\Actions\getincargo_ca.paa'/><br/>",_name, (name _x)];
           };  

       } forEach crew _vehicle;

       hintsilent parsetext  _name;

       };
 };  

Edited by hellstorm77

Share this post


Link to post
Share on other sites

Love the script! Is there a way to tell where the gunner of a vehicle is aiming the main weapon so I can use it to set it as a target for a camera?

Share this post


Link to post
Share on other sites
Love the script! Is there a way to tell where the gunner of a vehicle is aiming the main weapon so I can use it to set it as a target for a camera?

Try using Eyedirection

Share this post


Link to post
Share on other sites
Love the script! Is there a way to tell where the gunner of a vehicle is aiming the main weapon so I can use it to set it as a target for a camera?

I have the direction my gunner is looking next to his name in the vehicle...

Will work on placing it inside a dialog for you to use...

EDIT

Will need to use turret direction as we use the inbuilt camera for the hunter.

Edited by marker

Share this post


Link to post
Share on other sites
Thanks for this Jman, the one issue I had with it was that where it came up on the left side of the screen is right where the action menu comes up, making it pretty unreadable when they overlap. So I edited a couple of values in the dialog.hpp file. If anybody using it wants the crew list on the far right instead where it is out of the way of the action menu and also hints, then just replace the part of the dialog.hpp file from line 24 to line 36 with the following:


	class crewinfotext { 
		idc = 10101; 
		type = CT_STRUCTURED_TEXT; 
		style = ST_LEFT; 
		x = (SafeZoneX + 2.25);
		y = (SafeZoneY + 0.40);
		w = 0.3;
		h = 0.6;
		size = 0.018; 
		colorBackground[] = { 0, 0, 0, 0 };
		colortext[] = {0,0,0,0.7};
		text ="";
	};

Hopefully it works the same as it does for me on other monitors and it doesn't depend on monitor size or anything.

Yeah that will not work for some resolutions. I suggest you just move it down (y) a little on the left side i.e

class crewinfotext { 
		idc = 10101; 
		type = CT_STRUCTURED_TEXT; 
		style = ST_LEFT; 
		x = (SafeZoneX + 0.02);
		y = (SafeZoneY + 0.60);
		w = 0.3;
		h = 0.6;
		size = 0.018; 
		colorBackground[] = { 0, 0, 0, 0 };
		colortext[] = {0,0,0,0.7};
		text ="";
	};

Edited by [KH]Jman

Share this post


Link to post
Share on other sites
Jman;2368733']Yeah that will not work for some resolutions. I suggest you just move it down (y) a little on the left side i.e

class crewinfotext { 
		idc = 10101; \
		type = CT_STRUCTURED_TEXT; 
		style = ST_LEFT; 
		x = (SafeZoneX + 0.02);
		y = (SafeZoneY + 0.60);
		w = 0.3;
		h = 0.6;
		size = 0.018; 
		colorBackground[] = { 0, 0, 0, 0 };
		colortext[] = {0,0,0,0.7};
		text ="";
	};

Thanks for the info, I've changed it to that.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×