Jump to content

Sign in to follow this  
Sennacherib

setobjectTexture script

Recommended Posts

hi,

currently, I create textures for FAB's german soldiers for giving more diversity; I tried to use his setobjectTexture (used for the helmets), but without any success, someone could help me with that. In fact to use this script for the uniforms (only the vest).

Share this post


Link to post
Share on other sites

well, the way how to use this script. I want also to separate it from the whole mod. FAB used a lot of files with mutual links for example: class eventhandler: eca_manevanthandler etc etc. I tried to separate the scrip from the mod but that doesn't work. Even in oxygen I don't understand how He put different textures on the same part of a model. he used a plane but I don't understand how he attached all the textures to this plane ?: for example: helm_camo, helm_camo2, helm_camo3 etc etc

FAB's c++ were, are, will be, always a mystery for me :butbut:

Share this post


Link to post
Share on other sites

Ok, so

you must have relevant sections defined in the cfgmodels, AND defined in the p3d model :

class CfgModels
{
class Default
{
	sections[]={};
	sectionsInherit="";
};
class Man: Default
	{
	sections[] =
		{
			"head injury","body injury",
			"l arm injury","r arm injury","p arm injury",
			"l leg injury","r leg injury","p leg injury",
			"medic",
			"hlava",
			"krk",
			"zasleh",
			"armpatch"
		};
	sectionsInherit=Head;
	};

class my_soldier Man{
sections[]={"helmet","arm","jacket"};
 sectionsInherit="man";
		};


};

Then, a hiddenselection entry in the cfgvehicles :

class CfgVehicles
{
class All{};
class AllVehicles: All{};
class Land: AllVehicles{};
class Man: Land{};
class Soldier: Man{};
class Civilian: Man{};
class SoldierWB: Soldier{};
class OfficerW: SoldierWB{};

class SoldierEB: Soldier{};
class OfficerE: SoldierEB{};

class SoldierGB: Soldier{};
class OfficerG: SoldierGB{};

class my_soldier: SoldierWB
   	 	{
           vehicleclass="blabla"; 
	side=TWest;
	displayName="my beautiful soldier";
	model="\path to my model\my_soldier.p3d";
	hiddenSelections[]={"helmet","arm","jacket"};
	weapons[]={blabla};
	magazines[]={blabla};



};
};

Then you can use a script to hide / unhide hidden selection AND to change their textures by script with the setobjecttexture command :

[name of the soldier] exec "texture.sqs" :

Texture.sqs :

_soldier = _this Select 0

_soldier setObjectTexture [0, "\path to my texture\my_texture.pac"]

Exit

"0" in the setobjecttexture array points to the first element of the hiddenselections array ("helmet" in this example) :

_soldier setObjectTexture [1, "\path to my texture\my_texture.pac"]

points to the second element, "arm" here.

Finally, the quality of the texture loaded may be bad (i still don't know why), so it's usually better if the texture is loaded BEFORE the setobjettexture command is launched (for example, one vertice of the model is already textured with this texture).

Share this post


Link to post
Share on other sites

thx mate, I'm going to try that.

  Quote
Finally, the quality of the texture loaded may be bad (i still don't know why), so it's usually better if the texture is loaded BEFORE the setobjettexture command is launched (for example, one vertice of the model is already textured with this texture).

ok, this is why FAB used a plane associated with the soldier model?

Share this post


Link to post
Share on other sites

Probably. Fab has so much more knowledge on this game than us, it's a shame he left.

Share this post


Link to post
Share on other sites

If you don't load the texture onto the model,somewhere,before setobjecttexture is executed,

you'll get a horrible image.The only way I've successfully done it,is to use Vektorboson's

Dialog method.I expanded on his findings slightly by using multiple images and leaving out

the description.ext.So I ended up with an addon that contained a variety of textures,but only

one model.A resource.cpp/bin is still needed though.

Although it works for me,and others,some people reported odd graphical errors.

If you go the old way,then you need to have every texture you intend to use applied to the model.

It doesn't matter where.It's a really inefficient approach even though it works.

Edited by Macser

Share this post


Link to post
Share on other sites

thx, but this seems too much complicated for me, i'm not at all familiar with the programming. I think that i'm going to use the inefficient approach, at least this is easier for me :p

@Prof,

yes, FAB was one of the master of OFP.

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  

×