Jump to content
MajorBlunderbuss

Spawn vehicle with hidden selection texture - SetObjectTexture - Help appreciated

Recommended Posts

Hello friends!

 

A couple of days ago I've ran into some trouble I couldn't solve myself, and I found help here very fast.

Right now, I'm at the point where I'm unable to find a solution for some sort of problem, again.

 

What I'm trying to achive, is to spawn a vehicle - the AWC 302 Nyx (Wiesel), to be exactly - with alternate, official texture. The Nyx features the standard AAF-Camo, and alternatively an simple Olive-Camo.

Since I'm making a own verison of DUWS - many of you will know what this is -, you will also know how those vehicles do spawn: Go to the headquarters, talk to the officer, choose the vehicle, spend the credits, and the vehicle will spawn outside of the HQ.

 

Heres a little insight of how I try to spawn this vehicle with the alternate Olive-Camo:

 

    case 18:
    {
          if (commandpointsblu1 >= 28) then
          {
           hint "Vehicle ready !";
           commandpointsblu1 = commandpointsblu1 - 28;
           ctrlSetText [1000, format["%1",commandpointsblu1]];
           _vehic = "I_LT_01_AA_F" createVehicle _spawnPos;
		   _vehic setObjectTexture [0,"Indep_Olive"];
		   _vehic setObjectTexture [1,"Indep_Olive"];
		   _vehic setObjectTexture [2,"Indep_Olive"];
		   _vehic animate ["showTools", 1];
		   _vehic animate ["showCamonetHull", 1];
		   _vehic animate ["showBags", 1];
		   _vehic animate ["showSLATHull", 0];
          }
          else
          {
          hint "Not enough command points";
          };
    };

 

If I do place the vehicle in 3den-Editor, change it's visuals like the camo, SLAT-Armour, camonet etc., and then export it, copy paste it somewhere, the Olive-Camo is defined as "Indep_Olive", like above.

 

Exported stuff looks like this:

 

_veh = createVehicle ["I_LT_01_AA_F",position player,[],0,"NONE"];
[
	_veh,
	["Indep_Olive",1], 
	["showTools",1,"showCamonetHull",1,"showBags",1,"showSLATHull",0]
] call BIS_fnc_initVehicle;

Of course I already found out that this won't work with SetObjectTexture, unfortunately. The vehicle does spawn with all the extras like SLAT-Armour, tools, but with missing textures (At least this showed me, that it somehow works). I then tried different things to achive my goal, changed something here and there, tried to find the path to those textures, etc.

Funny enough: It's possible to use this code instead of the old one, and spawn the vehicle with all the extras and the correct textures. Bad thing is, It's spawn behaviour is totally different and all over the place - sometimes even glitches into the HQ. Results in apocalypse.

 

If I'd use the new code instead of the old one, it'd look like this:

 

    case 18:
    {
          if (commandpointsblu1 >= 28) then
          {
           hint "Vehicle ready !";
           commandpointsblu1 = commandpointsblu1 - 28;
           ctrlSetText [1000, format["%1",commandpointsblu1]];
           _veh = createVehicle ["I_LT_01_AA_F",position player,[],25,"NONE"];
           [
	           _veh,
	           ["Indep_Olive",1], 
	           ["showTools",1,"showCamonetHull",1,"showBags",1,"showSLATHull",0]
           ] call BIS_fnc_initVehicle;
          }
          else
          {
          hint "Not enough command points";
          };
    };

 

 

It's a long and already ungrateful journey, and I don't know where else to look, what else to do. If there would be someone to point me in the right direction, or is able to make a functioning code of the examples above - old code or new one,  doesn't matter as long as it works and the spawn behaviour is correct and identical to the old one, I'd - again - be more than very thankful.

 

Hope to hear from you folks, enjoy your time!

 

Regards,

MajorBlunderbuss.

Share this post


Link to post
Share on other sites

here you go, try this:

_camo = [_veh,["Indep_Olive",1],["showCamonetHull",1,"showTools",1,"showBags",1,"showSLATHull",0]] call BIS_fnc_initVehicle; //add this new code after the vehicle spawn code

 

I have it as this (I use a different spawn method which I added to duws years ago so its not so close to building though):

_vehic = "I_LT_01_AT_F" createVehicle _spawnPos;

_camo = [_vehic,["Indep_Olive",1],["showCamonetHull",1,"showTools",1,"showBags",1,"showSLATHull",0]] call BIS_fnc_initVehicle;

 

...still work on my original Duws Modified from year to year keeping it updated and fresh, typically now as we come into the fall season and until the holidays I usually add new features and make some adjustments :-)

  • Like 3

Share this post


Link to post
Share on other sites

Hello friend!

 

Thank you very much! It works flawlessly.

I tried so many different ways to achive this, searched everywhere, tried every combination I found or could think of, but nothing worked. I really appreciate your help!

 

And yeah, since fall is on it's way I'm also spending much more of my free time editing missions like DUWS, adding cool stuff etc.

As a basic framework, I'm using the latest DUWS Unofficial version - which is based on yours if I remember correctly, which was and still is the best framework to build upon. Will have a look at your updated version sometime.

Had to adjust some stuff too, added in a few nice scripts/functions, while reworked most of the request stuff like vehicles, units and squads, etc. (Order, new vehicles, units, squads, and support/compatibility for other armys/mods etc.)

 

Thank you again! Hope you enjoy your time, and godspeed!

 

Regards,

MajorBlunderbuss.

Share this post


Link to post
Share on other sites
On 9/14/2018 at 9:56 AM, bigshot said:

here you go, try this:

_camo = [_veh,["Indep_Olive",1],["showCamonetHull",1,"showTools",1,"showBags",1,"showSLATHull",0]] call BIS_fnc_initVehicle; //add this new code after the vehicle spawn code

 

I've tried to add the above script after this without success.

Quote

_veh = "I_LT_01_scout_F" createVehicle(position player);

Could you tell me where I'm going wrong?

 

Never mind. This seemed to work:

Quote

_veh = "I_LT_01_scout_F" createVehicle(position player); this setVariable ["BIS_fnc_initVehicle_customization", true, true]; [_veh,["Indep_Olive",1],["showCamonetHull",1,"showTools",1,"showBags",1,"showSLATHull",0]] call BIS_fnc_initVehicle;

 

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

×