Jump to content

[Help] Change Clothes TXD


Recommended Posts

Posted (edited)

Hey people,

me and a friend are running a small fun server.

We have a "big" Problem.

I Designed a new T-Shirt (txd) and we wanted to have it in the Server.

Is it possible? I would like to change the tshirtwhite.txd (in players.img*) to my own .txd

It would be really helpful if you could give me a .LUA file.

Thank you in advice!

Edited by Guest
  • MTA Team
Posted

You mean players.img

I don't know whether this is possible as of now, because afaik and iirc the engine functions only work for gta3.img modifications.

Posted

Shader is a helper in this case but then you don't need .txd but a .png or .dds

https://wiki.multitheftauto.com/wiki/Shader_examples - check "shader_tex_names" and use it to get the name of the tshirt you want to replace (you probably know its original name from .txd so it will save you time)

This is a simple shader which replaces in-game texture with your image file (eg .png, NOT .txd)

texture gTexture; 
technique replace 
{ 
    pass P0 
    { 
        Texture[0] = gTexture; 
    } 
} 

All you need to script is:

    txd = dxCreateTexture( "your_texture.png" ); 
    if not txd then 
        txd = nil; -- it's best to nil a variable because it'll waste unnecessary memory 
        return false; 
    end 
    shader = dxCreateShader( "shader_file.fx" ); -- the content of this file should be what I included above 
    if not shader then 
        destroyElement( txd ); 
        txd = nil; 
        return false; 
    end 
    dxSetShaderValue( shader, "gTexture", txd ); -- gTexture is inside the shader file which you want to set with your texture 
    engineApplyShaderToWorldTexture( shader, "name_of_the_texture" ); -- this is the name of texture you want to replace eg. "tshirtwhite" 

If you want to replace another texture you will have to use the same code as above but with different names/filenames.

Posted

dude, i'm trying to be nice.

so i pasted the 2. code in a lua file and pasted in my variables, added the meta and customized it. i created a shader_file.fx file with the 1. code and when i load it in the server i dont get any errors, but the texture wont show

  • MTA Team
Posted
dude, i'm trying to be nice.

so i pasted the 2. code in a lua file and pasted in my variables, added the meta and customized it. i created a shader_file.fx file with the 1. code and when i load it in the server i dont get any errors, but the texture wont show

sorry for what i said before. :/

Show us your meta.xml and .lua file

Posted

The bottom code needs to go to a script file (.lua), the top one needs to go to shader file (.fx). Both of these files need to be inside a resource folder and added to meta.xml.

EDIT:

I've just tested it and unfortunately it doesn't seem to support ped textures (any ped texture, not just clothes).

Posted
The bottom code needs to go to a script file (.lua), the top one needs to go to shader file (.fx). Both of these files need to be inside a resource folder and added to meta.xml.

well okay i got it, pasted the 2. in a lua and the 1. in a .fx file named "shader_file.fx". so okay, like i said, i pasted all my variables, but when i start it i dont get any errors, but it wont show off, when im now in MTA (in my server) and go to Debugmode 3, i got the error that the technique is wrong. wheres the problem?

here's my .fx -

texture gTexture; 
technique replace 
{ 
    pass P0 
    { 
        Texture[0] = gTexture; 
    } 
} 

that's the .lua -

    txd = dxCreateTexture( "tshirtwhite.png" ); 
    if not txd then 
        txd = nil; -- it's best to nil a variable because it'll waste unnecessary memory 
        return false; 
    end 
    shader = dxCreateShader( "shader_file.fx" ); -- the content of this file should be what I included above 
    if not shader then 
        destroyElement( txd ); 
        txd = nil; 
        return false; 
    end 
    dxSetShaderValue( shader, "gTexture", texture ) 
    engineApplyShaderToWorldTexture( shader, "tshirtwhite" ); -- this is the name of texture you want to replace eg. "tshirtwhite" 

and here's the meta -

  
<meta> 
    <info description="Shader - Clothes" version="0.1.3" type="script" /> 
    <script src="clothes.lua" type="client" /> 
    <file src="shader_file.fx" type="client" /> 
    <file src="tshirtwhite.png" type="client" /> 
</meta> 
  

as a noob i really dont know what to do.

Posted
i help it too so much... but when i load it i got the error in debugmode with the technique, i really dont get it o:

If you get an error about technique that's propably because you saved the shader file with UTF-8 encoding. Save it with ASCI encoding and you'll be fine.

This is my simple test resource: http://www.filefactory.com/file/ku2j1or ... re_rep_zip

Posted
nothing.png

even with your test resource i get this error... something wrong with my mta server?

Might be, I'm not a shader pro and haven't seen many shader error messages. What MTA version are you using? Maybe it's your graphics card fault but you seem to run high resolution so the card isn't old.

Posted
nothing.png

even with your test resource i get this error... something wrong with my mta server?

Might be, I'm not a shader pro and haven't seen many shader error messages. What MTA version are you using? Maybe it's your graphics card fault but you seem to run high resolution so the card isn't old.

I'm using MTA 1.3

My Graphics Card can't be wrong... if ENB doesn't lag, why should there be problems with this?

Hmmm... But it worked for you?

Posted

Well, it works fine because I changed the texture name from "tshirtwhite" to "shad_ped" (shadow ped) and it replaced player's shadow with the texture of new tshit and I didn't get any error/warning message.

Posted
HEY SO NOW WE CAN REMOVE THE SHADOW OF A PED!

You can do a lot of things with shaders.

There is no need for caps.

  • MTA Team
Posted
HEY SO NOW WE CAN REMOVE THE SHADOW OF A PED!

You can do a lot of things with shaders.

There is no need for caps.

Sorry, but it's quite a big deal for those people who like going invisible.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...