Jump to content
Sign in to follow this  
rtek

Changing EAST/WEST Camo, NVG's, etc. through init.sqf

Recommended Posts

I am trying to do a few things through the init.sqf . I am able to remove NVGs, add a taclight to their weapons and force that light to be on, as well as change their spotdistance and spottime.

{
   if(side _x == east) then
   {
       _x unassignItem "NVGoggles_OPFOR";
       _x removeItem "NVGoggles_OPFOR";
_x addPrimaryWeaponItem "acc_flashlight"; 
_x enableGunLights "forceOn"
_x setSkill ["spotDistance", 0]; 
_x setSkill ["spotTime", 0];

   };
} foreach (allUnits); 

All that works great.

I want to do the same for the WEST side, but also change their camo as well.

I have tried the below, but none of it working.

{
   if(side _x == west) then
   {
_x setObjectTexture [0, "camo\marpat.paa"];
_x addPrimaryWeaponItem "acc_flashlight"; 
_x enableGunLights "forceOn"
_x setSkill ["spotDistance", 20]; 
_x setSkill ["spotTime", 20];

   };
} foreach (allUnits); 

I have the EAST code at the top of the init.sqf and the west below it. What am i doing wrong, and how can it be fixed?

Are there any other good lines for customizing all units on a faction through this method?

Thank you in advance.

Share this post


Link to post
Share on other sites

You can't change uniform textures through scripting with setObjectTexture, would work for vehicle's I think but not infantry. Also if I'm not mistaken allUnits would return vehicles as well so it might be worth adding a check to make sure _x is a human, so (side _x==WEST&&_x isKindOf "MAN") might work to avoid trying to add flashlights and remove NVGoggles from non infantry units.

Share this post


Link to post
Share on other sites

Use setObjectTextureGlobal for multiplayer. It works for uniforms fine, but not vests or helmets.

Share this post


Link to post
Share on other sites
You can't change uniform textures through scripting with setObjectTexture, would work for vehicle's I think but not infantry. Also if I'm not mistaken allUnits would return vehicles as well so it might be worth adding a check to make sure _x is a human, so (side _x==WEST&&_x isKindOf "MAN") might work to avoid trying to add flashlights and remove NVGoggles from non infantry units.

the setObjectTexture works in all my missions. I've done it with triggers and within the init of the unit itself. What I do is seek out great camo skins I like, extract the .paa i want from the .pbo, then put it into my missions. I've done it with specific vehicles too if I find a cool skin I like.

I'm just trying to see if it's possible and how to do it through the init.sqf.

Share this post


Link to post
Share on other sites
Also if I'm not mistaken allUnits would return vehicles as well

There's a separate vehicles command for that, allUnits only returns all alive units.

As for setObjectTexture and uniforms, it working depends on if there are hidden selection options defined for the clothes in question. If your setObjectTexture [0, "camo\marpat.paa"]; doesn't work, it's possible that there aren't any for that particular uniform, and it's only possible to retexture them through an addon.

So while it does work on every faction's regular uniform, units with more "specialised" uniforms like officers can be the issue here.

But on a quick glance it looks like the missing ;'s in these lines might also be breaking the whole script:

_x enableGunLights "forceOn"

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  

×