setObjectTextureGlobal – Talk
Misleading notes from main page
- Posted on November 27, 2016 - 21:12 (UTC)
- Pierre MGI
- This command is not really JIP compatible. On Hosted server:
this setObjectTextureGlobal [0,"mypaafile.paa"]; // fails. The texture disappears and a warning message: //Cannot load texture mpmissions\__cur_mp.yourWorld\mypaafile.paa.is displayed. if (isServer) then {this setObjectTextureGlobal [0,"mypaafile.paa"]}; // only works on (hosted) server
At this time (Arma III v 1.64), it's preferable to remote the local command in the init field of the object:if (isServer) then {[this,[0,"mypaafile.paa"]] remoteExec ["setObjectTexture",0,true]}; // works for hosted server and JIP clients
Let me explain where you gone wrong.
- You never ever ever ever ever ever put a global command into init field and then try to make it work in Multiplayer. Init filed is executed for every joining player, therefore your global command will be multiplied millions of times and no surprise it will fail eventually. This is why you have local commands for that.
- There is one exception when you can use global command in init field, you need to make sure it is executed only once, ONLY once. How do you do this? Like this:
if (local this) then {this setObjectTextureGlobal [0,"mypaafile.paa"]};
- There is no need for remote execution of local command, when you can put local command into init field and it will do EXACTLY this, execute it everywhere and for JIP too.
Hope I explained it well Killzone_Kid (talk) 00:58, 28 November 2016 (CET)
Thanks for your answer.
In fact, i realize the difference between "isServer", often mentioned in notes, and "local".
As you know, the simple command setObjectTexture in the init field, fails because the path is not the same on hosted server and clients.
So, I imagined the global version does a miracle on its own but, due to the repeated occurrences, paths fail without the local condition.
The remote code from server only works as intended. So,
if (isServer) then {[this,[0,"mypaafile.paa"]] remoteExec ["setObjectTexture",0,true] };
or
if (local this) then {this setObjectTextureGlobal [0,"mypaafile.paa"]};
is probably almost the same. (initialization phase of the objects, JIP queue, I can't make the difference).
Thanks again for having taken time to point me at the good use of a global command in init field.Such globality appears to me useless, and furthermore leads to extra difficulty with a such specific parameter as a path of a file! BI themselves have some trouble with that. I refer to bis_fnc_setUnitInsignia or the specific "texture" field added for the sign, blank, "userTexture_1m_F" (as example in Arma vanilla).Pierre MGI 08:25, 28 November 2016 (UTC)