Jump to content

Retexture Vehicles server-side!


mark88

Recommended Posts

I didnt see this on alot of servers .. so a little bump for thoose who want it and dont know about it yet!

 

33y8bgye.png

 

It is terrible easy :)

I do not take any credits or anything.

 

init.sqf - add at the very bottom:

_nul = [] execVM "custom\skins\suvskins.sqf";

Then create a new file called suvskins.sqf and paste the following into it:

if (isServer) exitwith {};
waitUntil {sleep 1; count vehicles > 1};
sleep 1;
{
    If (typeOf _x in ["SUV_Pink"]) then //use any SUV class to overwrite
    {
        nul = _x setObjectTexture [0,"custom\skins\yourskin.paa"] //can also be jpg
    };
} forEach (vehicles);

Players joining the server will then see already spawned vehicles with the skin from above.

What does currently not work: You can not change skins "on the fly". For example bought vehicles from traders will still appear with the default skin (in this example SUV_Pink).

 

If anyone have a fix for this, i will update the above code with it.

 

Link to comment
Share on other sites

if (isServer) exitwith {};
waitUntil {sleep 1; count vehicles > 1};
sleep 1;
{
    If (typeOf _x in ["SUV_Pink"]) then //pink
    {
        nul = _x setObjectTexture [0,"custom\skins\pinksuv.paa"] //can also be jpg
    };
    If (typeOf _x in ["SUV_Orange"]) then //orange
    {
        nul = _x setObjectTexture [0,"custom\skins\orangesuv.paa"] //can also be jpg
    };
    If (typeOf _x in ["SUV_Red"]) then //red
    {
        nul = _x setObjectTexture [0,"custom\skins\redsuv.paa"] //can also be jpg
    };

} forEach (vehicles);

Or you can use case ...

Link to comment
Share on other sites

Here's the way to do it according to vbawol:

 

 

 

Sniped link per report, BTW, This is not anything new I just helped someone on our Teamspeak the other day with the same exact functions.

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

combined with:
https://community.bistudio.com/wiki/setVehicleInit

and 
https://community.bistudio.com/wiki/processInitCommands

 

Will give you JIP compatible texture replacements if the vehicle is setup for it.
 

Add this on line https://github.com/vbawol/DayZ-Epoch/blob/master/SQF/dayz_server/system/server_monitor.sqf#L126 change the ANYCLASS to your vehicle class and the texture path to that of a paa file in your mission pbo.

if (_type == "ANYCLASS") then {_object setVehicleInit "this setObjectTexture [0, "\pboname\texture.paa"];"};

Also add 

processInitCommands;

 

here: https://github.com/vbawol/DayZ-Epoch/blob/master/SQF/dayz_server/system/server_monitor.sqf#L261

 

 

and actually his line of code is missing a semi colon after the quotation at the end.  I believe it should look like this:

if (_type == "ANYCLASS") then {_object setVehicleInit "this setObjectTexture [0, "\pboname\texture.paa"];";};

heres mine:

if (_type == "SUV_TK_CIV_EP1") then {_object setVehicleInit 'this setObjectTexture [0, ''custom\SUV.jpg''];';}; 

and dont forget

 

 

and on a side note there is a way to do it on the fly but I can't remember exactly how atm but I will post it later if I can remember how to make it work.

Link to comment
Share on other sites

Both doesnt work as far i could test. Also the "global" doesnt make any difference.

If i buy a suv = still pink. If i spawn one with IS = still pink.

 

After a relog; both = with my custom skin.

 

@xBowBii

A howto would be really nice.

 

Sadly epoch is extremely slow with new skins/variants, so we must do something to fresh up the whole stuff :)

Link to comment
Share on other sites

Both doesnt work as far i could test. Also the "global" doesnt make any difference.

If i buy a suv = still pink. If i spawn one with IS = still pink.

 

After a relog; both = with my custom skin.

 

@xBowBii

A howto would be really nice.

 

Sadly epoch is extremely slow with new skins/variants, so we must do something to fresh up the whole stuff :)

As well as the server_monitor, you also need to set the texture in publishVehicle using the setVehicleInit and processInitCommands method.

Link to comment
Share on other sites

Would need someone with proper experience to do so, i didnt dig that far yet.

In theory, would this also work with player skins? Would love to re-texture some male skins as female ones for our female players :)

And also another stupid question .. I saw that the latest epoch files (1.0.5.1) contain gui elements (such as gear popup) from the actual dayz code - is it possible to use it? Good question next question - to overwrite it in the mission?

 

Im hungry for the change :wub:

Link to comment
Share on other sites

 

But there's one problem.. Lagg.

 

 

Indeed.  As I said before there is a way to do it on the fly.  I've even got it working on my test server but like xBowBii said it introduces my old problem which is when the server restarts its taking an abnormal ammount of time to start the server.

 

I'm working on refinement to fix this issue and then I will post what I've got.

Link to comment
Share on other sites

I thank both of you for your help, you might wanna start a new thread then with some explanation :)

An endless loop in the mission also didnt work for me by the way .. no idea why, because it "should" work.

 

Thats why im even more grateful if one of you comes up with this :D

Link to comment
Share on other sites

I thank both of you for your help, you might wanna start a new thread then with some explanation :)

An endless loop in the mission also didnt work for me by the way .. no idea why, because it "should" work.

 

Thats why im even more grateful if one of you comes up with this :D

 

Here it is: 

Link to comment
Share on other sites

  • 1 month later...

Just a quick note, He states this is server sided

 

THIS IS CLIENT sided xD

 

you can even see that in the code ^^

if (isServer) exitwith {};

If the server runs it xp it stops the script from executing ^^

 

Every client (player) runs this when he logs in.

 

If someone buys a vehicle it will not be retextured eatther until he relogs.

 

as stated.

 

Use the topic given by the other users for server sided retexturing

Link to comment
Share on other sites

Using this method, would it be possible to use more than one skin for a certain vehicle? I notice that some vehicles have more than one paa file to include the whole vehicle.

 

Alot of vehicles use multiple textures.

 

The number states which area is retextured.

 

This differes from vehicle to vehicle

_vehicle setObjectTexture [0, _texture ];
_vehicle setObjectTexture [1, _texture ];
_vehicle setObjectTexture [2, _texture ];
Link to comment
Share on other sites

Ok, one more question about this. Zupa, you were right and it worked great but now I need to know is there anywhere else you can put the code in the sqf besides the very end and it still work? The reason I ask is my DZE godmode base = true code only seems to work at the very end of the file but when I move the skin script up one line it quits working also.

Link to comment
Share on other sites

Ok, one more question about this. Zupa, you were right and it worked great but now I need to know is there anywhere else you can put the code in the sqf besides the very end and it still work? The reason I ask is my DZE godmode base = true code only seems to work at the very end of the file but when I move the skin script up one line it quits working also.

 

DZE godmode base = true 

 

This should always work, and needs to be defined in config section of your  init.sqf

 

There is only 1 flaw with this.

 

Objects are indestructable AFTER the next restart from when they are placed. ( Thats probably the thing you dont know).

Link to comment
Share on other sites

Correct me if someone already tested it but:

You CAN do it on the fly. Using setObjectTextureGLOBAL. //Edit: no, wrong. you cant do it on the fly using etObjTextGLOBAL, but the ways described under ;)

 

But there's one problem.. Lagg.

 

How I'd rather do it:

using RE doing it locally for each player.

 

How? This is a fast script and WILL NOT WORK. I'm just writing how I could imagine I could do it.

Fnc_ColorPinkSUVs = [
{
vehicle setObjectTexture [0,'xxxxx.paa'];
} forEach 'SUV_Pink';
];
[fnc_colorpinkSuvs] call RE;

^ THis would of course not work, I don't have the time to make it, and anyways I can't test it since I'm on holiday.

When I'll get some time I'll write it the correct way, and if someone wants to test it then that would be cool.

 

Another way to do it:

while {1 == 1} do [
{
vehicle setObjectTexture(Global?) [0,'xxxxx.paa'];
} forEach 'SUV_Pink';
sleep 1;
]; 

By using that second way, bough pink suvs will be the texture you want directly after buying.. why? because each second we set the object texture for pink suvs to XXXX.paa

 

If someone's interested just say it i'll try to make the script

 

xBowBii

 

to clarify on

 

"setObjectTextureGlobal"

 

This functionality only exists in Arma3

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...