Call Of Duty II - Radiant Editor Manual


by Barry Stephen Nieuport


Copyright 2007


Version 1.03 - 02/11/2007


Updated as of 21 June 2007







II. Editor Fundamentals - The Functions, Commands and Procedures(cont.)

D. Creating and Inserting Objects in the Editor. (cont.)


9. PROJECT FIVE: Adding A House.(cont.)


h. Inside Walls.

Figure 320 - Create Inside Walls. This is a real simple section. You already know how to create a brush, a wire frame as you have created walls on the house all over. I use 4 inch walls for the inside, but the process is the same. You first make sure that no brush is selected, then click and drag the mouse. In Figure 320 you can see the walls I created.

Figure 321 - Create Walls And Texture Them. It is not complex. I decided to create an entranceway in the front with two doors on the inside wall. One door on the upper side, the left side as you walk into the house, goes to the living room and the stairway to the upstairs and the downstairs. The right door goes to the dinning room and the kitchen. Real simple. I plan to use this format for a cafe also, where the rest of the house is for the owner of the cafe and the right side is a dinning table where they serve food to customers. Instead of cutting the walls, I simply just did not draw them all the way across, but left an opening for the door. I then created a small wall above the doorway. As you can see the finished rooms in Figure 321, I am not an interior decorator. I will work on them more later and make different wallpaper for each room or area and make them match. You get the idea though. That is the important part.

And you know how to add texture to the walls also. You highlight or select the surface only of the wire frame and then click on the picture of the texture in the texture window. Press <Escape> to deselect all brushes. Press <Control> + <Shift> + {Left Click} on the surfaces you want to add texture to, In the Main Menu, press [Textures]->[Usage]->[interior wall] and choose a nice texture. Press {Left Click} on the graphic in the Texture Window and the texture will be applied to the surfaces. Simple.


i. Adding Doors, Windows and Shutters.

In this section we will not just add doors and windows, but we will add doors that rotate open. It is always my firm philosophy in these games that there should never be any area that is just a blank fill in. This represents a lack of imagination on the part of the builders. Even if it is an empty room, give us a door so we can look in and see an empty room. Locked doors in combat is just not reasonable. One word dispels the idea of a soldier unable to open a door. That word is "grenade", other concepts such as rifle butt, and foot also come to mind. So, lets leave the doorway open as if the door was broken or make it open. As for windows, I am undecided how far we can do at this point. I will have to experiment with opening shutters. Let's add some simple windows first.

STEP ONE: Draw a Rectangle. Press <Escape> to make sure that all brushes are deselected. Press <2> to change the grid value to 2. Press <Control> + <Tab> twice to switch to the "YZ Side View". Press {Left Click Hold} at the top left corner of the hole for the window and drag to the left bottom corner and release the Mouse Button.

Figure 322 - Place Window Inside Window Frame. STEP TWO: Resize and Move Rectangle. Press <Control> + <Tab> to switch to Top View. Press {Left Click Hold} inside the wire frame and drag it inside the hole for the window. Press {Left Click Hold} outside the wire frame and drag it to resize it down to only 4 inches instead of 8 inches. Make it inset on both sides as shown in Figure 322.

Figure 323 - Window Texture On One Side. STEP THREE: Make It A Window. Press <Escape> to make sure that all brushes are deselected. Press <Control> + <Shift> + {Left Click} to select just the outside surface and repeat for the inside surface. In the Main Menu, press [Textures]->[Usage]->[window] and choose a nice window. Press {Left Click}on the graphic in the Texture Window and the texture will be applied to the surfaces. Remember not to forget to do both sides, or else the inside of the window could look like Figure 323.

STEP THREE: Fit The Window. Press <S> to open the Surface Inspector. Press the (Fit) Button to fit the window texture to the wire frame or brush. Press the (Done) Button to close the Surface Inspector.

STEP FOUR: Repeat For All Windows. Press <Spacebar> to copy the window we just created. Press {Left Click Hold} inside the wire frame and drag it to the next window frame or hole. Do the same for all of the windows you have made.

Now we need to create some shutters. We are going to add texture to the whole shutter as we would like to be able to open and close them.

STEP FIVE: Draw Rectangle. Press <Escape> to deselect all brushes. Press <Control> + <Tab> twice to switch to the "YZ Side View". Press {Left Click Hold} at the top right corner of the window trim, just on the outside edge of the trim, drag the mouse down and to the right to create a wire frame that is 16 inches wide and 68 inches tall and release the Mouse Button. Press <Control> + <Tab> to switch to the Top View.

Figure 324 - Shutter To The Left Of Window. STEP SIX: Resize and Move Rectangle. Press <Control> + <Tab> to switch to Top View. Press {Left Click Hold} inside the wire frame and drag it so that it is one the surface of the outside wall and is next to the window. Press {Left Click Hold} outside the wire frame and drag it to resize it down to only 2 inches instead of 8 inches. Make it as shown in Figure 324.

Figure 325 - Texture Added To Shutter. STEP SEVEN: Make It A Shutter. Leave the entire wire frame selected this time. We are going to need all sides textured. In the Main Menu, press [Textures]->[Usage]->[window] and choose a nice shutter. Press {Left Click} on the graphic in the Texture Window and the texture will be applied to the surfaces. I used "v_shutter_01".

Figure 326 - Rotated Texture To 270 Degrees. STEP EIGHT: Rotate The Texture. Press <S> to open the Surface Inspector. We need to first rotate the texture. If you look closely at the shutter you will notice the horizontal lines are there because the texture is lying on its side. Use the rotate arrows to rotate it 90 degrees or 270 degrees. Now the boards should be vertical the way they are supposed to be.

Now you can see that the texture still needs more adjustment. There is the visible gap in the texture between the supports where one tiled piece is up against the next one. So, we need to further fit it to the brush.

STEP NINE: Fit The Shutter. Now, press the (Fit) Button to fit the shutter texture to the wire frame or brush. Press the (Done) Button to close the Surface Inspector.

Figure 327 - Shutters Fit Only One Way. STEP TEN: Copy Shutter For The Other Side. Press <Spacebar> to copy the shutter we just created. Press {Left Click Hold} inside the wire frame and drag it to the other side of the window. Fit the shutter in the same way we did for the first shutter. Notice a caution here. To get the shutter just right you will notice in Figure 327 that there is a handle and locking mechanism on shutters to keep them closed in the wind. It should be on the opposite side for each side of the window so that they would be next to each other when the shutter is closed. Now to be really correct we should use a different texture on the reverse side to show when it is closed.

Figure 328 - Texture Name In Status Window. Shutter Back Seen Through Window. STEP ELEVEN: Move Shutter. Press <Control> + <Tab> to switch to Top View. Press {Left Click Hold} inside the wire frame and drag it so that it is way out from the house so we can look at the back side of it. Press <Escape> to deselect the shutter. Press <Control> + <Shift> + {Left Click} to select just the back surface. In the Main Menu, press [Textures]->[Usage]->[window] and choose a nice shutter. Press {Left Click} on the graphic in the Texture Window and the texture will be applied to the surfaces. I used "mtl_caen_window_shutter_01". You can make out the name in the status window for those textures that are so close the labels overlap. See Figure 328.

Now you can see that the hinges need to be on the correct side. This is correct in Figure 328 because the window is to the side that has the hinge all the way to the edge, where the hinge would be mounted to the window trim. You can see it in the window because we have moved it out from the house, not because it is rotated closed. When it is closed this texture you see will be facing to the outside and the texture you see on the other side will be visible from inside the house. In this way, the hinge is on the outside and the locking mechanism is on the inside.

STEP TWELVE: Move Shutter Back. Press {Left Click Hold} inside the wire frame and drag it so that it is against the house the way it was and release the Mouse Button.

Now let's put in some doors. There is the outside main door and there are some places inside we can put a door. During the normal course of building a house you may have noticed that we deleted the windows and doors and now we are putting them back in. I did it this way so that I could show someone how to add doors and windows to an existing house. If you know ahead of time, then do not delete them, add texture right then and there to the door and to the windows as you are cutting along and texturing the trim.

STEP THIRTEEN: Draw a Rectangle. Press <Escape> to make sure that all brushes are deselected. Press <Control> + <Tab> twice to switch to the "YZ Side View". Press {Left Click Hold} at the top left corner of the hole for the door and drag to the left bottom corner and release the Mouse Button. Sounds familiar doesn't it.

Figure 329 - Door Inset Between Walls. STEP FOURTEEN: Resize and Move Rectangle. Press <Control> + <Tab> to switch to Top View. Press {Left Click Hold} inside the wire frame and drag it inside the hole for the door. Press {Left Click Hold} outside the wire frame and drag it to resize it down to only 4 inches instead of 8 inches. Make it inset on both sides as shown in Figure 329.

Figure 330 - Finished Doors, Windows and Shutters. STEP FIFTEEN: Add Texture. In the Main Menu, press [Textures]->[Usage]->[door] and choose a nice door. Press {Left Click} on the graphic in the Texture Window and the texture will be applied to the surfaces. I did not care for any of the doors in the editor. I took a door that was there, it had just a ring on it, no door knob, and no lock. So, this brings up a question, if there are no locks on the doors, how come they do not open up in the game? Oh well. I copied the door, modified some other textures, grabbed the ring on the door, put it on this other texture and created a door out of them. I put a lock on the door too.


j. Making Doors Movable.

We want to be able to get into the house, so let's make one of our inside doors movable. It is a relatively simple process.

Figure 331 - Inside Door To Make Movable. Origin Brush Selected. STEP ONE: Select The Origin Tool Texture. In the Main Menu, press [Textures]->[Usage]->[tools] and choose the graphic that has the letters "Orig" on it three times and is orange in color.

Figure 332 - Create Origin. STEP TWO: Draw Rectangle. Press <Escape> to make sure that all brushes are deselected. Press {Left Click Hold} at the corner of the door that you want to rotate on, in other words, where the hinge is attached to the door and the wall. Overlap the wall and the door, as shown in Figure 332.

Figure 333 - Entity, Script -> Brushmodel.

Figure 334 - Entity Window.
STEP THREE: Select Door. Press <Shift> + {Left Click} on the door to select it and make both the origin and door selected.

STEP FOUR: Create Entity. Press {Right Click} on the door to bring up the entity placement window. Press {Left Click} on [script]->[brushmodel]. Press <N> to bring up the Entity Window. Enter the following into the fields. For the "Key" field, enter: targetname. For the "Value" field enter: door1. You can choose this variable for yourself, especially if you have several doors. I used the variable "house1door3" just to be different. Make sure to press <Enter> after you enter in the names. The information will then be displayed in the window above the text boxes used to enter information. Press <N> to close the Entity Window.

Figure 335 - Create Trigger For Door. STEP FIVE: Select Trigger. Press <Escape> to make sure that all brushes are deselected. In the tools section that should still be active, press {Left Click} on the graphic labeled "Trig". It is purple in color with white letters.

STEP SIX: Draw Trigger. Press {Left Click Hold} in front of the doorway and drag the Mouse to the right and down to create a box surrounding the door and release the Mouse Button. Make the wire frame is so that it is in front of each side of the door, so that it will be "triggered" by the player on the way in and the way out. We do not need to be locked in the house, than you very much.

STEP SEVEN: Create Entity. Press {Right Click} on the trigger to bring up the Entity Placement Window. Press {Left Click} on [trigger]->[use_touch]. Press <N> to bring up the Entity Window. Enter the following into the fields. For the "Key" field, enter: targetname. For the "Value" field enter: door1trigger. You can choose this variable for yourself, especially if you have several doors. I used the variable "house1door3trigger" just to be different. Make sure to press <Enter> after you enter in the names. The information will then be displayed in the window above the text boxes used to enter information. Press <N> to close the Entity Window.

STEP EIGHT: Create Script. Press <Escape> to make sure that all brushes are deselected. Save your map file. I use notepad for all my text editing purposes. I actually have a custom editor that I will start to use, but will not include the instructions for that, because I know you do not have it, I wrote it. At least you had better not have it, or I have more problems, get off my computer! Now, let's start the Notepad program. This is not a windows manual, so you need to know how to access your editor. On my system it is located on my desktop and also at [Start]->[All Programs]->[Accessories]->[Notepad] in the windows start menu. If you already have your "gsc" file for your map, then open that file. If you do not have a "gsc" file, then enter the following into Notepad:

Game Script Command File, mapname.gsc:
main()
{
maps\_load::main();
}



This is the bare minimum for the file. There are loads of stuff that will eventually go into this file. For now, let's just concentrate on the door. Inside the main function, enter a name for the script that you will use to trigger and open the door. I used "house1door3_rotate" as the name of the function. Just after the maps\_load::main(); line, on a new line enter the name of the function after the word thread.

Game Script Command File, mapname.gsc:
main()
{
maps\_load::main();
thread house1door3_rotate();
}


My programming style is such that I indent my programs. To the compiler this is white space, it is non-existent and not necessary for it to run. Do it or not, it is your choice. I like readable scripts. I like names that tell someone what it is doing. You could write a function and just call it fnum001 or whatever. And of course the HTML format can remove spaces so the indents may not show in this page.

After the last braces "}" enter the new function on a new line.


Game Script Command File, mapname.gsc with the new thread added:
main()
{
maps\_load::main();
thread house1door3_rotate();
}
house1door3_rotate()
{
door3 = getent("house1door3", "targetname");
trig = getent("house1door3trigger", "targetname");

while(1)
{
trig waittill("trigger");
door3 rotateyaw(90, 1.5, 0.7, 0.7);
door3 waittill("rotatedone");
wait(3);
door3 rotateyaw(-90, 1.5, 0.7, 0.7);
door3 waittill("rotatedone");
}
}


The name of the trigger and the door must match the names you gave them in the Entity Window for the key named targetname. Save your script and you are done. Remember to name your script file using the same name as your ".map" file but use the file extension of ".gsc". In order to save the file without having Notepad add the ".txt" to the end of the filename, you change the file type to "all files" before saving. You now have a door that will prompt you to "use" it to open it and then swing open, pause and then swing back closed. Don't let the door hit you on the way out.


k. Making Sliding Doors Movable.

The procedure for making a sliding door is nearly the same process. Follow all the steps to create the door, just as I did with the rotating doors. You do not create an origin brush as there is no rotation point. We will simply be moving the entity/object in one single direction. In this case we will be moving it in the X-Axis. There are three commands to use for moving, movex, movey, and movez. Then when it comes to the scripting, there is where the difference begins. The altered or rather new script is shown below for the fifth door I have added.

Game Script Command File, mapname.gsc with another new thread added:
main()
{
maps\_load::main();
thread house1door3_rotate();
thread house1door4_slide();
}
house1door3_rotate()
{
door3 = getent("house1door3", "targetname");
trig = getent("house1door3trigger", "targetname");

while(1)
{
trig waittill("trigger");
door3 rotateyaw(90, 1.5, 0.7, 0.7);
door3 waittill("rotatedone");
wait(3);
door3 rotateyaw(-90, 1.5, 0.7, 0.7);
door3 waittill("rotatedone");
}
}
house1door4_slide()
{
door4 = getent("house1door4", "targetname");
trig4 = getent("house1door4trigger", "targetname");
while(1)
{
trig waittill("trigger");
door4 movex(-50, 2.5, 0.8, 0.8);
door4 waittill("movedone");
wait(3);
door4 movex(50, 2.5, 0.8, 0.8);
door4 waittill("movedone");
}
}


I am proud of myself with this one. Without any list of the commands available to me, other than the list in the documentation, which leaves out a lot, I simply used movedone instead of rotatedone without even knowing if it was a valid argument. It worked, so it must be.

Once again, be careful in making names. Be certain not to use reserved names, make them unique and special. They are less likely to cause problems.






This Home Page was created with Notepad
by Barry Stephen Nieuport
on 04 February 2007
Revised On Saturday, 23 June 2007 22:15 EST
Copyright © 2007
Barry Stephen Nieuport
barrynieuport@hotmail.com