Jump to content
rekkless

Help with Mission on Dedicated Server (Video Provided)

Recommended Posts

As I stated in the video, everything works perfectly fine when I test the mission in the EDEN editor. And when I load the mission as a multiplayer mission locally on my machine. But for some reason when loaded on a Dedicated Server there are problems.

 

 

Below is the CODE for that exact player. His name is "BCOM" as the Variable Name in the EDEN Editor.

 

Briefing Code: 

In a file called briefingSetup.SQF - This works fine provided you are there for the start of the mission, if you JIP it doesn't appear.

BCOM createDiaryRecord ["Diary", 
							["Communications Specialist Instructions", 
								"You are the Communications Specialist. You are tasked with communicating with the US NATO Spy that has been inserted into the Russian Armed Forces ranks. Change your long-range PRC-117F (ACE Menu) to channel 81. Remember to relay all important information about the whereabouts of your spy, the where abouts of the Russian force and the whereabouts of the Russian Ammo truck to your Squad Leader. Organize an ambush with your spy and make the most of your asset while you can. 
Be patient with your spy, offer him support and sound advice. Keep him alive for a long as possible, he is your key to victory."]];

 

In a file called init.sqf

nul = [] execVM "BriefingSetup.sqf";

 

 

 

Insignia Code: 

In the description.ext

class CfgUnitInsignia
{
	class US1
	{
		displayName = "US1"; // Name displayed in Arsenal
		author = "USP"; // Author displayed in Arsenal
		texture = "US1.paa"; // Image path.
		textureVehicle = ""; // Does nothing currently, reserved for future use
	};
};

 

On the player "BCOM" in the editors INIT box

 

[this,"US1"] call BIS_fnc_setUnitInsignia;

 

Share this post


Link to post
Share on other sites

There's your problem,

so you need to create a file called initPlayerLocal.sqf and add anything you want every player to see, start or JIP. So for you, all you need to do is add that line above into the file and it will execute evertime a player starts the load in phase.

 

It will now look like this:

initPlayerLocal.sqf:
 

[this,"US1"] call BIS_fnc_setUnitInsignia;

0 = execVM "briefingSetup.SQF";

I presume you have no folder structure.

 

Any issues reply back :D

Share this post


Link to post
Share on other sites
12 minutes ago, 56Curious said:

There's your problem,

so you need to create a file called initPlayerLocal.sqf and add anything you want every player to see, start or JIP. So for you, all you need to do is add that line above into the file and it will execute evertime a player starts the load in phase.

 

It will now look like this:

initPlayerLocal.sqf:
 


[this,"US1"] call BIS_fnc_setUnitInsignia;

0 = execVM "briefingSetup.SQF";

I presume you have no folder structure.

 

Any issues reply back :D

 

Awesome mate, I'll take a look add that in and see how we go

 

I did have structure for the insignias, but removed them out of their folder because I thought that might be causeing an issue

 

My initPlayerLocal.sqf looks like this now:

 

[this,"US1"] call BIS_fnc_setUnitInsignia;
[this,"US2"] call BIS_fnc_setUnitInsignia;
[this,"MED1"] call BIS_fnc_setUnitInsignia;
[this,"RUS1"] call BIS_fnc_setUnitInsignia;
[this,"RUS2"] call BIS_fnc_setUnitInsignia;
[this,"Indi1"] call BIS_fnc_setUnitInsignia;
[this,"Indi2"] call BIS_fnc_setUnitInsignia;

0 = execVM "briefingSetup.SQF";

 

 

 

 

I also updated my original post. I forgot to add that the init.sqf had code in it for the briefing.

 

Share this post


Link to post
Share on other sites

It didn't work on either account. Neither for the Insignia or the briefing.

 

In fact when I removed the 

Quote

nul = [] execVM "BriefingSetup.sqf";

 

from the init.sqf the briefing didn't show up at all.

 

 

 

If this helps all 30 players need to see the insignias, only 6 players need to see a briefing and they each have their own briefing.

 

Player names are BCOM, BSPY, OCOM, OSPY, ICOM and ISPY each signalling a communications specialist and a spy.

 

No other player in the mission has a name.

 

 

Share this post


Link to post
Share on other sites

In a scripted mission, you have description.ext, mission.sqm, all sqf events you wrote, and other called sqf from them.

The problem is that when you respawn, you don't run again the description.ext and all this stuff except onPlayerRespawn.sqf or equivalent. That's normal.

So, on contrary of addons environment, you loose plenty of settings at respawn if you don't recall them in onPlayerRespawn.sqf or equivalent EH.

That worth for addAction, briefing menus, tasks (some of them), setObjectTexture global (then setUnitInsignia) ...

 

It's worse with a player returning to lobby and rejoining the game. There is no EH to seek for that.

 

Share this post


Link to post
Share on other sites
3 minutes ago, pierremgi said:

In a scripted mission, you have description.ext, mission.sqm, all sqf events you wrote, and other called sqf from them.

The problem is that when you respawn, you don't run again the description.ext and all this stuff except onPlayerRespawn.sqf or equivalent. That's normal.

So, on contrary of addons environment, you loose plenty of settings at respawn if you don't recall them in onPlayerRespawn.sqf or equivalent EH.

That worth for addAction, briefing menus, tasks (some of them), setObjectTexture global (then setUnitInsignia) ...

 

It's worse with a player returning to lobby and rejoining the game. There is no EH to seek for that.

 

 

Ok, so what is the work around then? Why do the insignias work perfectly fine on a local machine, or when I'm hosting the mission locally via LAN?

Surely there is something I can do to make the briefing useable for players who are JIPing and surely there is a way to get Insignias to work on a dedicated machine??

Share this post


Link to post
Share on other sites

Forgot about the onPlayerRespawn event ahah.

 

Did the breifing show at all on initPlayerLocal?

Share this post


Link to post
Share on other sites
11 minutes ago, 56Curious said:

Forgot about the onPlayerRespawn event ahah.

 

Did the breifing show at all on initPlayerLocal?

 

No it didn't sadly. Nothing in the initPlayerLocal worked.

Share this post


Link to post
Share on other sites

that's strange, have you tried adding

if (isDedicated) then { /*Code*/ };

inside of the breifing file?

  • Confused 1

Share this post


Link to post
Share on other sites

Definitely, there is no player on dedicated PC. Never. Briefing are for players. There is no reason to fail with initPlayerLocal.sqf. It's JIP compatible.... except if you have added for weird line like: if (isDedicated) then... or even if (isServer) then...

Just place your briefing (without condition) in initPlayerLocal.sqf and onPlayerRespawn.sqf. The simpler the better.

Same for unit insignia.

Note: If i remember well, there is a path issue depending on "pboed or not" mission, when called from the description.ext. (paths are OK with addons, but not with the description.ext). Should not be a problem if you let the paa in root mission folder.

 

 

Share this post


Link to post
Share on other sites
53 minutes ago, pierremgi said:

Definitely, there is no player on dedicated PC. Never. Briefing are for players. There is no reason to fail with initPlayerLocal.sqf. It's JIP compatible.... except if you have added for weird line like: if (isDedicated) then... or even if (isServer) then...

Just place your briefing (without condition) in initPlayerLocal.sqf and onPlayerRespawn.sqf. The simpler the better.

Same for unit insignia.

Note: If i remember well, there is a path issue depending on "pboed or not" mission, when called from the description.ext. (paths are OK with addons, but not with the description.ext). Should not be a problem if you let the paa in root mission folder.

 

 

 

Ok, unfortunately I'm having a hard time understand what you're saying. Can you give me something I can copy and paste??

 

If anyone feels up to it, I've uploaded the mission itself. If anyone would like to take a look and edit it how they see fir that would be awesome too. Just a lot of this is going over my head.
https://mega.nz/#!MoMF3RwD!a1KqkNuYltLDo_Lv3ADAnzD05DTZgygIHunXbdRDJVI

Share this post


Link to post
Share on other sites
1 hour ago, pierremgi said:

Definitely, there is no player on dedicated PC. Never. Briefing are for players. There is no reason to fail with initPlayerLocal.sqf. It's JIP compatible.... except if you have added for weird line like: if (isDedicated) then... or even if (isServer) then...

 

My bad if that's the way it came across, I was saying to add it in the file itself and execVM the script from a new source, not in the initPlayerLocal. Of course you're not going to check for dedicated in a local script :P

Share this post


Link to post
Share on other sites

OK so I managed to get the Briefing working both in initial launch and with JIP. I managed getting it working through the initPlayerlocal.sqf

 

now for the insignia.

 

I'm thinking of going through the mission and giving each player a Variable name ie. B1, B2, B3 etc.

 

would this work if I post this in the initPlayerlocal.sqf?

 

[B1,B2,B3,B4,B5,"US1"] call BIS_fnc_setUnitInsignia;

 

Share this post


Link to post
Share on other sites

no. You cant do it like this.

Every olayer need to run for him self because is an global function.

  • Like 1

Share this post


Link to post
Share on other sites
3 minutes ago, davidoss said:

no. You cant do it like this.

Every olayer need to run for him self because is an global function.

 

So then how about this:

 

[B1,"US1"] call BIS_fnc_setUnitInsignia;
[Med1,"Med1"] call BIS_fnc_setUnitInsignia;
[BCOM,"US1"] call BIS_fnc_setUnitInsignia;
[B4,"US1"] call BIS_fnc_setUnitInsignia;
[B5,"US1"] call BIS_fnc_setUnitInsignia;

 

Or should I put this stuff in a different document other than the InitPlayerlocal.sqf??

Share this post


Link to post
Share on other sites

Let the iniPlayerLocal.sqf for the player only.

Do you have some AIs (playable units) waiting to be player , and you want them to show insignia? If so, do that in initServer.sqf.

Share this post


Link to post
Share on other sites
15 minutes ago, pierremgi said:

Let the iniPlayerLocal.sqf for the player only.

Do you have some AIs (playable units) waiting to be player , and you want them to show insignia? If so, do that in initServer.sqf.

 

I don't have AI walking around, as AI is disabled but there are 30 playable slots that I would like it to work even when players JIP.

 

Can you give me an idea of what it should look like.

 

Assuming the insignia is called US1

 

and the player Variable names are B1, B2, B3, B4 and B5

Share this post


Link to post
Share on other sites

First of all, if you name your playables units B1, B2, B3 or any othe variable names, AND if you disabled AI in the lobby, these units will not be here before a player JIP (normal behavior for disabled slots) but also, Arma will throw a message for error (undefined variable), each time you will try to run some code with these names. Because, disabled slots don't have any defined name before JIP!  On my mind, it's a big mistake from BI (playableUnits are playedUnits, in fact, when you choos to disable the slots).

 

Now, in initPlayerLocal.sqf, you just have to:

[player,"US1"] call BIS_fnc_setUnitInsignia;

player addEventHandler ["respawn", { [(_this select 0) ,"US1"] call BIS_fnc_setUnitInsignia }];

 

Share this post


Link to post
Share on other sites
9 hours ago, pierremgi said:

_insignia = ["US1","med1"] select (player getUnitTrait "Medic");

[player,_insignia] call BIS_fnc_setUnitInsignia;

player addEventHandler ["respawn", { [(_this select 0) ,_insignia] call BIS_fnc_setUnitInsignia }]

That respawn event will not work as...

  1. _insignia is undefined within the events code
  2. the insignia used is stored on the player in the variable "BIS_fnc_setUnitInsignia_class", on respawn the variable space of the old unit is copied to the new unit, BIS_fnc_setUnitInsignia will not apply a new insignia if the variable already exists and its value is the same as that passed to the function
//initPlayerLocal.sqf

params[ "_player" ];

_record = switch ( true ) do {
	//If the variable BCOM exists and BCOM is this player
	case ( !isNil "BCOM" && { BCOM isEqualTo _player } ) : {
		//BCOM Diary record
		["Communications Specialist Instructions", "You are the Communications Specialist. You are tasked with communicating with the US NATO Spy that has been inserted into the Russian Armed Forces ranks. Change your long-range PRC-117F (ACE Menu) to channel 81. Remember to relay all important information about the whereabouts of your spy, the where abouts of the Russian force and the whereabouts of the Russian Ammo truck to your Squad Leader. Organize an ambush with your spy and make the most of your asset while you can. Be patient with your spy, offer him support and sound advice. Keep him alive for a long as possible, he is your key to victory."]
	};
	case ( !isNil "BSPY" && { BSPY isEqualTo _player } ) : {
		["You Are The Chechen Spy", "You are the Chechen Spy (Indipendant). Use your secondary radio (the PRC-152) and set it (ACE Menu) to Channel 92 and cycle your Babel Language to Chechen. Stealthly gain important intelligence on the moves of the US Nato Ammo Truck and relay that information to the Chechen Communications Specialist. Be advised the PRC152 has a limited range and the risks of communicating with the Chechen forces are high so pick your moments to communicate with your Chechen contacts carefully. Stay quiet, stay inconspicuous and be clear with your intel. Remember to communicate to your US Nato squad on the PRC-343 and cycle your language BACK to English before you do so. You're no good to the Chechen Alliance dead. If you haven't set your Babel key, once in game press: Escape > Configure > Controls > Configure Addons > ACRE 2 and set your Cycle Babel Language to a key you don't normally use (RIGHT WINDOWS KEY is recommended). Also when changing languages there can be a slight delay before you start speaking your second language so it is recommended you give it a couple of seconds before replying over the radio. "]
	};
	case ( !isNil "OCOM" && { OCOM isEqualTo _player } ) : {
		["Communications Specialist Instructions", "You are the Communications Specialist. You are tasked with communicating with the Russian Spy that has been inserted into the Chechen ranks. Change your long-range PRC-117F (ACE Menu) to channel 64. Remember to relay all important information about the whereabouts of your spy, the where abouts of the Chechen force and the whereabouts of the Chechen Ammo truck to your Squad Leader. Organize an ambush with your spy and make the most of your asset while you can. Be patient with your spy, offer him support and sound advice. Keep him alive for a long as possible, he is your key to victory."]
	};
	case ( !isNil "OSPY" && { OSPY isEqualTo _player } ) : {
		["You Are The NATO Spy", "You are the US NATO Spy (BLUFOR). Use your secondary radio (the PRC-152) and set it (ACE Menu) to Channel 81 and cycle your Babel Language to English. Stealthly gain important intelligence on the moves of the Russian Ammo Truck and relay that information to the US NATO Communications Specialist. Be advised the PRC152 has a limited range and the risks of communicating with the US NATO forces are high so pick your moments to communicate with your US NATO contacts carefully. Stay quiet, stay inconspicuous and be clear with your intel. Remember to communicate to your Russian squad on the PRC-343 and cycle your language BACK to Russian before you do so. You don't want to get caught speaking English in front of your Russian comrads. You're no good to the US NATO Forces dead. If you haven't set your Babel key, once in game press: Escape > Configure > Controls > Configure Addons > ACRE 2 and set your Cycle Babel Language to a key you don't normally use (RIGHT WINDOWS KEY is recommended). Also when changing languages there can be a slight delay before you start speaking your second language so it is recommended you give it a couple of seconds before replying over the radio."]
	};
	case ( !isNil "ICOM" && { ICOM isEqualTo _player } ) : {
		["Communications Specialist Instructions", "You are the Communications Specialist. You are tasked with communicating with the Chechen Spy that has been inserted into the US NATO ranks. Change your long-range PRC-117F (ACE Menu) to channel 92. Remember to relay all important information about the whereabouts of your spy, the where abouts of the US NATO force and the whereabouts of the US NATO Ammo truck to your Platoon Leader. Organize an ambush with your spy and make the most of your asset while you can. Be patient with your spy, offer him support and sound advice. Keep him alive for a long as possible, he is your key to victory."]
	};
	case ( !isNil "ISPY" && { ISPY isEqualTo _player } ) : {
		["You Are The Russian Spy", "You are the Russian Spy (OPFOR). Use your secondary radio (the PRC-152) and set it (ACE Menu) to Channel 64 and cycle your Babel Language to Russian. Stealthly gain important intelligence on the moves of the Chechen Ammo Truck and relay that information to the Russian Communications Specialist. Be advised the PRC152 has a limited range and the risks of communicating with the Russian forces are high so pick your moments to communicate with your Russian contacts carefully. Stay quiet, stay inconspicuous and be clear with your intel. Remember to communicate to your Chechen squad on the PRC-343 and cycle your language BACK to Chechen before you do so. You don't want to get caught speaking Russian in front of your Chechen team mates. You're no good to the Armed Forces of the Russian Federation dead. If you haven't set your Babel key, once in game press: Escape > Configure > Controls > Configure Addons > ACRE 2 and set your Cycle Babel Language to a key you don't normally use (RIGHT WINDOWS KEY is recommended). Also when changing languages there can be a slight delay before you start speaking your second language so it is recommended you give it a couple of seconds before replying over the radio."]
	};
	default {
		nil
	};
};

//As long as we have found a record
if !( isNil "_record" ) then {
	//Add it to the diary
	_player createDiaryRecord[ "Diary", _record ];
};

//All medics get insignia MED1
//Otherwise they get their side insignia
_insignia = [ [ "RUS%1", "US%1", "INDI%1" ] select ( side _player call BIS_fnc_sideID ), "MED1" ] select ( _player getUnitTrait "Medic" );

//If the group they are in has the variable "secondary" set to true then set insigna as #side#2 else default to #side#1
_insignia = format[ _insignia, [ "1", "2" ] select ( group _player getVariable [ "secondary", false ] ) ];
//Apply insignia
[ _player, _insignia ] call BIS_fnc_setUnitInsignia;

//Add respawn event to reassign insignia on new unit
_player addEventHandler [ "respawn", {
	params[ "_player", "_corpse" ];

	//Remove copied variable
	_player setVariable [ "BIS_fnc_setUnitInsignia_class", nil ];
	//Get insignia from corpse
	_insignia = _corpse call BIS_fnc_getUnitInsignia;

	[ _player, _insignia ] call BIS_fnc_setUnitInsignia
}];

TEST_MISSION

  • Like 2

Share this post


Link to post
Share on other sites
4 hours ago, Larrow said:

That respawn event will not work as...

  1. _insignia is undefined within the events code
  2. the insignia used is stored on the player in the variable "BIS_fnc_setUnitInsignia_class", on respawn the variable space of the old unit is copied to the new unit, BIS_fnc_setUnitInsignia will not apply a new insignia if the variable already exists and its value is the same as that passed to the function

//All medics get insignia MED1
//Otherwise they get their side insignia
_insignia = [ [ "RUS%1", "US%1", "INDI%1" ] select ( side _player call BIS_fnc_sideID ), "MED1" ] select ( _player getUnitTrait "Medic" );

//If the group they are in has the variable "secondary" set to true then set insigna as #side#2 else default to #side#1
_insignia = format[ _insignia, [ "1", "2" ] select ( group _player getVariable [ "secondary", false ] ) ];
//Apply insignia
[ _player, _insignia ] call BIS_fnc_setUnitInsignia;

//Add respawn event to reassign insignia on new unit
_player addEventHandler [ "respawn", {
	params[ "_player", "_corpse" ];

	//Remove copied variable
	_player setVariable [ "BIS_fnc_setUnitInsignia_class", nil ];
	//Get insignia from corpse
	_insignia = _corpse call BIS_fnc_getUnitInsignia;

	[ _player, _insignia ] call BIS_fnc_setUnitInsignia
}];

TEST_MISSION

 

 

Awesome mate, thank you so much. I'll give it a try when I get home from work later today.

 

I did manage to get the Briefing working 100% on join and JIP and any situation I threw at it. through the initPlayerlocal.sqf similar to what you posted.

 

 

Now I'm a pretty big noob with scripting. But looking at the script above am I correct in saying that will only call the medic insignia for all medics?

If so fantastic.

 

As you no doubt saw in the mission description.ext file there are US1, US2, RUS1, RUS2, INDI1, INDI2 insignia's as well.

If possible I would like all player in Alpha Squad (for each side) to wear the 1 insignia and everyone in Bravo (for each side) to wear the 2 insignia.

 

For example everyone is Blufor in Punisher squad is to wear US1 except the medic who wears the medic insignia

everyone in OPFOR Tiger squad is to wear the RUS2 insignia except the medic who wears the medic insignia.

etc, etc.

I'm sure you get the idea.

 

It should also point out that the mission is Permadeath so no respawn upon death the players go to spectator mode. respawnOnStart = -1; which is do not respawn on start and do not run respawn script. Is this the correct settings I should have?

 

FYI the squad names with the desired insignia are:
BLUFOR

Punisher (US1 insignia) (I can give the units in this squad variable names B1-B5)

Predator (US2 insignia) (I can give the units in this squad variable names B6-B10)

 

OPFOR

Eagle (RUS1 insignia) (I can give the units in this squad variable names O1-O5)

Tiger (RUS2 insignai) (I can give the units in this squad variable names O6-O10)

 

Independent

Wolf (INDI1 insignia) (I can give the units in this squad variable names I1-I5)

Renegade (INDI2 insignia) (I can give the units in this squad variable names I6-I10)

 

6 medics (one in each squad) (MED1 insignia) (I can give the units in this squad variable names M1-M6)

 

Here is a more clear explanation.

 

Share this post


Link to post
Share on other sites
1 hour ago, rekkless said:

Now I'm a pretty big noob with scripting. But looking at the script above am I correct in saying that will only call the medic insignia for all medics?

Yes ALL player medics will receive the MED1 insignia.

 

1 hour ago, rekkless said:

If possible I would like all player in Alpha Squad (for each side) to wear the 1 insignia and everyone in Bravo (for each side) to wear the 2 insignia.

In Eden highlight all your Bravo squads (the group symbol not the units) and place...

this setVariable[ "secondary", true ];

...in the groups init box. The script in my previous post will assign all units in these groups the RUS/US/INDI version 2 insignias.

 

1 hour ago, rekkless said:

Is this the correct settings I should have?

I believe your description.ext was set up correctly for this. (not mine from the test mission as I needed to be able to respawn for testing purposes)

 

 

Share this post


Link to post
Share on other sites
39 minutes ago, Larrow said:

Yes ALL player medics will receive the MED1 insignia.

 

In Eden highlight all your Bravo squads (the group symbol not the units) and place...


this setVariable[ "secondary", true ];

...in the groups init box. The script in my previous post will assign all units in these groups the RUS/US/INDI version 2 insignias.

 

I believe your description.ext was set up correctly for this. (not mine from the test mission as I needed to be able to respawn for testing purposes)

 

 


ITS WORKS!!! On a dedicated server!!! JIP compatible and everything. My god you have no idea how happy I am. I have spent as long on this problem as I did building the whole damn mission. Thank you so much.

 

 

Now I just need to work out how to incorporate this into our mission framework for our CO-OP missions. 

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

×