Jump to content
madrussian

setFlagTexture issues

Recommended Posts

 

Hello, could use some quick help with an error I'm getting.

 

On a hosted server, I apply a custom texture to a flag via setFlagTexture, like this:

_flag setFlagTexture "Misc\Images\JapaneseNavyFlag.paa";

So far, so good.  Everything works correctly on the server machine.  I see the flag texture, etc.

 

But on the clients, end up seeing an empty flagpole and get this error:

Quote

Cannot load texture c:\users\%my_username%\documents\arma 3\mpmissions\%my_mission%.chernarus_summer\misc\images\japanesenavyflag.paa.

 

I checked and my picture file is good, 256x256 pixels, etc, and works just fine on server so it's really a file path issue.

 

Anyway here's the thing:

 

I'm getting this error running my mission from the editor.  If I pack mission into a PBO and run that way, the error disappears, and the clients all see the correct flag texture.

 

So one workaround could be to always pack and run from a PBO.  Unfortunately, I really need to be able to work from the editor.  I've been tinkering with sqs/sqf since the days of OFP and run into plenty of annoying things, but never anything that forces me to export to a PBO constantly.  There must be a way to get around this!  Now I'm thinking outside the box.

 

Thinking back, I had a similar (exact?) issue with setting the picture of listbox items via lbSetPicture (and later retrieving that picture via lbPicture).  On the server the picture was showing up just fine, but all the clients were getting that exact same error ("Cannot load texture" with server machine's username in the file path).  After some digging, I learned that lbSetPicture accepts a simple file path from your mission folder (like "Options\Images\JapaneseArmyFlag.paa"), but then lbPicture returns the entire local file path (in this case "c:\users\%my_username%\documents\arma 3\mpmissions\%my_mission%.chernarus_summer\options\images\japanesearmyflag.paa).  The solution in that case was to strip out the root part of the file path before broadcasting over to the clients, like this:

_missionRoot = BUB_MissionRoot;
if ((_pic find (toLower _missionRoot)) == 0) then {
	_pic = _pic select [count _missionRoot, (count _pic) - (count _missionRoot)];
};

For listboxes, this worked because lbSetPicture is an "Effect Local" command (meaning it's effects are NOT broadcast to all machines).

 

Taking a closer look at setFlagTexture, I confirm it is indeed "Effect Global", meaning it's effects ARE broadcast to all machines.  Sounds like I need an "Effect Local" version of this command.  I look and the closest thing I can find is setObjectTexture which is "Effect Local" (great!), but unfortunately this just sets the texture of the... flagpole.:face_palm:

 

Now I'm stumped.  So here's my question:

 

Anyone know a way to set the flag texture and do so locally?  (in contrast with setFlagTexture which has global effect)

 

Or any other way to avoid that pathing error message (without resorting to packing mission to PBO again and again, ad nauseam)?

 

Btw- I welcome any and all ideas, even simple things I may have missed.  Thanks! :smile_o:

 

Share this post


Link to post
Share on other sites

Don't run it from the editor. Save the mission, exit back out to the main menu and host a server.

  • Like 1

Share this post


Link to post
Share on other sites
10 hours ago, beno_83au said:

Don't run it from the editor. Save the mission, exit back out to the main menu and host a server.

 

Thanks for the reply.  If I simply save the mission in editor, exit back out to the main menu and host a server as you suggest (selecting my mission listed in green from the server browser), I get the same error & no flag on pole on the clients.

 

In contrast, if inside editor (SP or MP) I select Scenario -> Export, a PBO of my mission gets created in "Arma 3\MPMissions" folder.  If I then exit editor, go to MP browser, and select this PBOed version of my mission (same mission name but white text), everything works.  No error, flag on the pole with correct texture for all clients.

 

It all comes down to mission root.  Here's my mission root function:

BUB_MissionRoot = str missionConfigFile select [0, count str missionConfigFile - 15];
  • When HS is run from MP editor (which is the same as opening MP Browser and starting mission listed in green), mission root is the local directory to your mission: "C:\Users\%profile%\Documents\Arma 3\mpmissions\%mission_name.map%\"
  • When HS is running PBO version of the mission (the one in white), mission root is: "mpmissions\__cur_mp.%map%\"

So it turns out setFlagTexture works fine on HS when mission root is "mpmissions\__cur_mp.%map%" (as run from PBO).  But this command blows up on the clients when mission root is "C:\Users\%profile%\Documents\Arma 3\mpmissions\%mission_name.map%\" (as run from editor)

 

To me, the solution is not to "export to PBO every time", but rather to fix the buggy setFlagTexture command or otherwise find a real workaround.


For now in my dynamic mission, I'm having to resort to detecting whether mission was run via PBO vs non-PBO, and if non-PBO then I exclude FOW's Imperial Japan as a faction selection, as I had to made custom flag texture for them (which doesn't work when run as non-PBO due to buggy setFlagTexture).  Gotta love sqf in all it's glory.

 

Anyhow, anyone know a way to set flag texture locally?  That would totally do the trick.

 

Share this post


Link to post
Share on other sites

@madrussian Would this function help you get the mission root?

 

getMissionPath = 
{

_astr = str getMissionConfig "author";

_remove = "mission.sqm/ScenarioData/author";
if(_astr find "description.ext" >= 0) then
{
_remove = "description.ext/author";
};

_ret = _astr select [0, count _astr - (count _remove) ];

_ret
};

 

Share this post


Link to post
Share on other sites
3 hours ago, madrussian said:

In contrast, if inside editor (SP or MP) I select Scenario -> Export, a PBO of my mission gets created in "Arma 3\MPMissions" folder.  If I then exit editor, go to MP browser, and select this PBOed version of my mission (same mission name but white text), everything works.  No error, flag on the pole with correct texture for all clients. 

 

 

Sorry mate, that is what i meant by saving. This is how you should be doing it. As far as i know, and I'm sure someone could explain it better, when you run it from the editor it creates a temporary mission file that looks for links (with things like pictures) in the documents/arma 3/missions folder. So, when another client looks for those files on their computer they don't exist. 

 

The same thing happens to me when i test stuff across my LAN and I'll do one of two things. I'll either ignore it because i know why it's happening, or i create the correct folder path on the other PC and copy the file into it. 

Share this post


Link to post
Share on other sites
5 hours ago, madrussian said:

 

Thanks for the reply.  If I simply save the mission in editor, exit back out to the main menu and host a server as you suggest (selecting my mission listed in green from the server browser), I get the same error & no flagpole on the clients.

 

In contrast, if inside editor (SP or MP) I select Scenario -> Export, a PBO of my mission gets created in "Arma 3\MPMissions" folder.  If I then exit editor, go to MP browser, and select this PBOed version of my mission (same mission name but white text), everything works.  No error, flag on the pole with correct texture for all clients.

 

It all comes down to mission root.  Here's my mission root function:


BUB_MissionRoot = str missionConfigFile select [0, count str missionConfigFile - 15];
  • When HS is run from MP editor (which is the same as opening MP Browser and starting mission listed in green), mission root is the local directory to your mission: "C:\Users\%profile%\Documents\Arma 3\mpmissions\%mission_name.map%\"
  • When HS is running PBO version of the mission (the one in white), mission root is: "mpmissions\__cur_mp.%map%\"

So it turns out setFlagTexture works fine on HS when mission root is "mpmissions\__cur_mp.%map%" (as run from PBO).  But this command blows up on the clients when mission root is "C:\Users\%profile%\Documents\Arma 3\mpmissions\%mission_name.map%\" (as run from editor)

 

To me, the solution is not to "export to PBO every time", but rather to fix the buggy setFlagTexture command or otherwise find a real workaround.


For now in my dynamic mission, I'm having to resort to detecting whether mission was run via PBO vs non-PBO, and if non-PBO then I exclude FOW's Imperial Japan as a faction selection, as I had to made custom flag texture for them (which doesn't work when run as non-PBO due to buggy setFlagTexture).  Gotta love sqf in all it's glory.

 

Anyhow, anyone know a way to set flag texture locally?  That would totally do the trick.

 

 

That's an old problem for any custom flag or insignia texture and BI didn't make a clear tuto on that. Pboed missions and addons (config.cpp) are OK. Non pboed scenario and description.ext > NOK.

  • Like 1

Share this post


Link to post
Share on other sites

 

16 hours ago, gc8 said:

@madrussian Would this function help you get the mission root?


getMissionPath = 
{

_astr = str getMissionConfig "author";

_remove = "mission.sqm/ScenarioData/author";
if(_astr find "description.ext" >= 0) then
{
_remove = "description.ext/author";
};

_ret = _astr select [0, count _astr - (count _remove) ];

_ret
};

 

 

I tried your mission root function with mine side by side in test mission (running within non-PBO and PBO both) and apparently our methods are functionally equivalent, returning identical results. :smile_o:

 

15 hours ago, beno_83au said:

As far as i know, and I'm sure someone could explain it better, when you run it from the editor it creates a temporary mission file that looks for links (with things like pictures) in the documents/arma 3/missions folder. So, when another client looks for those files on their computer they don't exist. 

 

10 hours ago, pierremgi said:

That's an old problem for any custom flag or insignia texture and BI didn't make a clear tuto on that. Pboed missions and addons (config.cpp) are OK. Non pboed scenario and description.ext > NOK.

 

Good explanations guys, and good to know I'm not the only one having this issue.

 

16 hours ago, beno_83au said:

I'll either ignore it because i know why it's happening, or i create the correct folder path on the other PC and copy the file into it. 

Lol, sounds like at least once you resorted to creating a fake user folder on your 2nd PC. :wine:

 

I suppose I have an OK workaround in my mission, to simply detect whether PBO vs non-PBO running, and accordingly exclude subfactions where I have applied custom textures.  In this case I only have to exclude 1 out of perhaps 30-100 subfactions depending on how many mods are loaded.  I expect this probably causes big headaches for people using even a handful of custom textures.

 

Anyhow if we are indeed stuck with this pathing issue, imo all of the affected commands (including setFlagTexture) should at least get a local version, so we may work around it properly.

Share this post


Link to post
Share on other sites

To make it short, this command doesn't work as intended with custom texture:

 

Tested with:

if (isServer) then {this setFlagTexture "drapeau_francais_mirroir.paa"};  // no sub-folder,

 

- working fine on server (hosted), always but insufficient!;

>> not working on MP preview client (path problem even if the texture is in mission's root due to unpbo'ed files);

- working in MP exported (pbo'ed) mission, for eveyone (JIP compatible);

>> not working for Steam subscribed mission (orange text MP mission in MP menu), even if clients have also subscribed to the mission.

 

:shoot:

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

×