Jump to content
Bormann2

Adding insignias to units

Recommended Posts

Hello,

I am trying to make insignias (From an addon) work in my mission hosted on dedicated server.

"[unit, classname] call BIS_fnc_setUnitInsignia" didn't work, same with setting the insignias in "identity" tab. After searching for a while I've stumbled across this code:

initPlayerLocal.sqf and onPlayerRespawn.sqf:

if (str(player)in ['A1','A2']) then {
	[player,'TTB_Alpha'] call BIS_fnc_setUnitInsignia;
	};	
if (str(player)in ['B1','B2','B3','B4','B5','B6']) then {
	[player,'TTB_Bravo'] call BIS_fnc_setUnitInsignia;
	};
if (str(player)in ['C1','C2','C3','C4']) then {
	[player,'TTB_Charlie'] call BIS_fnc_setUnitInsignia;
	};

Now - The insignias show on start-up, but after respawn they disappear. The script is working, at least it seems so, since hint I've added shows up. Any ideas? Thank you, in advance!

Share this post


Link to post
Share on other sites

if the insignia is not showing up after respawn you must execute the insignia code on respawn...

 

you can use Respawn event handler (in client) like this: :

player addEventHandler ["Respawn", {

 // Your code here

}];

 

Share this post


Link to post
Share on other sites

Thanks for the reply,

Unfortunately it still doesn't work. I've tried doing some variations of the tip you gave me, like calling the script via execvm and switching "player" with "this". But I am complete layman if it comes to scripting stuff, so I'm not sure if this would change anything anyways.

Share this post


Link to post
Share on other sites

I didn't notice that you are already using onPlayerRespawn.sqf , that should work. are you running this on multiplayer (from editor) ? because i don't think the respawn code is called when playing in single player.

 

Share this post


Link to post
Share on other sites

Yes, of course. I've tried it both on player hosted and dedicated.

Share this post


Link to post
Share on other sites

Yes I do, but I've said in the first post that it doesn't work

Share this post


Link to post
Share on other sites

Alright, small update. If I use only this line

[player,'classname'] call BIS_fnc_setUnitInsignia;

the insignia is set on respawn. That's a step in right direction, although I need diffrent insignias for diffrent units and this will not suffice but at least I think I've got the issue nailed down to the array of units in the script.

Share this post


Link to post
Share on other sites

I think I've resolved the issue. All I had to do was to add a command which removes the insignia before the insignia set script. Thanks for the help, guys! :D

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

I can concur, worked only after removing insignia prior to setting it (for respawn), thanks for the information @Bormann2

[_unit,""] call BIS_fnc_setUnitInsignia;
[_unit, _badge] call BIS_fnc_setUnitInsignia;

 

Share this post


Link to post
Share on other sites

Sorry to bring up an older thread - but im struggling with the same.

If you guys found a solution for this, i'd very much like to know. Im the content creator for my A3 group, and we have our own mod with custom shoulder patches for each squad. I'd want these patches to be on "by default" to the role they select - so if they are in a role in squad 1, they get the patch of squad 1 - if they are in a role of squad 2 they get the patch for squad 2. 
 

player addEventHandler ["Respawn", {
[this,""] call BIS_fnc_setUnitInsignia;
[this,"SPAR_WOL1"] call BIS_fnc_setUnitInsignia;
}];

Am i right to understand that this was the "solution" you ended up with @Bormann2 (this ofc my variation)? If not, would you add what ended up being your working solution for unit shoulder patches working on dedicated servers, even after respawn?

 

And are you using the code in the units init field, or in the "onPlayerRespawn.sqf" script?

And is this solution JIP friendly?

 

Share this post


Link to post
Share on other sites

Alright, think i figured it out - just in case anyone else is looking for this - i'll show everyone the end result.

So in the initPlayerLocal.sqf you have this:

if (str(player)in ['A1','A2']) then {
	[player,'TTB_Alpha'] call BIS_fnc_setUnitInsignia;
	};	
if (str(player)in ['B1','B2','B3','B4','B5','B6']) then {
	[player,'TTB_Bravo'] call BIS_fnc_setUnitInsignia;
	};
if (str(player)in ['C1','C2','C3','C4']) then {
	[player,'TTB_Charlie'] call BIS_fnc_setUnitInsignia;
	};


And then you have in the onPlayerRespawn.sqf:

if (str(player)in ['A1','A2']) then {
	[player,''] call BIS_fnc_setUnitInsignia;
	[player,'TTB_Alpha'] call BIS_fnc_setUnitInsignia;
	};	
if (str(player)in ['B1','B2','B3','B4','B5','B6']) then {
	[player,''] call BIS_fnc_setUnitInsignia;
	[player,'TTB_Bravo'] call BIS_fnc_setUnitInsignia;
	};
if (str(player)in ['C1','C2','C3','C4']) then {
	[player,''] call BIS_fnc_setUnitInsignia;
	[player,'TTB_Charlie'] call BIS_fnc_setUnitInsignia;
	};

initPlayerLocal.sqf will add insignias to the designated units as you enter the game, while onPlayerRespawn.sqf will first remove said insignia, and reapply them on respawn.

I've tested it on dedicated server, solo however, but it seems to work on both loading in and on respawn. If its JIP friendly, or if other people can see the insignias remains to be seen. I think it will, as technically these scripts will fire every time someone logs onto the server, and on every respawn. I will update once i've gotten around to test it with multiple other players.

Share this post


Link to post
Share on other sites

Player load in with insignias, but as soon as they change to preset loadouts (loadouts which has no identity lines), it dissapears. Is there a way to script into preset loadouts that they will sport the insignia which was used by the person who cliked it?

 

Share this post


Link to post
Share on other sites

Could this be an option to ensure shoulder insignia visibility for all clients both connecting and respawning on the server?

initPlayerLocal.sqf

{
if (str(player)in ['A1','A2']) then {
	[player,'TTB_Alpha'] call BIS_fnc_setUnitInsignia;
	};	
if (str(player)in ['B1','B2','B3','B4','B5','B6']) then {
	[player,'TTB_Bravo'] call BIS_fnc_setUnitInsignia;
	};
if (str(player)in ['C1','C2','C3','C4']) then {
	[player,'TTB_Charlie'] call BIS_fnc_setUnitInsignia;
	};
} remoteExec ["bis_fnc_call", 0, True];

onPlayerRespawn.sqf:

{
if (str(player)in ['A1','A2']) then {
	[player,''] call BIS_fnc_setUnitInsignia;
	[player,'TTB_Alpha'] call BIS_fnc_setUnitInsignia;
	};	
if (str(player)in ['B1','B2','B3','B4','B5','B6']) then {
	[player,''] call BIS_fnc_setUnitInsignia;
	[player,'TTB_Bravo'] call BIS_fnc_setUnitInsignia;
	};
if (str(player)in ['C1','C2','C3','C4']) then {
	[player,''] call BIS_fnc_setUnitInsignia;
	[player,'TTB_Charlie'] call BIS_fnc_setUnitInsignia;
	};
} remoteExec ["bis_fnc_call", 0, True];


And if I add into each script for each preset loadout to say execute the contents of one of these scripts, could it work then, to ensure that each player is wearing said roles shoulder insignia at all times?

Or will i be fucking up some majorly with server performance or other shit? Im trying to put together stuff i dont really know too much about, so some help here would be nice :)

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

×