How to,list of things you may not know/basic codes/textures

Lots of cool and useful tips to mod either serverside or clientside
Post Reply
User avatar
MR PINK BALLS
Posts: 267
Joined: Sun Oct 18, 2009 4:01 pm

How to,list of things you may not know/basic codes/textures

Post by MR PINK BALLS »

Hello all ,I am MR PINK BALLS as most of you know...anyway im making this tutorial for the newbies to modding that may be working on some of these specific things

I WOULD LIKE TO THANK Archiemonday,and mrhowdoimod,for teaching me alpha layers!

FIRST lets start with textures,I know when I first started I always wanted to mess with textures but did not know how,so here we go,here is some questions you may have.

#1.what is a texture? (A):A texture is a 2d image that is putt on objects in the game to give them depth and detail.ther is a number of ways texture can be applied ,so don't think that only flat objects have texture ALL objects in bf1942 have a texture,yes including 3d ones.

#2.were is texture? How do I find it? (A):The texture can be found in your bf1942/mods/"whatevermod"/archives,it is the .rfa file simply named texture.rfa

#3.Okay I found the texture but what is a DDS file? How do I open it? (A):A DDS is a flexible image file type,It is can be opened by a DDS converting program the best one is for photoshop (LINK):http://developer.nvidia.com/object/phot ... ugins.html ,if you do not have photoshop you can also find other DDS converters by simply googleing it,My personall favorite is photoshop tho its much easier and integrated.

#4.Okay I have my DDS open now what am i looking at? Image ive never seen a image quite like this ,how do I edit it? (A):What you are looking at is the texture for a rifle as you can see it is stretched and shows all angles,the reason its all jumbled up is because in 3dsmax (a modeling program) the texture has to be like this in order to map it to a object,so how do you edit this? simple just paint over the desired areas and this will change the colors or appearance.

#5.How do I save this? (A):This is were it gets tricky the #1 thing to remember is the image has to be the same size "pixels X pixels" as the original image or it will not show ,second you must save the file as a DDS usually you want to save it with no alpha,well get into alpha layers later.

#6.What is a alpha layer? how do I make one? How do I apply it? (A):A alpha layer will allow you to make parts or the entire texture transparent,this is how

First you want to have your texture in the program you are using (photoshop here) As you can see I clocked create new layer and it created a new completely black layer

Image

By adding this new layer the image will be completely transparent ,this channel works in black and white the whiter the more solid the texture is the darker the more transparent,so can you just make 1 part of the texture transparent? YES,you must select what parts of the texture you want to be solid and once you have them selected simply copy and paste them into the alpha layer as white and they will be solid.

ALWAYS MAKE SURE TO BACK UP YOUR FILES

Now these are just the basics of texturing if you have question feel free to pm me.

Now on to some basic coding

We are just going to show you some frequently used lines of code that make up the basis of modding a map.

first if you are adding custom textures to a map you can simply putt your textures in the textures folder already included in the map and go to the init.con,once there "rem" out the original texture line and place this one below it

Code: Select all

textureManager.alternativePath bf1942\levels\MAP_NAME_HERE\Textures
this will make the game read the textures in this folder it ignores the archives and uses this texture instead if it does not fond a needed texture it will go to the archives and find them as normal

Another possibly one of the most important codes is

Code: Select all

ObjectTemplate.Active (whatever here)
this code makes the game override previous files for the ones listed,so lets say I want to make the m9berreta in dcfinal have 100 bullets how to do this? well first we are going to use the maps files for this ,that way this will only happen on this map,so lets go to the conquest game mode found in the conquest folder in the map you have extracted,here we will find objectspawntemplates.con otherwise known as OST thats what we want,we go in to this .con folder we have out m9 folder open so we can look at its files and the first step is to putt your activation code in the OST ,then we will add the appropriate codes directly under the active code

EXAMPLE

Code: Select all

ObjectTemplate.Active HandFireArms M9_beretta
ObjectTemplate.magSize 100
ObjectTemplate.roundOfFire 12
this will give the m9 a 100 round mag and make it possible to fire up to 12 rounds per second

Now we have the one covered another important code is

Code: Select all

rem
The "rem" stands for "remark" as in not code when the game sees rem it ignores the following lines

Why do I care? because this will enable you to simply rem a code instead of erasing it from the files ,saves time

if you want to rem out a larg body of code that's easy as well simply place above the code you want to remark out the code

Code: Select all

beginrem
and were you want it to end

Code: Select all

endrem
this will ignore everything in between these two lines.

another code is

Code: Select all

ObjectTemplate.create 
this code allows you to create new ,kits/objects

lets say I want to take the US_Assault kit and give it a sniper rifle,well I have to create a new kit so we go to our OST and make one!

Code: Select all

ObjectTemplate.create Kit superduperassult  <-----new kit name
ObjectTemplate.setType Assault
ObjectTemplate.setKitTeam 2

ObjectTemplate.setHealthBarIcon "Ingame/Healthbar_empty_assault_64x64.tga"
ObjectTemplate.setHealthBarFullIcon "Ingame/Healthbar_full_assault_64x64.tga"
ObjectTemplate.addWeaponIcon "Weapon/Icon_usknife.tga"
ObjectTemplate.addWeaponIcon "Weapon/Icon_m9.tga"
ObjectTemplate.addWeaponIcon "Weapon/Icon_m16.tga"
ObjectTemplate.addWeaponIcon "Weapon/Icon_m61.tga"
ObjectTemplate.addWeaponIcon "Weapon/Icon_binoculars.tga"
ObjectTemplate.addWeaponIcon "Weapon/Icon_m203.tga"

ObjectTemplate.setKitIcon 1 "kits/Icon_assault_allies_selected.tga"
ObjectTemplate.setKitName 1 "RESPAWN_ASSAULT"
ObjectTemplate.setKitActiveName 1 "RESPAWN_ACTIVE_ASSAULT"

ObjectTemplate.geometry Kit_Allies_Assault
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.networkableInfo KitInfo
ObjectTemplate.addTemplate Us_Helmet
ObjectTemplate.addTemplate US_Hip_Pack

rem ObjectTemplate.addTemplate M16 <----remark it out
ObjectTemplate.addTemplate m24 <----new one
ObjectTemplate.addTemplate M9_beretta
ObjectTemplate.addTemplate KnifeAllies
ObjectTemplate.addTemplate GrenadeAllies
ObjectTemplate.addTemplate binoculars
ObjectTemplate.addTemplate M203
ObjectTemplate.aitemplate Assault
Now this kit will have a m24 instead of m16 but your not done yet,now you have to go into the ini.con in the map directory and change the kit name

Code: Select all

game.setTeamSkin 2 USSoldier
game.setKit 2 0 US_Sniper
game.setKit 2 1 superduperassult <-------NEW KIT
game.setKit 2 2 US_AT
game.setKit 2 3 US_HeavyAssault
game.setKit 2 4 US_Support
there ya go,now you have a new kit in your map

Most of the things in this tutorial are CSM client side

THAT'S IT FOR THIS TUT MY FINGERS HURT THANKS FOR READING
Image Image

I <3 Ironmen
User avatar
fo0k
Posts: 1433
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Re: How to,list of things you may not know/basic codes/textures

Post by fo0k »

Thats some epic tutorialing there :O
User avatar
MR PINK BALLS
Posts: 267
Joined: Sun Oct 18, 2009 4:01 pm

Re: How to,list of things you may not know/basic codes/textures

Post by MR PINK BALLS »

Thanks hopefully ill be able to make some more soon
Image Image

I <3 Ironmen
Post Reply