Jump to content

[HOW-TO] Reskin/Retexture Vehicles


Brockie

Recommended Posts

Hey @theduke,

that's an interesting question.  I didn't know about the setFlagtexture command.

Firstly a bit of a typo in your code: setFalgTexture should be setFlagTexture.

Now, looking at the difference in syntax on the bohemia wiki first thing I notice is a difference in syntax between setObjectTexture and setFlagtexture.

syntax for setObjectTexture:

object setObjectTexture [selectionNumber,texture]

syntax for setFlagTexture:

flag setFlagTexture texture

Indeed it seems there is no 'selection number' when it come to flags.  This means you shouldn't need brackets around the path to the texture file.  Try this:

if (_class == "FlagCarrierWhite_EP1") then {
	_object setVehicleInit "this setFlagTexture ''graphics\flag.jpg''" 
};

This line of code might have syntax errors but it looks good to me right now.  

 

Next, when trying to decide between _class or _type it comes down to how the stock files were written.  Use the variable that is being called for creating the vehicle.  Examples:

Server_Monitor.sqf:

createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];

server_publishVehicle2.sqf, server_publishVehicle3.sqf

createVehicle [_class, [0,0,0], [], 0, "CAN_COLLIDE"];

It's just how it was written by the devs for whatever reason.

Next I'm going to share some of my novice understanding of the code.  Emphasis on being 'novice'.

 

if (_class == "FlagCarrierWhite_EP1") then {
	_object setVehicleInit "this setFlagTexture ''graphics\flag.jpg''" 
};

So in this line of code, I believe (though I could be totally wrong) _class only represents which type of object we are looking for.   If you have 10 of the same type of flag on the map it's looking at all of them.  Where _object I believe has a number associated with it to identify exactly which of those 10 flags is being updated each time.

The last thing I can think of right now is the difference between server_publishVehicle.sqf,  server_publishVehicle2.sqf, server_publishVehicle3.sqf, and server_monitor.sqf.   It is important to understand which file does what.  I wish I could explain this right now but I'm way too rusty.  server_monitor.sqf seems to be the likely candidate that deals with server startup so I would start there.  Make sure the flag is called from the database and not from editor.sqf that way the server_monitor.sqf should deal with it (I think).  if that doesn't work I next I would try publishVehicle3, and last I would try publishVehicle2.  I'm going to give this a try in my game and see if I can get it to work and I will report back.

Thanks for the question.

Link to comment
Share on other sites

Cheers, thx for the fast reply.  I will surely try what you mentioned.  As far as the understand of what file does what, thats what i lack lol

I used the gem crafting to place the flags, and once placed, the flag should change to its texture. or on restart it would be. Theoretically that is lol. but it never worked.

Juandayz helped me with this for a bit, and the closest i got, i would place the flag, the flag had the custom texture during the animation of the player. Once the animation was done, the flag returned to its original texture lol

Link to comment
Share on other sites

Hey @theduke,  I've got it working.

but before I reveal the code for re-texturing flags I just want to ask about your " mission sided file...  "skins.sqf... in the init.sqf ".  This should not be necessary from what I can tell.  Unless I am mistaken re-texturing should work for all clients, including ones that join later.  Is that from another texture script?  what is the purpose of that file?

anyway here it is for your sever_monitor.sqf:

  Reveal hidden contents

This will re-texture the flag for you on server startup but I don't have emerald designer or whatever gem mod you are using so I can't test building a flag dynamically.  But If you find that it's not working dynamically then I would recommend adding the line also to server_publishVehicle3.sqf (i think this is for dynamic object creating) or actually maybe server_publishObject2.sqf (I'm not sure) and just remember in those files you must change _type to _class.  

Link to comment
Share on other sites

  On 9/11/2016 at 6:40 PM, Brockie said:

Hey @theduke,  I've got it working.

but before I reveal the code for re-texturing flags I just want to ask about your " mission sided file...  "skins.sqf... in the init.sqf ".  This should not be necessary from what I can tell.  Unless I am mistaken re-texturing should work for all clients, including ones that join later.  Is that from another texture script?  what is the purpose of that file?

anyway here it is for your sever_monitor.sqf:

  Reveal hidden contents

This will re-texture the flag for you on server startup but I don't have emerald designer or whatever gem mod you are using so I can't test building a flag dynamically.  But If you find that it's not working dynamically then I would recommend adding the line also to server_publishVehicle3.sqf (i think this is for dynamic object creating) and just remember in those files you must change _type to _class.  

Expand  

I was never able to do it just server sided.  Maybe if i would of restarted the server, the skin would of been there. But the only way i was able to get it to work was by adding the suvskins.sqf mission sided.

This is what i have mission sided called by the init

suvskins.sqf

  Reveal hidden contents

and i have the 3 files server sided modified also.

So with you mentioning that it only appears on restart, maybe thats what the mission one does. (i could be wrong)

But it wouldnt work if spawned in with admin tool. Just bought through trader

I will give this a try thx

Link to comment
Share on other sites

  On 9/11/2016 at 6:50 PM, theduke said:

I was never able to do it just server sided.  Maybe if i would of restarted the server, the skin would of been there. But the only way i was able to get it to work was by adding the suvskins.sqf mission sided.

This is what i have mission sided called by the init

suvskins.sqf

  Reveal hidden contents

and i have the 3 files server sided modified also.

So with you mentioning that it only appears on restart, maybe thats what the mission one does. (i could be wrong)

But it wouldnt work if spawned in with admin tool. Just bought through trader

I will give this a try thx

Expand  

Indeed my edits will only handle server restart, buying a vehicle, stuff that's already in epoch (building a flag should work too)  but server_monitor.sqf is just for restarts.  Now that I think of it... the file for changing textures of building is player_build.sqf.

Admin tools is not part of epoch and those mods don't use epoch files for creating stuff, exact same goes for AI missions.  These mods use custom code for creating vehicles which is why the textures don't get applied immediately (but would take effect after a restart if the objects were persistant).  Did your skins.sqf solve the issue to texture admin spawned vehicles?  If not then it is redundant having that file.

What I would do is edit the actual admin tools that when it createVehicle it also setObjectTexture.  Same could be done with AI missions, by editing the missions code.

Link to comment
Share on other sites

Hey @theduke,

I don't have the gem mod but I do have extra right click actions, so I used that to play with building a flag and I was right,about player_build.sqf.

server_monitor.sqf will take care of texturing your flags each time you restart the server, and player_build.sqf will take care of immediately texturing objects as they are being built.  You don't need to edit any of the "publishVehicles" files and you shouldn't need the skins.sqf file either.  

so here is what I would do for player_build.sqf:  (I've added only one line here, but showing the whole block so you can see where to put it.)

 

// Start Build
		_tmpbuilt = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];

		_tmpbuilt setdir _dir;
	
		// Get position based on object
		_location = _position;

		if (_classname == "FlagCarrierWhite_EP1") then {_tmpbuilt setVehicleInit 'this setFlagTexture ''\ca\ca_e\data\flag_us_co.paa'';';};  // I added this line

		if((_isAllowedUnderGround == 0) && ((_location select 2) < 0)) then {
			_location set [2,0];
		};

 

and you need to add processInitCommands; near the end.  This shows where I would put it:

			};
			processInitCommands;   // I added this line
		} else { //if magazine was not removed, cancel publish

 

Once you've done this people will probably get kicked for BattlEye remoteexec restrictions when they build the flag. 

Here's what you will want to add to your remoteexec.txt:

!"setFlagTexture"

like this:

//new
5 "" !"setFlagTexture" (more script here that I'm not showing)

 

Link to comment
Share on other sites

  • 4 weeks later...

@theduke Need a little help.   Can someone show me their server_monitor.sqf for 1.0.6.1

so I can see where to put this. 

 Step 5. Again in your server_monitor.sqf find this:

	// # END SPAWN OBJECTS #

                   And below it put this:

	processInitCommands; 

My server_monitor does not have  // #END SPAWN OBJECTS #

Link to comment
Share on other sites

  On 8/10/2014 at 5:37 PM, 2sugars said:

Are you spawning it in via antihack admin or buying through traders?

 

& is your image 1024 by 1024 pixels?

Expand  

buying through traders and yes.

When I buy it comes in green and then is invisible. All you can see is glass and rems.

if i relog it show the skin and all is good.

 

Link to comment
Share on other sites

  On 4/10/2017 at 10:17 PM, Thug said:

@theduke Need a little help.   Can someone show me their server_monitor.sqf for 1.0.6.1

so I can see where to put this. 

 Step 5. Again in your server_monitor.sqf find this:

	// # END SPAWN OBJECTS #

                   And below it put this:

	processInitCommands; 

My server_monitor does not have  // #END SPAWN OBJECTS #

Expand  

I have it above

if (dayz_townGenerator) then {

Link to comment
Share on other sites

  • 8 months later...

I have one little problem. Suv skins scripr work allright. but I dont sell suv with skins at trader. epoch 1061

server_publishVehicle2.sqf

  Reveal hidden contents


server_publishVehicle3.sqf

  Reveal hidden contents

server_monitor.sqf

  Reveal hidden contents

 

Link to comment
Share on other sites

  On 12/16/2017 at 5:56 PM, Shelf74 said:

I have one little problem. Suv skins scripr work allright. but I dont sell suv with skins at trader. epoch 1061

server_publishVehicle2.sqf

  Reveal hidden contents


server_publishVehicle3.sqf

  Reveal hidden contents

server_monitor.sqf

  Reveal hidden contents

 

Expand  

Thats most likely because of he classname of the vehicle.

SUV_TK_CIV_EP1_DZE4  is the Upgraded version of the regular SUV which the classname would be SUV_TK_CIV_EP1_DZE. Notice the 4 is not there at the end.

You'll need to add those specific vehicles to your trader files.

Link to comment
Share on other sites

  On 12/17/2017 at 10:29 PM, theduke said:

Thats most likely because of he classname of the vehicle.

SUV_TK_CIV_EP1_DZE4  is the Upgraded version of the regular SUV which the classname would be SUV_TK_CIV_EP1_DZE. Notice the 4 is not there at the end.

You'll need to add those specific vehicles to your trader files.

Expand  

I dont think so.
config trader:
 

  Reveal hidden contents


 

 

Link to comment
Share on other sites

  On 12/20/2017 at 5:42 PM, Shelf74 said:

I dont think so.
config trader:
 

  Reveal hidden contents


 

 

Expand  

your trader files seem wrong. If im not mistaken. its "worth" not "coins".

Link to comment
Share on other sites

  On 12/20/2017 at 8:52 PM, theduke said:

your trader files seem wrong. If im not mistaken. its "worth" not "coins".

Expand  

i replase Coins to worth.
no resault, suv dont's selling. but i can buy suv's with skin.
and i can sell item if i choose: Sell from vichel

 

  Quote

[FIXED] Unable to sell upgraded _DZE[1-4] vehicle variants if their base vehicle class is removed from the trader configs

Expand  

where is this file - trader configs

Link to comment
Share on other sites

  On 12/22/2017 at 3:57 PM, Shelf74 said:

i replase Coins to worth.
no resault, suv dont's selling. but i can buy suv's with skin.
and i can sell item if i choose: Sell from vichel

 

where is this file - trader configs

Expand  

this means the base class of the vehicle must be in the trader files also. I would assume they are as they are there as default. unless you removed them.

 

SUV_Green_DZE4 < Fully upgraded

SUV_Green_DZE < Base Class

Link to comment
Share on other sites

  On 12/22/2017 at 8:42 PM, theduke said:

this means the base class of the vehicle must be in the trader files also. I would assume they are as they are there as default. unless you removed them.

 

SUV_Green_DZE4 < Fully upgraded

SUV_Green_DZE < Base Class

Expand  
  Reveal hidden contents

dont working (((

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...