Jump to content
Sign in to follow this  
goldenfiver

Insignias in multiplayer

Recommended Posts

Hi guys,

 

I am trying to create a script that assigns different insignias to different players. I want each Fire-Team to get a different insignia, but I have a few problems.

 

I am using this command in the mission init.sqf:

[]execVM "setInsignias.sqf";

And this is my script: (Goes on like that for all the other Fire-Teams): 


if(!isnil "PLT_Platoon_Leader") then {[[ PLT_Platoon_Leader, "isrtgcommand"], "BIS_fnc_setUnitInsignia", nil, true, true] call BIS_fnc_MP;};
if(!isnil "PLT_Radio_Operator") then {[[ PLT_Radio_Operator, "isrtgcommand"], "BIS_fnc_setUnitInsignia", nil, true, true] call BIS_fnc_MP;};
if(!isnil "PLT_Senior_Medic") then {[[ PLT_Senior_Medic, "isrtgcommand"], "BIS_fnc_setUnitInsignia", nil, true, true] call BIS_fnc_MP;};
if(!isnil "PLT_UAV_Operator") then {[[ PLT_UAV_Operator, "isrtgcommand"], "BIS_fnc_setUnitInsignia", nil, true, true] call BIS_fnc_MP;};

I cant get it to work properly on a dedicated server.

 

When the mission starts no insignias are loaded, and only after one of the players reconnects to the server, the insignias appear on everyone except that player. The second problem that I have is that I can't get the insignias to appear properly after respawn - Should I use addEventHandler (killed/respawn)?

Share this post


Link to post
Share on other sites

Hi.

Try to set the stuff from  initPlayerLocal.sqf because :Effect of this function is global, it should be executed consistently for JIP otherwise insignias are gone after respawn, so they have to be reapplied afterwards (On all machines again).

 

The code is like this.

private ["_unit", "_unit2", "_unit3", "_unit4"];
_unit = missionNamespace getVariable ["PLT_Platoon_Leader", objNull];
_unit2 = missionNamespace getVariable ["PLT_Radio_Operator", objNull];
_unit3 = missionNamespace getVariable ["PLT_Senior_Medic", objNull];
_unit4 = missionNamespace getVariable ["PLT_UAV_Operator", objNull];


if (!(isNull _unit)) then {

	[[ PLT_Platoon_Leader, "isrtgcommand"], "BIS_fnc_setUnitInsignia", nil, true, true] call BIS_fnc_MP;
};

if (!(isNull _unit2)) then {

	[[ PLT_Radio_Operator, "isrtgcommand"], "BIS_fnc_setUnitInsignia", nil, true, true] call BIS_fnc_MP;
};

if (!(isNull _unit3)) then {

	[[ PLT_Senior_Medic, "isrtgcommand"], "BIS_fnc_setUnitInsignia", nil, true, true] call BIS_fnc_MP;
};

if (!(isNull _unit4)) then {

	[[ PLT_UAV_Operator, "isrtgcommand"], "BIS_fnc_setUnitInsignia", nil, true, true] call BIS_fnc_MP;
};

Share this post


Link to post
Share on other sites

in my description

 

class CfgUnitInsignia
{
 class Death
 {
  displayName = "Death";
  author = "Dr.Death jm";
  texture = "pictures\rtspatch1.paa";
  textures = "pictures\rtspatch1.paa";<---- does nothing
 };
};​

----------------------------------------------------------

I use a deploy script (I gues same as respawn )

 

[player,"Death"] call BIS_fnc_setUnitInsignia;​ <--- this calls the script (I use it in deploy player, and in my reveive. )

Share this post


Link to post
Share on other sites

Thanks guys, @dr death jm my insignias come from an addon, so I cant use description like you did. as for this line of code:

[player,"Death"] call BIS_fnc_setUnitInsignia;​

Does it work on dedicated servers? how do you manage respawn?

 

@DaVIdoSS :  What does that mean?

private ["_unit", "_unit2", "_unit3", "_unit4"];
_unit = missionNamespace getVariable ["PLT_Platoon_Leader", objNull];
_unit2 = missionNamespace getVariable ["PLT_Radio_Operator", objNull];
_unit3 = missionNamespace getVariable ["PLT_Senior_Medic", objNull];
_unit4 = missionNamespace getVariable ["PLT_UAV_Operator", objNull];

*update: tried both methods. Still buggy at mission start and after respawn (multiplayer sync is messed up)

**update: It seems to mess up squad.xml too. Sometimes the squad xml logo on the uniform dissapears

Share this post


Link to post
Share on other sites

Thanks guys, @dr death jm my insignias come from an addon, so I cant use description like you did. as for this line of code:

[player,"Death"] call BIS_fnc_setUnitInsignia;​

Does it work on dedicated servers? how do you manage respawn? "Death" in code is just name of class

So maybe you need to edit some type of [unit,unit1,unit2,unit3,"your class"] call BIS_Fnc_setUnitInsignia

something like that maybe

yes it works mp, my respawn is a revive script .. but all you need to do is add above to any respawn ,

 

@DaVIdoSS :  What does that mean?

private ["_unit", "_unit2", "_unit3", "_unit4"];
_unit = missionNamespace getVariable ["PLT_Platoon_Leader", objNull];
_unit2 = missionNamespace getVariable ["PLT_Radio_Operator", objNull];
_unit3 = missionNamespace getVariable ["PLT_Senior_Medic", objNull];
_unit4 = missionNamespace getVariable ["PLT_UAV_Operator", objNull];

*update: tried both methods. Still buggy at mission start and after respawn (multiplayer sync is messed up)

**update: It seems to mess up squad.xml too. Sometimes the squad xml logo on the uniform dissapears

Share this post


Link to post
Share on other sites

Thanks, I think I got it working. I am  still not sure what's wrong with my quad.xml ... seems to disappear after respawn. I really hope it's not my code.

Share this post


Link to post
Share on other sites

MP environment, dedicated server.

Insignias work and are selectable from the arsenal.

After the player respawns the insignia and squad xml patch are viewable by the local player but not by anyone else.

 

Can anyone see what I am doing wrong?

 

saveGear.sqf

[player, [missionnamespace, "CurrentGear"]] call bis_fnc_saveInventory;
_insignia = player call BIS_fnc_getUnitInsignia;
[[player, _insignia], "BIS_fnc_setUnitInsignia", nil, true, true] call BIS_fnc_MP;
hint "Your gear has been saved";

player removeEventHandler ["Respawn",10];

10 = player addEventHandler [
	"Respawn", {
		_newPlayer = _this select 0;
		_oldPlayer = _this select 1;
		_insignia = _oldPlayer call BIS_fnc_getUnitInsignia;
		[_newPlayer, [missionnamespace, "CurrentGear"]] call bis_fnc_loadInventory;
		[[_newPlayer, _insignia], "BIS_fnc_setUnitInsignia", nil, true, true] call BIS_fnc_MP;
		hint "Your gear has been loaded";
	}
];

config.cpp for mod that adds the insignias

class CfgUnitInsignia
{
	class 116th
	{
		displayName = "29th ID - HQ";	                                // Name displayed in Arsenal
		author = "29th Engineers";                                 // Author displayed in Arsenal
		texture = "\29th_Insignias\data\116Inf Insignia128pxSQ.paa"; 	// Image path
		textureVehicle = ""; 						// Does nothing currently, reserved for future use
	};

	class CP1S1
	{
		displayName = "29th ID - CP1S1";
		author = "29th Engineers";
		texture = "\29th_Insignias\data\CP1S1_NEW_CO.paa";
	};

	class CP1S2
	{
		displayName = "29th ID - CP1S2";
		author = "29th Engineers";
		texture = "\29th_Insignias\data\CP1S2_ver1_CO.paa";
	};
	
	class CP2S1
	{
		displayName = "29th ID - CP2S1";
		author = "29th Engineers";
		texture = "\29th_Insignias\data\CP2S1_FINAL_CO.paa";
	};
};

class UniformSlotInfo
{
	slotType = 0;
	linkProxy = "-";
};
class CfgPatches
{
	class 29th_Insignias
	{
		units[] = {};
		weapons[] = {};
		requiredAddons[] = {};
	};
};

Share this post


Link to post
Share on other sites

First of all, i think that the pathway your using is wrong - its local only as your giving it the local pathway on your computer. 

Make sure the image.paa file is in the mission folder, and then use the name of the picture as the "pathing".

Example: 

This is what you got:

class CP2S1
{
	displayName = "29th ID - CP2S1";
	author = "29th Engineers";
	texture = "\29th_Insignias\data\CP2S1_FINAL_CO.paa";
};

Use this instead:

class CP2S1
{
	displayName = "29th ID - CP2S1";
	author = "29th Engineers";
	texture = "CP2S1_FINAL_CO.paa";
};

For my mission, this is what i've done.

In the description.ext i've added this:

class CfgUnitInsignia
{
class NRFID
{
displayName = "NATO RESPONSE FORCE";
author = "Ulfgaar";
texture = "NRF.paa";
textureVehicle = "";
};
};

I make sure i have my NRF.paa saved in my mission folder. 


I then add this line to the init field of all units, players as well as AI's - that i want to have this patch:

[this,"NRFID"] call BIS_fnc_setUnitInsignia;

But, in spite of this working both through singleplayer and multiplayer when testing the mission from the editor - the patches dont show up when i've exported it as a multiplayer file and test it on my dedicated server.

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  

×