setObjectTextureGlobal – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search
m (One of the remoteExec'ed commands was given an example of "setObjectTexture, missing the closing ".)
m (Text replacement - "Killzone Kid" to "Killzone_Kid")
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Misleading notes from main page ==
== Misleading notes from main page ==


<!-- CONTINUE Notes -->
<dl class="command_description">
<dl class="command_description">
<dt></dt>
<dd class="notedate">Posted on November 27, 2016 - 21:12 (UTC)</dd>
<dd class="notedate">Posted on November 27, 2016 - 21:12 (UTC)</dd>
<dt class="note">[[User:Pierre MGI|Pierre MGI]]</dt>
<dt class="note">[[User:Pierre MGI|Pierre MGI]]</dt>
<dd class="note">This command is not really JIP compatible. On Hosted server:
<dd class="note">This command is not really JIP compatible. On Hosted server:
<code>this setObjectTextureGlobal [0,"mypaafile.paa"]; // fails. The texture disappears and a warning message:
<code style="display: block">this setObjectTextureGlobal [0,"mypaafile.paa"]; // fails. The texture disappears and a warning message:
//Cannot load texture mpmissions\__cur_mp.yourWorld\mypaafile.paa.is displayed.
//Cannot load texture mpmissions\__cur_mp.yourWorld\mypaafile.paa.is displayed.
if (isServer) then {this setObjectTextureGlobal [0,"mypaafile.paa"]}; // only works on (hosted) server
if (isServer) then {this setObjectTextureGlobal [0,"mypaafile.paa"]}; // only works on (hosted) server
</code>
</code>
At this time (Arma III v 1.64), it's preferable to remote the local command in the init field of the object:
At this time (Arma III v 1.64), it's preferable to remote the local command in the init field of the object:
<code>if (isServer) then {[this,[0,"mypaafile.paa"]] remoteExec ["setObjectTexture",0,true]};
<code style="display: block">if (isServer) then {[this,[0,"mypaafile.paa"]] remoteExec ["setObjectTexture",0,true]};
  // works for hosted server and JIP clients</code>
  // works for hosted server and JIP clients</code>
</dd>
</dd>
</dl>
</dl>
<!-- DISCONTINUE Notes -->
Let me explain where you gone wrong.
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.  
* 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:
* 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:
<code>[[if]] ([[local]] this) [[then]] {this [[setObjectTextureGlobal]] [0,"mypaafile.paa"]};</code>
<code style="display: block">[[if]] ([[local]] this) [[then]] {this [[setObjectTextureGlobal]] [0,"mypaafile.paa"]};</code>
* 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.
* 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 [[User:Killzone Kid|Killzone Kid]] ([[User talk:Killzone Kid|talk]]) 00:58, 28 November 2016 (CET)
Hope I explained it well [[User:Killzone_Kid|Killzone_Kid]] ([[User talk:Killzone_Kid|talk]]) 00:58, 28 November 2016 (CET)




<!-- CONTINUE Notes -->
Thanks for your answer.
Thanks for your answer.
In fact, i realize the difference between "isServer", often mentioned in notes, and "local".
In fact, i realize the difference between "isServer", often mentioned in notes, and "local".
Line 30: Line 28:
So, I imagined the global version does a miracle on its own but, due to the repeated occurrences, paths fail without the local condition.
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,
The remote code from server only works as intended. So,
<code>[[if]] ([[isServer]]) [[then]] {[this,[0,"mypaafile.paa"]] [[remoteExec]] ["setObjectTexture",0,true] };</code>
<code style="display: block">[[if]] ([[isServer]]) [[then]] {[this,[0,"mypaafile.paa"]] [[remoteExec]] ["setObjectTexture",0,true] };</code>
or  
or  
<code>[[if]] ([[local]] this) [[then]] {this [[setObjectTextureGlobal]] [0,"mypaafile.paa"]};</code>
<code style="display: block">[[if]] ([[local]] this) [[then]] {this [[setObjectTextureGlobal]] [0,"mypaafile.paa"]};</code>
is probably almost the same. (initialization phase of the objects, JIP queue, I can't make the difference).
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).[[User:Pierre MGI|Pierre MGI]]  08:25, 28 November 2016 (UTC)
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).[[User:Pierre MGI|Pierre MGI]]  08:25, 28 November 2016 (UTC)
<!-- DISCONTINUE Notes -->

Latest revision as of 14:48, 12 March 2024

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)