Call of Duty 4: SP - Beginner Tutorial

From COD Modding & Mapping Wiki
Revision as of 14:27, 23 February 2012 by Ingram (talk | contribs) (→‎Compiling)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Single Player Tutorial including Lighting, Compiling, Weapons and the Zone File.

A SinglePlayer map should always be saved in Radiant as "sp_mapname" or "mapname"

This will make sure the compile tools build the playable game file (.d3dbsp) in the correct directory.

Things you must have

(this part used the Map Editor)

Before starting any Singleplayer editting it is a must to have a working level:

A working level: A closed in room with no leaks, or a Skybox with no leaks (a hollow cube with inside surfaces of a chosen "sky" texture and worldspawn values found on here.

Lighting

If you have an indoor level its best to place a few lights: Right Click> Light. The light has defualt values set so that it will light anything inside of the radius (see the 2d grid when the light is selected). With a light selected you can press [N] to change the values, radius increases the distance convered and intensity controls the brightness.

Player Spawn - Starting Location

  • Player Spawn: Right Click the 2d Grid> Info> Player_start
  • This is where you the player will spawn, do no let it touch or overlap anything solid. Good practice is to place this spawn a few units off the floor. (The player will start feet on the ground)

Spawning AI

  • AI Spawning: Make a brush, apply the Trigger texture to the entire brush. With the brush selected Right Click the 2d Grid > Trigger > Multiple. With the trigger still selected press "N", now check the box marked "Trigger_Spawn".
  • Now all you need is an actor (note this should work with all actors)
  • Right Click the 2d Grid> Actor> Enemy> Arab> AR> Ak47

(as you can see for the purpose of the tutorial I have used an Actor, who is an Enemy to the player, who has the outfit of a Arab, who is using an Assualt Rifle, and has the weapon AK47)

  • With the actor selected press "N" check the box: "SPAWNER" (note:: he will not spawn if the player can see him spawn)
  • You may now link the Trigger to the AI.
  • Select the Trigger, then select the AI Actor, press W. A visible line will connect them. The reason they are connected in this order is simple. The Trigger activates the Actor, not the other way around.

Weapons

  • Weapon: As an extra, we want to kill the Enemy actor, so we'll place a Weapon. Right click> Weapon> USP
  • Now select the weapon and press [N], check the box "Suspend" so the weapon stays where it is.


Compiling

  • Compiling and Creating nesaccary Script Files:
  • Create a text document inside of the directory: CoD4\raw\maps
  • Rename this file to: yourmapname.gsc
  • Inside the file type this code:
main()
{
	maps\_load::main();
}

(this part uses the Compile tools)

  1. In the COD4 Compiling utility you need to compile the BSP with these options checked:
    Compile BSP
    Connect Paths
    Compile Lighting
  2. Now compile your reflections (assuming you have reflection probes - If you don't the map should still work)
  3. Build Your Fast File.
  4. Update Zone File

(Now I will assume only that you have included the USP pistol as an entity in this map)

  • You must add(to the list on the right):
sound,ru_battlechatter,mapname,all_sp
sound,uk_battlechatter,mapname,all_sp
xmodel,viewmodel_base_character
xmodel,viewmodel_base_viewhands
xmodel,viewmodel_usp
weapon,sp/usp
xmodel,weapon_usp
weapon,sp/ak47
xmodel,weapon_ak47
xmodel,viewmodel_ak47
weapon,sp/mp5
xmodel,weapon_mp5
xmodel.viewmodel_mp5
  • The sound files are for the AIs battle chatter and movement (thanks to Camo1018)
  • The MP5 is needed as its included in the defualt loadout (basic script)
  • Then click SAVE


  • If you have used anyother assets in your map you must add them via this method- The Zone files left hand coloumn should tell you if you are missing anything, you may copy and paste from the the "missing Assets" list to the right hand column via [Ctrl+C] then [Ctrl+V].
  • And as you can see I added the AK47 - This is because the Ai actor is using it and the player can pick it up. The Ai might pull out a pistol (the M9 usually) but I've never added it to the assets and its always worked.
  • Now you can select the "Run Map option"
  • If for some reason the button does not load the game
  • Go to your COD4 Singleplayer
  • Drop the console:
/developer 1
/g_connectpaths 1
/spdevmap mapname

Extra

ADDING GUNS: Each gun needs

xmodel,viewmodel_gunname
xmodel,weapon_gunname
weapon,sp/gunname

(The gun names can be found by right clicking the 2d grid in the editor and selecting "weapons" from the drop down list.

camo1018: When any AI character initiates "reloading" sequence, their clips will not drop. In order to implement live clips, you must add corresponding parts to the zone file and to the main script.

For example, on the zone file, you would add:

fx,shellejects/clip_m16
fx,shellejects/clip_dragunov
fx,shellejects/clip_ak47
fx,shellejects/clip_g36
fx,shellejects/clip_ak74u
fx,shellejects/clip_mp5

And in the script

level.weaponClipModels = [];
level.weaponClipModels[0] = "weapon_m16_clip";
level.weaponClipModels[1] = "weapon_dragunov_clip";
level.weaponClipModels[2] = "weapon_ak47_clip";
level.weaponClipModels[3] = "weapon_g36_clip";
level.weaponClipModels[4] = "weapon_ak74u_clip";
level.weaponClipModels[5] = "weapon_mp5_clip";

This should be loaded before your script calls maps/_load:main();

And, when it's done, your characters in your map should hold on to a correct clip when they reload.


Your map will be multi-coloured unless you make and edit a Grid File (click make grid in the compiler - then once you've collected all the dots that a player would be able to reach in normal gameplay - shut down the game - recompiler your map - done)

To use the functions of the bottom of the compile tools (assuming your in 1024*768 resolution and cant see them) you may need to increase your resolution.

You may need to include extra sound assetes when getting AI to move (connecting them to a Action_node) with path nodes indicating the path to said action_node. For these, just Update your Zone file and copyi the missing assests, for the left colum to the right.


This is a quick guide for people who want to get going with the Single Player.

By techno2sl


Sources: Modsonline.com

--CoDEmanX 02:58, 29 July 2009 (UTC)