FileFront Gaming Forums

Beginners Guide to Modding

This is a discussion on Beginners Guide to Modding within the CoD2 Modding, Mapping and Editing forums, part of the Call of Duty 2 category; Beginners Guide to Modding: 1 - Resources In this post I will give links etc, to the tools you might ...

Go Back   FileFront Gaming Forums > The Games > Call of Duty Series > Call of Duty 2 > CoD2 Modding, Mapping and Editing


CoD2 Modding, Mapping and Editing Want more info about a Mod? Making a Mod? Looking for Modders, Mappers, Skinners, etc.? This is your Spot!

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old March 29th, 2006
COD Über Support
 
Join Date: November 19th, 2004
Location: London, UK
Posts: 3,436
Rep Power: 14
Tally has nothing to be ashamed ofTally has nothing to be ashamed of
Default Beginners Guide to Modding

Beginners Guide to Modding: 1 - Resources

In this post I will give links etc, to the tools you might need during your modding life.

Basics

The first of the basic tools that a modder will need are ones to open and control IWD files. These are the compressed file format that COD2 uses, and they are just a .zip file. COD1 and UO used PK3 files, and IWD files are exactly the same to all intents and purposes.

The best tool to use for an IWD file is Winrar. You can get that here:

http://www.rarlab.com/download.htm

Use this to open the IWD files, and get at the files and folders you need to mod. Simple right click the IWD file, and left click properties. You will then see that it says ‘open with’. Click the ‘change’ button and find winrar, and associate the IWD file with winrar. Now, every time you want to open one, you simply have to double click it and it will open with winrar.

NEVER save an edited original IWD from the games stock IWD fles. You will render your game invalid. Always create new IWD files.

To create a new IWD file, simple add the .iwd file extension to the file name. For example, you have it as zzz_mymod as the name, and it will say .zip as the file type. simply add .iwd to the file name – zzz_mymod.iwd. Now, when you click save, it will pop out as a IWD file.


GSC File Editors

The file format which is at the ‘heart’ of COD2 modding wise, is the GSC file. Edting these can either be done in Windows stock programs like wordpad, or you might like to go for something a little more professional. Here are a few GSC file editors:

Programmer’s notepad

This is an open source utility which I personally use and would recommend. Get it here:

http://www.pnotepad.org/

Then there is ultraedit. This is shareware, and you will have to purchase it when the trial period is over, but some modders swear by it. Get it here:

http://www.tucows.com/preview/194610


Weapons Editor

There are currently 2 excellent weapons editors out. One will edit a weapons file on its own, the other requires for you to have it in an iwd file.

Chris_P’s Weapons Editor:

Get Chris’s excellent editor here:

WEAPONS EDITOR 1

Just install it, and then place your weapons file on your desktop. Now open the editor, and click on ‘open’. Browse to find your weapons file, and then lick on ‘open’. The whole range of settings will then be clearly seen, and the values easily edited. Works great.

Bionicnipple’s Weapons Editor:

WEAPONS EDITOR 2

Open the weapons file in situ – just find a IWD file which contains the weapons files, and open it in Nip’s editor. All the weapons files will then be listed. One of the advantages to this one is that any changes to the original settings shows up as pink, so you can easily locate the one you have already edited.


Image Editor’s

To edit or create an image in COD2 you need to convert, or make, an IWI file. This is the image format that COD2 uses, and is really just a jazzed up DDS file. 2 users of these forums created them – Pointy and [GER]Iceman.

To use the converters, simply place them on your Windows (or other OS) desktop, and then drag and drop your image file onto them. The converted one will pop out the other side.

There are 2 of them – DDS2IWI and IWI2DDS. Get them here:

CONVERTERS DOWNLOAD

To actual edit or create an image at all, you need to be able to handle DDS files. I will therefore provide links for the NVidia DDS plugin for Photoshop, and one for Paintshop Pro.

NVIDIA DDS PLUGIN DOWLOAD

PAINTSHOP DDS PLUGIN DOWNLOAD

I will be doing a full tutorial on how to created, edit and use DDS and IWI files for modding purpose, so I wont say too much at this point.

Materials Files

Once you have your editors, you are all ready to go on creating an image to be used in COD2. These are great for skins etc. but supposing you wanted to create a new hud element which was a shader? Well, you will need a materials file to go with it. COD2 references all image files (IWI and TGA) with a materials file. These are like a ‘control center’ which contain the image properties settings – 2D or 3D, how big to render them, etc. For a forum thread which talks about them see here:

http://www.iwnation.com/Forums/index...howtopic=18154

I will be doing a full tutorial on materials files, but you will need a ‘basic’ tool to edit them. This is where a Hex editor comes in handy.

A Hex editor allows you to access the binary information of a file. Don’t worry too much about advance uses of a Hex editor, all we need to do is work on materials files.

The one I would recommend is a open source one. Get it here:

http://www.hhdsoftware.com/free-hex-editor.html

That’s about it for now. Next up will be a tutorial on adding a weapon to a COD2 menu.
__________________

Last edited by Tally; November 30th, 2006 at 12:33 PM.
Reply With Quote
  #2  
Old November 30th, 2006
COD Über Support
 
Join Date: November 19th, 2004
Location: London, UK
Posts: 3,436
Rep Power: 14
Tally has nothing to be ashamed ofTally has nothing to be ashamed of
Default Re: Beginners Guide to Modding

Beginners Guide to Modding: 2 - Add a Weapon to a Team Menu

One of the most requested mods I know is the one to add an unscoped bolt-action rifle to the American team. This is a very easy tutorial on how to do it, and I will show you how to add the Lee Enfield (but it could be any of the bolt-action rifles) to the american team, and then to create a button on the team menu so that you can select it.

I hop that it will introduce you to the ‘basics’ of menu modifications. These general principles can hopefully be used in more advanced projects later in your modding life.

Precaching

Precaching is at the heart of much modding. It is basically loading something into a server’s memory as the server is ‘formed’ (called compiling). This makes it ready to be used at some stage in the server’s life.

Without precaching into memory, an element that you might want to use will not be available to you. In this case, if you don’t precache the weapon, the server cannot ‘give’ the weapon to the American team, even though you have a button to choose it, because the weapon has not been loaded into memory as the server and gametype was formed.

So, to add the Enfield, you will need the gsc file _weapons.gsc which can be found in iw_07.iwd in the nested folder structure: maps\mp\gametypes.

Open the file with something like programmers notepad (referenced above in ‘Resources’).

Now, scroll down until you find this section of the script:

Quote:
init()
{
switch(game["allies"])
{
case "american":
precacheItem("frag_grenade_american_mp");
precacheItem("smoke_grenade_american_mp");
precacheItem("colt_mp");
precacheItem("m1carbine_mp");
precacheItem("m1garand_mp");
precacheItem("thompson_mp");
precacheItem("bar_mp");
precacheItem("springfield_mp");
precacheItem("greasegun_mp");
precacheItem("shotgun_mp");
//precacheItem("30cal_mp");
//precacheItem("M9_Bazooka");
break;
These are known as ‘case’ definitions. Everything in COD2 has to be defined meticulously. Many errors in modding and scripting come from not defining what you want the game to do. Here, we see each weapon defined, and the script tells the game to ‘load’ each weapon definition into memory: precaching.

You will also see that it refers to each weapon definition. For example, ‘thompson_mp’, ‘greasegun_mp’, etc. These ‘_mp’ case definitions refer to the vital weapons files located in iw_13.iwd in the nested folder structure weapons\mp.

These weapons files don’t have a ‘proper’ name, and are generally refered to as the ‘weapons files’, but Daffy refers to them as ‘weap def’ files, and I think that is a good term for them.

The weap def files are the ‘nerve center’ for all the weapons information. They contain all the information that the game needs to reference the specified weapon: the name of the actual weapon, ammo count, the animation models to be used, the time it takes to raise the weapon to the eye, the sound to be used when fired, etc, etc.

Now, you need to find the Enfield weapon information in the British team, and we are going to copy it over to the American team. So copy this:

Quote:
precacheItem("enfield_mp");
Paste it into the American team ‘case’:

Quote:
case "american":
precacheItem("frag_grenade_american_mp");
precacheItem("smoke_grenade_american_mp");
precacheItem("colt_mp");
precacheItem("m1carbine_mp");
precacheItem("enfield_mp");
precacheItem("m1garand_mp");
precacheItem("thompson_mp");
precacheItem("bar_mp");
precacheItem("springfield_mp");
precacheItem("greasegun_mp");
precacheItem("shotgun_mp");
//precacheItem("30cal_mp");
//precacheItem("M9_Bazooka");
break;
As you can see, the enfield weapon info is now precached, that is, ‘given’, to the American team.

That’s it! Because of the way COD2 is written, you don’t need to do anymore on the ‘giving to’ a team. Unlike COD1 and UO, which had more complex entries to make, it thankfully keeps things nice and simple.

Adding to Menu

Now we need to allow the American team the ability to choose what we have precached to them. So, we need to add the weapon to the team menu.

Go to iw_06.iwd and open it in winrar, and you will see the nested folder structure: ui_mp/scriptmenus. In there you will find the weapon_american.menu file. You will also need the weapon_british.menu file, because you will need to copy and paste the enfield info in a moment. Drag them both out and onto your desktop.

Open the weapon_american.menu file with programmers notepad.

Right at the top, you will see this:

Quote:
#include "ui_mp/menudef.h"

#define ORIGIN_TITLE 48 64
#define ORIGIN_CHOICE1 80 84
#define ORIGIN_CHOICE2 80 108
#define ORIGIN_CHOICE3 80 132
#define ORIGIN_CHOICE4 80 156
#define ORIGIN_CHOICE5 80 180
#define ORIGIN_CHOICE6 80 204
#define ORIGIN_CHOICE7 80 228

#define ORIGIN_WEAPONIMAGE 296 84
#define ORIGIN_WEAPONTEXT 296 220
#define ORIGIN_WEAPONPROPERTIESTEXT 296 290
#define ORIGIN_WEAPONACCURACY 395 277
#define ORIGIN_WEAPONDAMAGE 395 301
#define ORIGIN_WEAPONMOBILITY 395 325
#define ORIGIN_GRENADESLOT1 296 144
#define ORIGIN_GRENADESLOT2 312 144
#define ORIGIN_GRENADESLOT3 328 144
As we will be adding an extra button, we need to define it (remember what I said about everything being defined? This is just such one of those instances).

So we need to script the definition:

Quote:
#define ORIGIN_CHOICE8 80 254
You will see that I have highlighted the numbers. As we are adding, we need to tell the game to add an extra ‘space’. This is easily worked out. If you compare the numbers in the choice slots, there is a difference of 28 between the largest of the numbers. The number for choice 7 is 80 228, so we make choice 8 28 more: 80 254.

Add this to the ‘choice’ info:

Quote:
#include "ui_mp/menudef.h"

#define ORIGIN_TITLE 48 64
#define ORIGIN_CHOICE1 80 84
#define ORIGIN_CHOICE2 80 108
#define ORIGIN_CHOICE3 80 132
#define ORIGIN_CHOICE4 80 156
#define ORIGIN_CHOICE5 80 180
#define ORIGIN_CHOICE6 80 204
#define ORIGIN_CHOICE7 80 228
#define ORIGIN_CHOICE8 80 254

#define ORIGIN_WEAPONIMAGE 296 84
#define ORIGIN_WEAPONTEXT 296 220
#define ORIGIN_WEAPONPROPERTIESTEXT 296 290
#define ORIGIN_WEAPONACCURACY 395 277
#define ORIGIN_WEAPONDAMAGE 395 301
#define ORIGIN_WEAPONMOBILITY 395 325
#define ORIGIN_GRENADESLOT1 296 144
#define ORIGIN_GRENADESLOT2 312 144
#define ORIGIN_GRENADESLOT3 328 144
Now that we have defined the slot, or space, we need to add the enfield weapon info itself.

Open the weapon_british.menu file.

Locate this info:

Quote:
itemDef
{
name "button_enfield"
visible 1
rect 0 0 128 24
origin ORIGIN_CHOICE2
forecolor GLOBAL_UNFOCUSED_COLOR
type ITEM_TYPE_BUTTON
text "@MPUI_2_LEEENFIELD"
textfont UI_FONT_NORMAL
textscale GLOBAL_TEXT_SIZE
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
dvartest "ui_allow_enfield"
showDvar { "1" }
action
{
play "mouse_click";
scriptMenuResponse "enfield_mp";
}
onFocus
{
hide sten_info;
hide shotgun_info;
hide thompson_info;
hide bren_info;
hide enfieldsniper_info;
hide m1garand_info;
play "mouse_over";
show enfield_info;
show weapon_propertiestext;
}
}
itemDef
{
name "button_enfield"
visible 1
rect 0 0 128 24
origin ORIGIN_CHOICE2
forecolor GLOBAL_DISABLED_COLOR
type ITEM_TYPE_BUTTON
text "@MPUI_2_LEEENFIELD"
textfont UI_FONT_NORMAL
textscale GLOBAL_TEXT_SIZE
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
dvartest "ui_allow_enfield"
showDvar { "2" }
onFocus
{
hide sten_info;
hide shotgun_info;
hide thompson_info;
hide bren_info;
hide enfieldsniper_info;
hide m1garand_info;
play "mouse_over";
show enfield_info;
show weapon_propertiestext;
}
}
Copy it, and then open the weapon_american.menu file again. Scroll right down until you reach the very last of the weapon options (the BAR):

Quote:
itemDef
{
name "button_bar"
visible 1
rect 0 0 128 24
origin ORIGIN_CHOICE7
forecolor GLOBAL_UNFOCUSED_COLOR
type ITEM_TYPE_BUTTON
text "@MPUI_7_BAR"
textfont UI_FONT_NORMAL
textscale GLOBAL_TEXT_SIZE
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
dvartest "ui_allow_bar"
showDvar { "1" }
action
{
play "mouse_click";
scriptMenuResponse "bar_mp";
}
onFocus
{
hide greasegun_info;
hide m1carbine_info;
hide m1garand_info;
hide thompson_info;
hide springfield_info;
hide shotgun_info;
play "mouse_over";
show bar_info;
show weapon_propertiestext;
}
}
itemDef
{
name "button_bar"
visible 1
rect 0 0 128 24
origin ORIGIN_CHOICE7
forecolor GLOBAL_DISABLED_COLOR
type ITEM_TYPE_BUTTON
text "@MPUI_7_BAR"
textfont UI_FONT_NORMAL
textscale GLOBAL_TEXT_SIZE
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
dvartest "ui_allow_bar"
showDvar { "2" }
onFocus
{
hide greasegun_info;
hide m1carbine_info;
hide m1garand_info;
hide thompson_info;
hide springfield_info;
hide shotgun_info;
play "mouse_over";
show bar_info;
show weapon_propertiestext;
}
}

itemDef
{
#include "ui_mp/button_mainmenu.menu"

action
{
play "mouse_click";
close ingame;
open main;
}
onFocus
{
play "mouse_over";
}
}
We will need to paste in the enfield info that we just copied.:

Quote:
itemDef
{
name "button_bar"
visible 1
rect 0 0 128 24
origin ORIGIN_CHOICE7
forecolor GLOBAL_UNFOCUSED_COLOR
type ITEM_TYPE_BUTTON
text "@MPUI_7_BAR"
textfont UI_FONT_NORMAL
textscale GLOBAL_TEXT_SIZE
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
dvartest "ui_allow_bar"
showDvar { "1" }
action
{
play "mouse_click";
scriptMenuResponse "bar_mp";
}
onFocus
{
hide greasegun_info;
hide m1carbine_info;
hide m1garand_info;
hide thompson_info;
hide springfield_info;
hide shotgun_info;
play "mouse_over";
show bar_info;
show weapon_propertiestext;
}
}
itemDef
{
name "button_bar"
visible 1
rect 0 0 128 24
origin ORIGIN_CHOICE7
forecolor GLOBAL_DISABLED_COLOR
type ITEM_TYPE_BUTTON
text "@MPUI_7_BAR"
textfont UI_FONT_NORMAL
textscale GLOBAL_TEXT_SIZE
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
dvartest "ui_allow_bar"
showDvar { "2" }
onFocus
{
hide greasegun_info;
hide m1carbine_info;
hide m1garand_info;
hide thompson_info;
hide springfield_info;
hide shotgun_info;
play "mouse_over";
show bar_info;
show weapon_propertiestext;
}
}
itemDef
{
name "button_enfield"
visible 1
rect 0 0 128 24
origin ORIGIN_CHOICE2
forecolor GLOBAL_UNFOCUSED_COLOR
type ITEM_TYPE_BUTTON
text "@MPUI_2_LEEENFIELD"
textfont UI_FONT_NORMAL
textscale GLOBAL_TEXT_SIZE
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
dvartest "ui_allow_enfield"
showDvar { "1" }
action
{
play "mouse_click";
scriptMenuResponse "enfield_mp";
}
onFocus
{
hide sten_info;
hide shotgun_info;
hide thompson_info;
hide bren_info;
hide enfieldsniper_info;
hide m1garand_info;
play "mouse_over";
show enfield_info;
show weapon_propertiestext;
}
}
itemDef
{
name "button_enfield"
visible 1
rect 0 0 128 24
origin ORIGIN_CHOICE2
forecolor GLOBAL_DISABLED_COLOR
type ITEM_TYPE_BUTTON
text "@MPUI_2_LEEENFIELD"
textfont UI_FONT_NORMAL
textscale GLOBAL_TEXT_SIZE
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
dvartest "ui_allow_enfield"
showDvar { "2" }
onFocus
{
hide sten_info;
hide shotgun_info;
hide thompson_info;
hide bren_info;
hide enfieldsniper_info;
hide m1garand_info;
play "mouse_over";
show enfield_info;
show weapon_propertiestext;
}
}


itemDef
{
#include "ui_mp/button_mainmenu.menu"

action
{
play "mouse_click";
close ingame;
open main;
}
onFocus
{
play "mouse_over";
}
}
We now need to edit the info to make it compatable with the American menu. So, firstly, change the slot position info:

Quote:
origin ORIGIN_CHOICE8

text "@8. Lee Enfield"
There are 2 places to do this, so remember to edit the second one as well.

Now change the weapon info details from the british to the American.

From this:

Quote:
hide sten_info;
hide shotgun_info;
hide thompson_info;
hide bren_info;
hide enfieldsniper_info;
hide m1garand_info;
play "mouse_over";
show enfield_info;
show weapon_propertiestext;
To this:

Quote:
hide greasegun_info;
hide m1carbine_info;
hide m1garand_info;
hide thompson_info;
hide springfield_info;
hide shotgun_info;
hide bar_info;
play "mouse_over";
show enfield_info;
show weapon_propertiestext;
You will need to go up through each of the american weapon selections details, and add in this:

Quote:
hide enfield_info;
If you don’t do this, the enfield image and information will be seen under another weapn image. This basically tells the server not to show it when another weapon image is showing. So, do it in all the right places.

Now go to the weapon_british.menu file again and locate the image information, and copy it:

Quote:
//WEAPON IMAGES
-------------snip--------------------

itemDef
{
name "enfield_info"
visible 0
rect 0 -2 224 112
origin ORIGIN_WEAPONIMAGE
style WINDOW_STYLE_SHADER
background "weapon_enfield"
decoration
}
Paste that into the weapon_american.menu file. It can go anywhere next to the other american weapons info.

Finishing Of

The mod is about ready. So, all we need to do is pack it up right.

Go to your desktop, and create a set of nested folders: maps\mp\gametypes

Place the _weapons.gsc file in the ‘gametypes’ folder.

Now create a set of nested folders: ui_mp\scriptmenus

Place the edited weapon_american.menu file in the scriptmenu folder.

Now open Pakscape (see dl info above under ‘Resources’).

Click 'File' > 'new'. Place your files and folders on the white area, then go to 'File' > 'Save as ...'

You will see that it defaults to the .zip format. Leave that as is, and where it says 'File name', type in your name, something like zzz_mymod, but then add the .iwd extension - so, zzz_mymod.iwd. Now, when you save it, it will pop out as an IWD file.

Place the IWD file in your COD2 ‘main’ folder, and start up a New Server. Choose an american map, and this is what you should see:

__________________
Reply With Quote
  #3  
Old November 30th, 2006
COD Über Support
 
Join Date: November 19th, 2004
Location: London, UK
Posts: 3,436
Rep Power: 14
Tally has nothing to be ashamed ofTally has nothing to be ashamed of
Default Re: Beginners Guide to Modding

Beginners Guide to Modding: 3 - Custom Clan Logo

creating a custom hud element - Part 1: Shaders

In this tutorial I will show you how to do the following things:

1. Create an IWI file

2. Create a Materials file to reference the IWI file

3. Create a hud element and call it out from a gametype script

With these things, you can end up with a logo which is placed in the top-right hand corner of the MP screen. This can be a clan logo, or anything you like really. This particular type of hud element is known as a ‘shader’. There are other types of hud elements, and later I will describe how to create a string hud element.

You will need a DDS plugin for whatever graphics package you will be using. You can find both a PS and a PSP one in the ‘resources’ section above.

Also, you will need the 2 converters to convert back and forth from IWI to DDS, DDS to IWI. These can also be found in the ‘resources’ section above.

Further, you will need a Hex editor to edit a materials file. See the download in the ‘resources’ section above.

IWI file logo

First, create your logo. This is the one I will use as an example. It is one I created for a clan called ‘Telford Light Infantry’ (TLI):



I will be using Photoshop CS for the purposes of this tutorial.

1. Create a new canvas 256x256. Images in COD2 will only work if they are RMS (root means square), or what Chris_P calls ‘to the power of’. Everything therefore has to go up in times the original size: 32, 64, 128, 256, 512, etc.

Fill it with a mid grey with the paint bucket. The go to layers, and click on the channels tab as marked:



This will create a new alpha channel:



Alpha channels mask off any image, so that they effectively ‘don’t show’ on the server screen. In a moment, we will remove just the area for the logo image, but still mask off the ‘square’ part of the canvas – the bit we don’t want.

2. Now click back on the RGB channel, and switch back to layers by clicking the ‘layers’ tab.

3. Press Ctrl + SHIFT + N to create a new layer. Get your logo image and paste it on the layer. Size it up if you need so that it fits on the area:



4. Make sure the logo image layer (layer 2) is active. Then get the Magic Wand tool, and select around the image. Then go to Select > Inverse:



5. Switch back to channels, and click on the alpha channel.

6. You will see that the selection now reveals the logo image in outline form:



7. Press SHIFT + D, to restore the color palette to its default Black/White status. Press Delete, and you will remove the mask from the alpha channel. This means that the logo image will show ‘through’ the alpha mask on the server, but the ‘square’ part of the canvas wont be seen:



8. Switch back to layers again, and flatten the image:



9. Go to File > Save As, and chose DDS format. Use the default settings on the NVidia plugin, but make sure you set the 2 critical settings – DXT5, and generate (not ‘use existing’) mipmaps. These are the settings that will make an IWI file valid. Anything else doesn’t work:



Save the file as ‘hudclanlogo.dds’.

10. Copy your new DDS logo file to your desktop, and have the DDS2IWI converter on the desktop too. Drag and drop the DDS file onto the converter, and the newly generated IWI will pop out the other side.

11. Create a new folder on your desktop, and call it ‘images’. Drag the hudclanlogo.iwi file into that folder.

Done.

Materials File

Now we need to create a custom materials file to reference the IWI file. As was stated above in the ‘resources’ section, no image in COD2 can be used if it doesn’t have a materials file to reference it. This is fine if you are merely customizing an existing IWI file, like a skin or something, but when you create a new image, as in this case, we need to create a custom materials file to go with it.

There are 2 ways to create a custom materials file – using the Asset Manager, which are part of the IW Tools, or take an existing materials file and edit it. We will take an existing one, and edit the information.

The best ones to use are those that you know for sure reference 2D images. I cant really advise you about this, as it is really all a question of knowing what ones are what.

For our purposes, I’m going to use one I know is a 2D materials file. So, go to your COD2 ‘main’ folder, and open iw_13.iwd with winrar. Find the ‘materials’ folder, and scroll down until you find ‘hudcolorbar’.

Open the file with your Hex editor, and you will see this



It is the marked area that concerns us – we are going to change it.

The important thing to know about editing an existing materials file to suit your own custom purposes, is that you CANNOT use any more, or any less characters than already exist. In this case, there are 11. So, we are going to rename this to ‘hudclanlogo’ which is 11 characters.

So edit the info so that is looks like this:



Save this file to your desktop, and then rename the actual materials file – ‘hudclanlogo’. This will now reference your IWI file called ‘hudclanlogo.iwi’.

Create a new folder, and call it ‘materials’.

New Hud Element Call Out

Now we need to enter the script which will callout the IWI file.

There are 2 ways to call this out. You can either edit each gametype file individually, or you can use the _callbacksetup,gsc file. Scripting the hud element in here will work for TDM, DM, CTF, and S&D. However, it will crash HQ. But if you don’t use HQ in your server rotation, then that should be fine.

On the assumption that you do use HQ, I will demonstrate how to script it into the gametype files themselves. I’ll show you with TDM, but the principle is the same for all of them.

Open iw_15.iwd with winrar, and open the maps\mp\gametypes folders, and drag the TDM gametype file onto the desktop. Open it with programmers notepad.

The actual script we are going to use is this one:

Code:
       level.svrlogo = newHudElem(); 
       level.svrlogo.x = 580; 
       level.svrlogo.y = 40; 
       level.svrlogo.alignX = "center"; 
       level.svrlogo.alignY = "middle"; 
       level.svrlogo.archived = false; 
       level.svrlogo.alpha = .8; 
       level.svrlogo.sort = 8000; 
       level.svrlogo setShader("hudclanlogo", 50,50);
There are several elements in this which I must explain.

The first is the positioning. This is done via a screen x/y coordinate.

alignX – this refers to three possible positions: right, left, or center

alignY – this refers to three possible positions: top, bottom, or middle

Then there is the distance between x-and-y. To place a hud element on the screen in the left-hand corner, you would have:

X = 0
Y = 0
alignX=left
alignY=top

To place it in the right-hand corner, you would have:

X = 650
Y = 0
alignX=left
alignY=top

To place it in the lower left-hand corner, you would have:

X = 0
Y = 475
alignX=left
alignY=top


This shows that the screen is broken up into a grid reference which is 650 along the top, and 475 down from the top. X is vertical; Y is horizontal.

If you wanted to place the hud on the bottom of the screen it is best (easier) to use the center/middle reference, as this places the coordinates on top of each other. I have found this easier to control (which is why the coordinates in the script are like this). But it doesn’t really matter which method of referencing you use.

The next thing I want to explain is this:

Quote:
level.svrlogo setShader("hudclanlogo", 50,50);
This is the ‘sizing’ of the IWI file. You can make it up to 200 times its original size. As 100 is the original size, this effectively means you can double its size.

The next thing to explain is this:

Quote:
level.svrlogo.alpha = .8
This controls the opacity (transparency). 1 = default.

.1-9 fades it out in increments of .1 factor

Ok, so that explains the element. Now to insert it.

There are 2 places in the gametype where you can place it: main() or Callback_StartGameType(). Either will do.

So, I will insert it at the Callback_StartGameType().

First, we must precache it (see above tutorial on adding a weapon to understand precaching):

Code:
     precacheShader("hudclanlogo");
This loads it into server memory as the gametype is complied (‘formed’).

So, the whole script would be this:

Code:
 Callback_StartGameType()
{
    level.splitscreen = isSplitScreen();

    // defaults if not defined in level script
    if(!isDefined(game["allies"]))
        game["allies"] = "american";
    if(!isDefined(game["axis"]))
        game["axis"] = "german";

    // server cvar overrides
    if(getCvar("scr_allies") != "")
        game["allies"] = getCvar("scr_allies");
    if(getCvar("scr_axis") != "")
        game["axis"] = getCvar("scr_axis");

    precacheShader("hudclanlogo");

    precacheStatusIcon("hud_status_dead");
    precacheStatusIcon("hud_status_connecting");
    precacheRumble("damage_heavy");
    precacheString(&"PLATFORM_PRESS_TO_SPAWN");

    thread maps\mp\gametypes\_menus::init();
    thread maps\mp\gametypes\_serversettings::init();
    thread maps\mp\gametypes\_clientids::init();
    thread maps\mp\gametypes\_teams::init();
    thread maps\mp\gametypes\_weapons::init();
    thread maps\mp\gametypes\_scoreboard::init();
    thread maps\mp\gametypes\_killcam::init();
    thread maps\mp\gametypes\_shellshock::init();
    thread maps\mp\gametypes\_hud_teamscore::init();
    thread maps\mp\gametypes\_deathicons::init();
    thread maps\mp\gametypes\_damagefeedback::init();
    thread maps\mp\gametypes\_healthoverlay::init();
    thread maps\mp\gametypes\_friendicons::init();
    thread maps\mp\gametypes\_spectating::init();
    thread maps\mp\gametypes\_grenadeindicators::init();
 
       level.svrlogo = newHudElem(); 
       level.svrlogo.x = 580; 
       level.svrlogo.y = 40; 
       level.svrlogo.alignX = "center"; 
       level.svrlogo.alignY = "middle"; 
       level.svrlogo.archived = false; 
       level.svrlogo.alpha = .8; 
       level.svrlogo.sort = 8000; 
       level.svrlogo setShader("hudclanlogo", 50,50);
Close and save to your desktop.

Now, do this to all the gametypes you wish to use in your rotation.

On your desktop, create a set of nested folders: maps\mp\gametypes

Place the edited gametype files in there.

You should now have three new folders on your desktop: ‘images’, ‘materials’, and ‘maps’.

Pack these into an IWD file (see above for details on how to make one). Call it something like zzz_logomod.iwd

Place this in your COD2 ‘main’ folder. Start up a New Server to test it, and you should get something like this:

__________________

Last edited by Tally; March 3rd, 2007 at 08:35 AM.
Reply With Quote
  #4  
Old November 30th, 2006
COD Über Support
 
Join Date: November 19th, 2004
Location: London, UK
Posts: 3,436
Rep Power: 14
Tally has nothing to be ashamed ofTally has nothing to be ashamed of
Default Re: Beginners Guide to Modding

Beginners Guide to Modding: 4 - ElDiablo’s Welcome Message Scripting Tutorial

Here is a great tutorial from El Diablo. It shows you how to create a ‘Welcome Message Mod’.

Below is the download link to the .avi file, but before you download it, here is a brief summary of the main points of the tutorial, and the pertinent lessons that it makes.

In the tutorial, El show’s you how to use a gametype script to run a mod script. This method is the most popular method of modding in the COD series.

By using a gametype script (in this case CTF), you can ‘call out’ a sub-routine from it. El scripts the sub-routine – called tutorial.gsc – and runs it from the Callback_StartGameType() section of the CTF gametype.

You will see El make this command:

Code:
thread maps\mp\tutorial\_tutorial::main();

The use of the function ‘to thread’ means to run simultaneously with other routines. This is a way of adding in various scripted routines and sub-routines once a gametype script has been created. IW have given us the game’s stock gametypes, but we can use the callback method to alter the gametype even though we don’t actually rewrite it itself. It can be used very simply, to run a single sub-routine, or in a very complex way, with lots of sub-routines changing the overal characteristics of the server and the gametype.

Here is the link to the download:

DOWNLOAD AVI FILE HERE
__________________
Reply With Quote
  #5  
Old November 30th, 2006
COD Über Support
 
Join Date: November 19th, 2004
Location: London, UK
Posts: 3,436
Rep Power: 14
Tally has nothing to be ashamed ofTally has nothing to be ashamed of
Default Re: Beginners Guide to Modding

Beginners Guide to Modding: 5 - Rudedog’s Message Service

Making Server-Side Mods

This is a tutorial which will show you how to make a message generator for COD2 (or any of the COD series games), and I hope it will illustrate 2 things:

1. How to callout a sub-routine using a gametype script.

2. How to make this mod server-side only

As there is still a fair bit of confusion on how to actual make a mod server-side only, I thought this would be a nice, easy way to illustrate it. All to often I have gone into a public server, only to receive downloads which I, as a client, haven’t needed. A ‘message generator’ of some description has been a frequent ‘guest’ in my ‘main’ folder for no reason other than the principle of server-side only still confuses people.

This is, of course, no fault of theirs but is rather down to the fact that the ability do server-side only was taken away from us in COD2.

Background to the Message Service

Rudedog’e message service has a long history in the COD community, and I think it is probable safe to say its one of the most popular of mods. Here is a little history from the man himself:

Quote:
Originally Posted by Rudedog
“The idea started way back in the Delta Force (Go www.df2.net) realm where you could host a server on your own box in your own home. Someone had a small script he ran manually that displayed some server info. The problem was he had to run it only when he was online "ingame"

Now jump to Medal of Honor. Crowking was working on the first Autokick admin program and I suggested to include a message generator, to broadcast messages at set time intervals. Crowking included this idea and made me a part of the readme LOL.

Now the only problem with Autokick was you had to have a second box running to "run" Autokick on. Even thought Auotkick was a great program that was it's only issue in my eyes. What I wanted to be able to do is broadcast messages server side without the help of any other program. It also had to be part of the "game" as most Game Server Providers (GSPs) would not let you run any type of executable on the server.

Jump to MOHPA. I was attending EALA's studio as part of the MOHTeam and got talking to one of the devs who I recommended this Idea to. I was told at this stage it was too late to incorporate but he thought it was a great idea to run this via the game.

The MOHteam had an early copy of MOHPA we where testing and using to offer our feedback. EA also wanted some of us (not me) to start tutorials for when the game was released.

I started work on my Message Center for MOHPA and soon realised this had to be ported to Call of Duty.

A big thanks to ScorpioMidget (one of the great scritpers and well missed in the community) and Crowking (another great programer and also missed)for pointing me in the right direction early on.”
The Sub Routine:

The way the message service works is in 2 parts: a sub-routine in a gsc file; and a set of server cvars, defined in the sub-routine, which go into the server’s config file.

The actual sub-routine has taken many forms, but the one I think that works best in COD2 is this one:

Code:
 rudedog()
{

    // Make sure the server runs even if message center is not set up. by [SaS]Taebo
if(getcvar("sv_linerd1") == "")
    setcvar("sv_linerd1", "rudedog's message center for CoD Version 1.0 is installed, ^1but not set up properly.");
if(getcvar("sv_linerd2") == "")
    setcvar("sv_linerd2", "^2Please read the readme file that came with rudedog's message center");
if(getcvar("sv_linerd3") == "")
    setcvar("sv_linerd3", "If you do not have the readme file, visit www.codadmin.com's download section.");
if(getcvar("sv_linerd4") == "")
    setcvar("sv_linerd4", "^2You can download this mod with the readme at ^1www.codadmin.com/nuke");
if(getcvar("sv_linerd5") == "")
    setcvar("sv_linerd5", "rudedog's message center for CoD Version 1.0 is installed, ^1but not set up properly.");
if(getcvar("sv_rddelay") == "")
    setcvar("sv_rddelay", "6");


    // print to screen
    print_text();

}

// print to screen
print_text()
{
    for (;;)
    {
        rd_delay = getcvarint("sv_rddelay"); // set delay timer
        if (rd_delay < 1) setcvar("rd_delay", "5"); // check timer is over 1 second

        rd_m1 = getcvar("sv_linerd1"); // set message for line 1
        if ( isdefined(rd_m1) ) iprintln(rd_m1); // check and print line 1

        wait rd_delay; // delay in seconds

        rd_m2 = getcvar("sv_linerd2"); // set message for line 2
        if ( isdefined(rd_m2) ) iprintln(rd_m2); // check and print line 2

        wait rd_delay; // delay in seconds

        rd_m3 = getcvar("sv_linerd3"); // set message for line 3
        if ( isdefined(rd_m3) ) iprintln(rd_m3); // check and print line 3

        wait rd_delay; // delay in seconds

        rd_m4 = getcvar("sv_linerd4"); // set message for line 4
        if ( isdefined(rd_m4) ) iprintln(rd_m4); // check and print line 4

        wait rd_delay; // delay in seconds

        rd_m5 = getcvar("sv_linerd5"); // set message for line 5
        if ( isdefined(rd_m5) ) iprintln(rd_m5); // check and print line 5

        wait rd_delay; // delay in seconds

        rd_m6 = getcvar("sv_linerd6"); // set message for line 6
        if ( isdefined(rd_m6) ) iprintln(rd_m6); // check and print line 6

        wait rd_delay; // delay in seconds

        rd_m7 = getcvar("sv_linerd7"); // set message for line 7
        if ( isdefined(rd_m7) ) iprintln(rd_m7); // check and print line 7

        wait rd_delay; // delay in seconds

        rd_m8 = getcvar("sv_linerd8"); // set message for line 8
        if ( isdefined(rd_m8) ) iprintln(rd_m8); // check and print line 8

        wait rd_delay; // delay in seconds
    }
}
Make a new gsc file, and paste that code into it. Call it _rudedog_message.gsc.

Now, you need to callout the sub-routine from the gametype scripts exactly as El did with his ‘welcome messages’. In fact, you could easily combine these 2 mods to work together.

Open iw_07.iwd and go into the maps\map\gametypes folders, and extract the gametypes you wish to use. You can either do all of them, or just the ones you use in your server’s rotation. I will use the TDM script as my example.

The routine can be called out at either the main() or Callback_StartGameType() methods. I prefer main() for no obvious reason.

So, we are going to insert this:

Code:
     thread maps\mp\gametypes\_rudedog_message::rudedog();
So that the main() method will now look like this:

Quote:
main()
{
level.callbackStartGameType = ::Callback_StartGameType;
level.callbackPlayerConnect = ::Callback_PlayerConnect;
level.callbackPlayerDisconnect = ::Callback_PlayerDisconnect;
level.callbackPlayerDamage = ::Callback_PlayerDamage;
level.callbackPlayerKilled = ::Callback_PlayerKilled;
maps\mp\gametypes\_callbacksetup::SetupCallbacks() ;

level.autoassign = ::menuAutoAssign;
level.allies = ::menuAllies;
level.axis = ::menuAxis;
level.spectator = ::menuSpectator;
level.weapon = ::menuWeapon;
level.endgameconfirmed = ::endMap;

thread maps\mp\gametypes\_rudedog_message::rudedog();
}
As I explained above, ‘threading’ a sub-routine is simply ‘running it simultaneously’ with the main functions. With this method of modding a gametype script you can ‘insert’ all sorts of things and particularly take over the functions of the script if you want to.

Once you have edited all the gametype scripts you are going to use, you need to pack them, along with the _rudedog_messages.gsc file, into a set of nested folders: maps\mp\gametypes.

As we are going to make a serverside mod of it we WILL NOT pack them into an IWD file.

Now, you need to add the server cvars to your server config file. Here they are:

Code:
 seta sv_linerd1 "your message 1"  // message one
seta sv_linerd2 "your message 2"  // message two
seta sv_linerd3 "your message 3"  // message three
seta sv_linerd4 "your message 4"  // message four
seta sv_linerd5 "your message 5"  // message five
seta sv_linerd6 "your message 6"  // message six
seta sv_linerd7 "your message 7"  // message seven
seta sv_linerd8 "your message 8"  // message eight

seta sv_rddelay "30"   // delay between messages in seconds Must be greater then 5
The ‘rddelay’ setting determines how often the messages cycle.

You can add these anywhere in your server config file.

Server Side Only

Ok, so we have our message service. Now we need to set it up so that its server side only.

There is already an excellent forum thread started by Worm about this here:

http://www.iwnation.com/Forums/index...howtopic=16371

What I want to do is go over the ground again, and give concrete illustrations of it.

To run a mod, even this mod, server side only, you need to use the fs_game function.

This is simply a folder you create in the root directory for your server’s installation of COD2. You can call it, or name it, what you like, as long as it is one word. Then, you boot the server using this as the ‘controlling’ directory. What do I mean by that?

The root directory for your COD2 installation is known as the fs_baspath. The default is C:\Program Files\Activision\Call of Duty 2. All the files and folders need to run COD2 are in there. The main IWD files are location in the ‘controlling’ folder called ‘main’.

When you boot a server from an fs_game folder, you are telling the server to switch ‘controlling’ folders from ‘main’ to your custom one. Your custom fs_game folder will have all the files and folders that make the server.

So, lets create an fs_game folder. Go to your root directory for COD2, and right click, then left click new > folder. Call it something like ‘mymod’.

It will look something like this:



As you can see, I have mark my new fs_game folder, and it sits next to all the other folders that COD2 needs to run.

Open the fs_game folder ‘mymod’. Now, drag and drop into it the set of nested folders you created for the message service. Add you server config file.

NB: Make sure all the server details are correct in this file, including the cvars for the messages we spoke about above

It should look something like this now:



As you can clearly see, the folder structure is not compressed into an IWD file. This is the critical part – by not compressing it, it will not download to the client.

Now that we have the fs_game folder created, and the files we need, we are going to talk about booting it up from here.

Rented Servers

One of the biggest hurdles in trying to use an fs_game folder, is that many people who rent their server for their clans, etc, don’t always have access to the command line. If this is the case for you, you are going to have to talk to your provider, and get them to do the command line for you. Most are very willing to do this, and have probably done it before for other clans, so don’t expect an argument or blank stares about it.

If you are part of the ever growing numbers of clan server admins, you will probably have a rented dedicated server box. So, you will probably already be able to log onto it with something like VNC (virtual desktop) and be able to setup an fs_game folder, as if it were on your own desktop.

There are many ways to boot a server from an fs_game folder. You can edit the existing CoD2MP_s.exe (a popular method), or you can create a simple .bat file. This is the method we are going to use. Its simple, and once you know how to do it, you can create numerous of them quickly and effectively.

So, assuming you are using a virtual connection to your server box, we need to find out the root installation of COD2, so right click on the CoD2MP_s.exe, and then left click on properties at the bottom. You should see the installation root in the ‘target’ box. Just copy it.

Now, right click anywhere on your virtual desktop, then left click new > text document. Paste in your root installation details. Then add the following:

Quote:
@echo off
@echo STARTING COD2 SERVER
cd C:\Program Files\Activision\Call of Duty 2
CoD2MP_s.exe +set fs_game mymod +set dedicated 2 +exec dedicated.cfg +map_rotate
@echo COMPLETE
Now go to File > Save As, and you will be presented with 3 boxes at the bottom. Click the little arrow in the second box and move it to ‘All Files’.

In the ‘File Name’ box, type in something like ‘myserver.bat’, or whatever. The critical thing is the .bat extension.

Make sure you are saving the file to the virtual desktop, and click on ‘save’. You will find that a file which looks like this has popped up on the desktop:

[img]/rudedog_tut/3.gif[/img]

There it is! The shortcut that will launch your server in fs_game mode. Assuming that you have everything setup, and all the server details including the message cvars in place, when you double click this .bat file, your server will launch through the fs_game function. And the message service will not download to a client.

This is a server side mod.

Linux Servers

I will say a little about Linux server setups.

There are many, many distros (versions) of Linux around now, and Linux dedicated servers are becoming more and more popular. If your clan rents a Linux server, you will be able to set up an fs_game start for your server quite easily, even if you don’t have access to the stop/start function of your server (most do however).

So, you will need to edit the start.sh file (the actual name of the .sh file may change, just look for the .sh file in your COD2 root installation). FTP to your Linux server, and download the start.sh file to your Windows desktop.

You will need an SH file editor. This will allow you to edit the start.sh file. So, download VIM here:

http://www.vim.org/download.php

Once you have VIM downloaded, install it to your Windows desktop in its folder. Now, place the start.sh file from your server in the folder. Right click on the start.sh file, and click on ‘Open’. Windows will ask you which program you want to use. So, navigate to the VIM folder, and you will see the VIM.exe (gvim) icon. Check that in the box. Click open.

Scroll down until you find the startup info. It will lok something like this:

[img]/rudedog_tut/4.gif[/img]

All you need to do is make the command line like this:


Quote:
./coduo_lnxded +set net_ip $IP +set net_port $PORT +set fs_homepath $dir +set fs_game mymod +set dedicated 2 +exec dedicated.cfg +map_rotate
Close and save. FTP this edited start.sh file back to your server. Stop the server (if you have an SSH protocol program, just use that to halt the server), and then restart it. It will then boot in fs_game mode.
__________________
Reply With Quote
  #6  
Old June 24th, 2009
I'm too cool to Post
 
Join Date: June 22nd, 2009
Posts: 1
Rep Power: 0
reLo is a n00b
Default Re: Beginners Guide to Modding

Very nice tutorial, Ive just seen this and would like to try, however, many of the pictures are missing from the original post, can anyone see them?(Custon clan logo)
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Guide to Modding for Beginners and Useful Websites eXperion CnC Modding, Mapping and Editing 448 January 31st, 2009 04:28 PM
MySQL: The beginners guide {james} Web-Code Help and Discussion 3 March 7th, 2006 08:14 AM
Guide to mapping for beginners and useful websites Rich19 CnC Modding, Mapping and Editing 3 April 22nd, 2005 02:44 PM
Orb's Beginners Guide to Skinning in JK2 & JA orbitius SW:JK3 Modding, Mapping and Editing 0 March 3rd, 2004 07:25 PM


All times are GMT -7.


Powered by vBulletin®
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.