Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 44 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Tutorials

»
CoD4 Mapping
ratings:
Awful Rating
Poor Rating
Average Rating
Good Rating
Excellent Rating
Useable (MP/SP) Doors
Versions: You must be logged in to view history.

 

==============
NORMAL DOORS
==============


In Radiant, draw your door.

Next, duplicate the door, and line up the duplicated door over the original.
Change your grid to 0.5.


Next, we need to create the hinge with this duplicated door. Resize the duplicated brush to fit only one of the sides, but make sure that this part, being the hinge, is inside the wall, but still touching the door, and the thinnest it can be in 0.5 grid. Texture it tools>origin.

Should look like this.

Door With Hinge

The reason it needs to be so thin is because this is what the door rotates from, and it will rotate from the center of this origin brush. If the origin brush is too fat, the door will rotate inside the wall and look bad.

Door With Hinge (Top View)

Then select your door and your origin brush, right click 2D screen and go to script>brushmodel. Both brushes should now be Blue, in the 2D window.

Next, draw a brush for your trigger, make it at least the height of the door and a little wider if you can.  While this brush is selected, right click your 2D window and go to trigger>use_touch.

Trigger_Use_touch = Player must press use key to activate Trigger, while touching trigger.

Triggers


While the trigger only is selected, press "N" and give it the following values.
Key: targetname
Value: door_trig


"door_trig" is the targetname we are using in our script.


You can also give the trigger some hintstring values if you want.  This one pops up the text, "Press [ ] To Use"  If the player uses the key Q for his use key, then it would say "Press Q to Use"


Key: hintstring
Value: PLATFORM_HOLD_TO_USE


And/or you can give the door that little white hand that pops up.
Key: cursorhint
Value: HINT_ACTIVATE


 

We need to also tell this trigger which way we want the door to open. Will it open 90? or -90? or whatever.  This script allows you to give different doors different values of rotation.  One script can work on any door in your map and it can open any direction.  This value must be added!  The script needs to know a value for "count".

Key: count
Value: 90


Give the door the following value. It must be one or the other (90 or -90). This tells the door which way to open, towards you or away from you.  Towards and away, depend on the position of the door in Radiant, on it's X and Y axis.  I usually just assign it a 90 value, then when I run the map, if the door opens the direction I want, I leave it.  If it doesn't, I change it to -90.

Remember, the value DOES NOT have to be 90, it can be really any number under 180.  90 is simply a right angle.  Know your angles if you are going to be using other numbers.


So now the trigger is set up, only thing left to do is link the trigger to the door and hinge, and since the door and hinge is already one script_brushmodel family, we simply First select the trigger, then just one piece of the door, and press "W".
A Blue LINE with an arrow pointing from the trigger to the door should now be visible. And all brushes should suddenly be selected.
All parts of the door, the hinge, and the trigger.  If you can't see the line, then just pull the trigger away from the door to make sure it exists, then move it back.

Radiant Complete.

 

If you notice in the last picture, there are two doors.  This is because I have two scripts.  One of them allows the player to open and close the door, while the other allows the player to open the door, and it stays open for 5 seconds, then closes on its own.

 

=========

SCRIPTING

=========

Use One of the following scripts for this door setup.



If you want to edit the time of the door staying open, edit the:

wait (5);

Nearing the end of SCRIPT #1, this wait time tells the door how long to stay open for.

SCRIPT #1 (Door Closes after 5 seconds)

 

main()
{
thread self_closing_doors();
}

self_closing_doors()
{
doors = getentarray("door_trig","targetname");
for(i=0; i<doors.size; i++)
{
doors[i] thread door_think();
}
}

door_think()
{
self.doormoving = false;
self.doormodel = getent(self.target, "targetname");

while(1)
{
self waittill("trigger");
if(!self.doormoving)
{
self thread door_move();
}
}
}

door_move()
{
self maps\mp\_utility::triggerOff();
self.doormoving = true;
self.doormodel playsound("metal_open");
self.doormodel rotateyaw(self.count, 2, 0.5, 0.5);
self.doormodel waittill("rotatedone");
wait (5);
self.doormodel playsound("metal_close");
self.doormodel rotateyaw((self.count * -1), 2, 0.5, 0.5);
self.doormodel waittill("rotatedone");
self maps\mp\_utility::triggerOn();
self.doormoving = false;
}

 

 

 

SCRIPT #2 (Player Must Close Door)

 

main()
{
thread player_closing_doors();
}

player_closing_doors()
{
doors = getentarray("door_trig","targetname");
for(i=0; i<doors.size; i++)
{
doors[i] thread door_think();
}
}

door_think()
{
self.doormoving = false;
self.doorclosed = true;
self.doormodel = getent(self.target, "targetname");

while(1)
{
self waittill("trigger");
if(!self.doormoving)
{
self thread door_move();
}
}
}

door_move()
{
self.doormoving = true;
if(self.doorclosed)
{
self maps\mp\_utility::triggerOff();
self.doormodel playsound("metal_open");
self.doormodel rotateyaw(self.count, 2, 0.5, 0.5);
self.doormodel waittill("rotatedone");
self maps\mp\_utility::triggerOn();
self.doorclosed = false;
}
else
{
self maps\mp\_utility::triggerOff();
self.doormodel playsound("metal_close");
self.doormodel rotateyaw((self.count * -1), 2, 0.5, 0.5);
self.doormodel waittill("rotatedone");
self maps\mp\_utility::triggerOn();
self.doorclosed = true;
}
self.doormoving = false;
}

 

 

 

=========

FILE HANDLING

=========

Name the script you chose to something as such > mp_mymapname_doors.gsc  

Obviously name the "mymapname" to the name of your map.

 

Place it in the following path > maps/mp/mp_mymapname_doors.gsc

So that's it, don't forget to add the script to your zone file, and to pick out a sound to use for your door.

Open your mp_mymapname.gsc

Add the following line:

maps/mp/mp_mymapname_doors::main();

Which is the name of the .gsc/script!

Then in your Zone file, make sure the following line exists.

rawfile/maps/mp/mp_mymapname_doors.gsc

Rebuild your FASTFILE and test your new doors!

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»