Jump to content
Captain Apple

Force vehicle color global

Recommended Posts

I'm trying to make the SUVs (which are spawned in already after server start) to be black on global, not client only.
i know the command is "setObjectTextureGlobal" but i dont know how to use it. Could anyone help me make the SUV color black?
Cheers
 

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/setObjectTextureGlobal

_suv setObjectMaterialGlobal [0, "\a3\data_f\default.rvmat"];
_suv setObjectTextureGlobal [0, "#(rgb,8,8,3)color(0,0,0,1)"];

Depending upon how you are spawning them, of course. I have used "_suv" as a placeholder.

 

The color is defined by the "...color(0,0,0,1)" section. The first three numbers are RGB values, and the fourth is alpha: "...color(Red,Green,Blue,Alpha)". If you wanted something full red, it would be "...color(1,0,0,1)". If you wanted something dark green, it would be along the lines of "...color(0,0.3,0,1)".

Share this post


Link to post
Share on other sites
Just now, Harzach said:

https://community.bistudio.com/wiki/setObjectTextureGlobal


_suv setObjectMaterialGlobal [0, "\a3\data_f\default.rvmat"];
_suv setObjectTextureGlobal [0, "#(rgb,8,8,3)color(0,0,0,1)"];

Depending upon how you are spawning them, of course. I have used "_suv" as a placeholder.

could it just be "this"?

Share this post


Link to post
Share on other sites

Yes, if in Editor object init.

  • Like 1

Share this post


Link to post
Share on other sites

Again, it depends on how you are spawning them.

Share this post


Link to post
Share on other sites

now if i already have this:
0 = [
 this,
 30,
 false,
 {},
 100,
 500,
 -1,
 true
] call QS_fnc_registerVehicle;

in the init, how would i combine it with the suv thing?

Share this post


Link to post
Share on other sites

The semicolon at the end of your code defines the end of it and separates it from any following code.

https://community.bistudio.com/wiki/SQF_syntax

0 = [this,30,false,{},100,500,-1,true] call QS_fnc_registerVehicle;
this setObjectMaterialGlobal [0, "\a3\data_f\default.rvmat"];
this setObjectTextureGlobal [0, "#(rgb,8,8,3)color(0,0,0,1)"];

 

Share this post


Link to post
Share on other sites

BTW, using this method, we are "painting over" the default texture with plain flat color, which tends to look unnatural. If you want to use the default black texture that is available to the SUV, maybe try this instead:

this setVariable ["color", 1];

If you want to use the other default textures, just change the second element.

0 = red

1 = black

2 = grey

3 = orange

Share this post


Link to post
Share on other sites

Not working in MP, or at all?

Maybe this:

_null = this spawn {_this setObjectTextureGlobal [0, "\A3\Soft_F_Gamma\SUV_01\Data\SUV_01_ext_02_CO.paa"];};

I am without a dedi server for a while so I can't do any MP testing. Sorry!

Share this post


Link to post
Share on other sites

If you're running that code right after spawning the vehicle in it'll most likely be overwritten by the randomizer (civilian vehicles and some other things will get a random camo after spawning in).  In single player this will happen near instantly, before your command to change the color has been run.  In a dedi server it could be that the randomization happens after your command has already been executed.  What you could do is spawn the code as above but with half a second of sleep.  That or turning of the randomization, sleeping is easier.

So:

_null = this spawn {sleep 0.5; _this setObjectTextureGlobal [0, "\A3\Soft_F_Gamma\SUV_01\Data\SUV_01_ext_02_CO.paa"];};

(I didn't test so no guarantees)

 

If you're not running this code right after spawning the vehicle in ignore everything I said :)

Share this post


Link to post
Share on other sites

I think he's adding it to each unit's init in the editor?

 

On 4/9/2018 at 1:43 PM, Captain Apple said:

yeah im doing it in the init

 

So I'm confuzzled. I know I've banged my head up against setObjectTextureGlobal before, maybe its utilization is still beyond my understanding.

Share this post


Link to post
Share on other sites

yeah im putting it in SUVs init in the editor.
No luck again with _null = this spawn {sleep 0.5; _this setObjectTextureGlobal [0, "\A3\Soft_F_Gamma\SUV_01\Data\SUV_01_ext_02_CO.paa"];};

Share this post


Link to post
Share on other sites

Again, not working in MP, or not working at all?

Share this post


Link to post
Share on other sites

im only testing in MP cuz i need it only in MP. Also the mission file wont work on SP, its mean for mp.

Share this post


Link to post
Share on other sites

Right I just went into the editor, put down a unit, an SUV and pasted this in the int-field of the suv:
this setObjectTextureGlobal [0, "\A3\Soft_F_Gamma\SUV_01\Data\SUV_01_ext_02_CO.paa"];

The SUV was black when I played the mission as multiplayer.   (I also packed it into a PBO, booted up my dedi server and put the PBO on there, the SUV was black)

 

Are you trying to do this in an existing mission?  If you're editing an existing mission, which one is it?

Share this post


Link to post
Share on other sites

worked, had to implement it in a sqf file, invade & annex framework.. It was overriding everything done in editor.

  • Like 1

Share this post


Link to post
Share on other sites

just to clarify: 

"this" (without underscore) , is an editor only thing. So inside triggers, init boxes, etc it exists / is defined.

whenever you're making an SQF script you may see: _this , which will either be the parameters passed to the script, or depending on what you're using it may be a special variable for something.

  • Like 1

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

×