Jump to content
Sign in to follow this  
roguetrooper

How to "random setObjectTexture" ?

Recommended Posts

Is it possible to implement randomization in "setObjectTexture"?

Something like:

 


_color = [random 1,random 1, random 1, 1];

_object setObjectTexture [0,'#(argb,8,8,3)color( _color )'];

 

Please note that I am NOT looking for someting like:


_ran = round (random 3)

if (ran == 0) then { _object setObjectTexture [0,'#(argb,8,8,3)color(1,0,0,1)'];

if (ran == 1) then { _object setObjectTexture [0,'#(argb,8,8,3)color(1,1,0,1)'];

etc.

Share this post


Link to post
Share on other sites

My method:

_object setObjectTexture [0,"#(argb,8,8,3)color("+str random 1 + "," + str random 1 + "," + str random 1+",1)"] ;

 

Share this post


Link to post
Share on other sites
[_object, [0, format["#(argb,8,8,3)color(%1,%2,%3,1)", random 1, random 1, random 1]]] remoteExec ["setObjectTexture",0 , netId _object];

This should set the same color for everyone to see.

Share this post


Link to post
Share on other sites

Thank you both for your help. I just didn't think of the argument to be a string ^^

 

@Tajin: wouldn't "setobjecttextureGlobal" do the same concerning multiplayer accordance? At least a community statement says "The effect is persistent and will be synchronized for players who join in progress".

Share this post


Link to post
Share on other sites
31 minutes ago, roguetrooper said:

Thank you both for your help. I just didn't think of the argument to be a string ^^

 

@Tajin: wouldn't "setobjecttextureGlobal" do the same concerning multiplayer accordance? At least a community statement says "The effect is persistent and will be synchronized for players who join in progress".

Yes, no need to use remoteExec with setObjectTexture since there is global version for it.

Share this post


Link to post
Share on other sites

Right, I forgot about that one. ^^

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
Sign in to follow this  

×