Jump to content
Sign in to follow this  
BilOlson

Changing texture via config

Recommended Posts

Can textures be assigned via config for Soldier models as well as in p3d?

Explanation (just in case):

soldierA.p3d

(using soldierA_co.paa and a face/hands hhl.paa, soldierA_co.paa is one merged 2048x2048 texture, model properly working, UV's all set, etc. These are Desert units)

Now can I; via config, swap out this soldierA_co.paa with soldierAwoodland_co.paa?

If so can I get an example?

Ive been working on some RAC SF units for months, painstaking at times trying to optimize them, merging textures, transferring UV's, etc. Would really hate to have two P3d's for each unit (one Desert and one Temperate), I will if I have too, but if there is a way around that I'd appreciate any help anyone can lend.

Share this post


Link to post
Share on other sites

http://fab.ofp.free.fr/Tutorials/Hidden_Selections.htm

Quote[/b] ]Well, the basic ERA "style" was simply the BI-sample model plus the ERA section for easier handling of the added elements (+1 section).

When we included mateck's custom skin, we added 3 more sections for texture replacement via setObjectTexture (+3 sections). 4 more sections got added when we introduced the numbers plus flags.

http://www.flashpoint1985.com/cgi-bin....t=74879

script code

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if(_panelling > 138) then {_buggy setObjectTexture [1, "\Buggy3\Tex\camo.pac"];};

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

Share this post


Link to post
Share on other sites

Note that the class inheritance doesn't work the way it is shown in the tut.

Share this post


Link to post
Share on other sites

Ok, thanks for the sidenote. It'll take a few days to get my head wrapped around this so I'm sure Ill be back with questions.

Share this post


Link to post
Share on other sites

Ok I'm back. Thanks again for the hints fellas. I have everything working, the way I intended it with standard eventhandler. Now I have another problem on the horizon. Which is probably an easy fix. I know for this to be properly implemented and to work properly in MP, etc I'm going to have to/ want to use EEH. Every time I try to incorporate it, it totally hates my script(s) the Handlers call, errors upon mission start.  With Standard EH, works like a charm. With EEH, not  so good. So I'm guessing it's my extreme novice scripting.

dcu.sqs    <---- called by EventHandler, works great. EEH, doesn't.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_unit = _this select 0

;making sure script is running, debug

_unit sidechat "is this running, this is a test?"

; Assign uniform default

_unit setObjectTexture [0,"\asp_resSFv1\data\asp_soldier2dcu_co.paa"]

Exit

There is an identical script for the Temperate uniforms as well.

I have had the EEH sorta working, upon entering game the section (body) is totally transparent. Heres the weird thing, as soon as I put anything into the units init line in editor with the word "this" (example: "This addWeapon "M136"), uni/body appears and is working as it should. I however do not ever get the sidechat line I put in to make sure script was running.

Any help is greatly appreciated. Also does anyone see a foreseeable problem that I'm not seeing by doing things this way? Foreseeable problems in MP? JIP? Respawn?, etc.

Share this post


Link to post
Share on other sites

XEH only allows SQF

(not sure and didnt check)

Share this post


Link to post
Share on other sites

If you want to do this via config instead of scripting, use the parameter hiddenSelectionsTextures[]. Example:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class myDude

{

hiddenSelections[] = {"shirt"};

hiddenSelectionsTextures[]= {"\myaddon\shirt.paa"};

...

};

Share this post


Link to post
Share on other sites

Thanks General i have everything working 100% now, hiddenSelectionsTexture, nice hadn't seen that one yet.

I used method explained above. hiddenSelections[], sections[]. Then I wrote a sqf with the setObjectTexture in it. Incorporated XEH Init and now everything is working as it should. Desert units are Desert and Temperate Units are temperate, all using one set of models.

All worked much first time I tried it following directions and links above.

I did run into a problem or two though with Extended Eventhandlers but found the fix in another thread and Q pointed out I needed SQF and not SQS. Also had to read up on SQF's, but these were fine 1st time I ran also too....

Thanks to everyone for the tutorials, and the linkage to said tutorials wink_o.gif

Still haven't been able to find out if I will be running into problems with this in MP, JIP, and Respawn scenarios. Might all be a wasted effort, but I do have the concept I was after working errorlessly. So I did learn quite a bit if this pans out not to work in one of those instances, now I'm super experimenting with hiddenselections, proves to be quite useful...

Share this post


Link to post
Share on other sites

It is said to work in MP for ArmA.

Maybe for JIP / respawn situations you need to adapt the script

code a bit. Yet should be doable.

Share this post


Link to post
Share on other sites

That's awesome news, I think I added the respawn part/fix when I built the new SQF script (added extra lines to the config after re-re-reading XEH readme), ran across it and added it to my cheat sheet then, so I would be sure to use it when the time came...

Solved my XEH not working or initiating properly with this thread Here

Thnx UNN, worked flawless..

Thanks again for the help Q, and others..Now if I could only come up with a decent "temperate" uniform for these RACs, I can get this wrapped up...

Share this post


Link to post
Share on other sites
Can textures be assigned via config for Soldier models as well as in p3d?

Explanation (just in case):

soldierA.p3d

(using soldierA_co.paa and a face/hands hhl.paa, soldierA_co.paa is one merged 2048x2048 texture, model properly working, UV's all set, etc. These are Desert units)

Now can I; via config, swap out this soldierA_co.paa with soldierAwoodland_co.paa?

If so can I get an example?

Ive been working on some RAC SF units for months, painstaking at times trying to optimize them, merging textures, transferring UV's, etc. Would really hate to have two P3d's for each unit (one Desert and one Temperate), I will if I have too, but if there is a way around that I'd appreciate any help anyone can lend.

Hello, Bil, could you make it? I'd like to swap textures via config too. I can remove the main texture 'np_soldier_co.paa' by adding a "hiddentexture" line in the config (after making a new selection in o2 named "BDU" and in the cfgmodel as well), but I cannot replace it with another one. It seems to allow to hide textures only, not to swap with another one. I tried to make it with setobjecttexture, but it's no use in the config file I guess (only in scripts). I'm trying to use one p3d model with differents bdu patterns for russian soldiers (vsr, flora, etc)

Edited by schroeder

Share this post


Link to post
Share on other sites

Check the addons of modemMaik, like the M2A2.

It uses hiddenSelections and setObjectTexture for better addon design! :)

Share this post


Link to post
Share on other sites

Thanks for your help, very interesting, but a bit complicated for me. After reading General Barron post, I thought it was possible to do it in the config.cpp file, without any sqf, see:

If you want to do this via config instead of scripting, use the parameter hiddenSelectionsTextures[]. Example:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class myDude

{

hiddenSelections[] = {"shirt"};

hiddenSelectionsTextures[]= {"\myaddon\shirt.paa"};

...

};

But I couldn't make it work. No problem to hide the texture, but no way to make another one appear. Maybe, there's something more to do with the p3d file in o2. I tried to put another new selection over the first I already had created, but it doesn't work... :butbut: I think it's not possible to use setobjecttexture in config.cpp, is it?

Edited by schroeder

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  

×