| Author |
Topic: I still cant make a usable door? |
| dkbiker3501 |
General Member Since: May 5, 2009 Posts: 26 Last: Aug 25, 2010 [view latest posts] |
|
|
|
|
| dkbiker3501 |
General Member Since: May 5, 2009 Posts: 26 Last: Aug 25, 2010 [view latest posts] |
|
|
|
|
| DeekCiti |
 |
General Member Since: Mar 13, 2008 Posts: 1293 Last: Jul 9, 2016 [view latest posts] |
|
|
|
Category: CoD4 MP Mapping Posted: Thursday, May. 14, 2009 12:46 am |
 |
==============
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.
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.
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 the trigger only is selected, press "N" and give it the following values.
Key: targetname
Value: door_trig
You can also give it some hintstring values if you want.
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.
Give the door the following value. It must be one or the other. This tells the door which way to open, towards you or away from you.
Key: count
Value: 90
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.
Radiant Complete.
=========
SCRIPTING
=========
Use One of the following scripts for this door setup.
SCRIPT #1 (Door Closes after 5 seconds)
Code: main()
{
thread player_doors();
}
player_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", player);
self maps\mp\_utility::triggerOff();
if(!self.doormoving)
self thread door_move();
}
}
door_move()
{
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)
Code: main()
{
thread player_doors();
}
player_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", player);
self maps\mp\_utility::triggerOff();
if(!self.doormoving)
self thread door_move();
}
}
door_move()
{
self.doormoving = true;
if(self.doorclosed)
{
self.doormodel playsound("metal_open");
self.doormodel rotateyaw(self.count, 2, 0.5, 0.5);
self.doormodel waittill("rotatedone");
self maps\mp\_utility::triggerOn();
}
else
{
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;
}
Name the script to something as such > mp_mymapname_doors.gsc
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 |
 |
|
|
| dkbiker3501 |
General Member Since: May 5, 2009 Posts: 26 Last: Aug 25, 2010 [view latest posts] |
|
|
|
Category: CoD4 MP Mapping Posted: Thursday, May. 14, 2009 07:21 pm |
 |
DeekCiti writes...Quote: ==============
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.
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.
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 the trigger only is selected, press "N" and give it the following values.
Key: targetname
Value: door_trig
You can also give it some hintstring values if you want.
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.
Give the door the following value. It must be one or the other. This tells the door which way to open, towards you or away from you.
Key: count
Value: 90
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.
Radiant Complete.
=========
SCRIPTING
=========
Use One of the following scripts for this door setup.
SCRIPT #1 (Door Closes after 5 seconds)
Code: main()
{
thread player_doors();
}
player_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", player);
self maps\mp\_utility::triggerOff();
if(!self.doormoving)
self thread door_move();
}
}
door_move()
{
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)
Code: main()
{
thread player_doors();
}
player_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", player);
self maps\mp\_utility::triggerOff();
if(!self.doormoving)
self thread door_move();
}
}
door_move()
{
self.doormoving = true;
if(self.doorclosed)
{
self.doormodel playsound("metal_open");
self.doormodel rotateyaw(self.count, 2, 0.5, 0.5);
self.doormodel waittill("rotatedone");
self maps\mp\_utility::triggerOn();
}
else
{
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;
}
Name the script to something as such > mp_mymapname_doors.gsc
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
thanks so much deekciti. i was gonna use the script where you have to close it (2nd) but that script doesnt work. i tried the first one and it worked to i went with that. but now i need to make windows using the other script but it dont work. thanks for the help so far though
edited on May. 14, 2009 03:22 pm by dkbiker3501 |
 |
|
|
| MHZLaze |
General Member Since: Feb 4, 2006 Posts: 46 Last: Jun 24, 2009 [view latest posts] |
|
|
|
Category: CoD4 MP Mapping Posted: Monday, May. 18, 2009 09:13 pm |
 |
Avesome little post this one.. Just one thing.. You dont tell what kind of trigger your using?
Well ive tried getting this working a couple of days now
Got this other script working, but I want the doors to close themself again after 5 secs and this one dosent.. What do I need to add in this script to get that?
main()
{
level.doorclosed = true;
level.doormoving = false;
thread scripted_door();
}
////////////////////////////////////////////
////////////////////////////////////////////
scripted_door()
{
doortrigger = getentarray("doortrig","targetname");
if ( isdefined(doortrigger) )
for (i = 0; i < doortrigger.size; i++)
doortrigger thread door_think();
}
////////////////////////////////////////////
////////////////////////////////////////////
door_think()
{
while (1)
{
self waittill ("trigger");
if (!level.doormoving)
thread door_move();
}
}
door_move()
{
doormodel = getent(self.target, "targetname");
level.doormoving = true;
if (level.doorclosed)
{
doormodel rotateyaw (-90, 1, 0.5, 0.5);
doormodel waittill ("rotatedone");
level.doorclosed = false;
}
else
{
doormodel rotateyaw ( 90, 1, 0.5, 0.5);
doormodel waittill ("rotatedone");
level.doorclosed = true;
}
level.doormoving = false;
}
Ive used the trigger_multiple for this script and it works fine.. But to close the door I need to touch the trigger again.. And its a secret door, so want it closed fast hehe Anyone give me a Hint![[biggrin]](images/BBCode/smilies/biggrin.gif) |
 |
|
|
| =NB=watchdog |
General Member Since: Nov 12, 2009 Posts: 17 Last: May 28, 2011 [view latest posts] |
|
|
|
|
| DeekCiti |
 |
General Member Since: Mar 13, 2008 Posts: 1293 Last: Jul 9, 2016 [view latest posts] |
|
|
|
|
| DeekCiti |
 |
General Member Since: Mar 13, 2008 Posts: 1293 Last: Jul 9, 2016 [view latest posts] |
|
|
|
Category: CoD4 MP Mapping Posted: Monday, Nov. 30, 2009 09:02 pm |
 |
| attachment: application(7.4Kb) |
I see that it was a boolean problem in that other script.
Both scripts are now working. Use only one or the other. If you look at the source files included, you can see how they both can be used at the same time, for those new to this. Of course this is only if you want to have both kinds of doors in your map.
Door Closes After 5 Seconds (script)
Code: 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;
}
Player Must Close Door (script)
Code: 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;
}
For those interested, I've attached some files for help.
The testmap, with working doors. You'll have to compile the map though. I've included all the Source Files. |
 |
|
|
| RAMIDUS |
General Member Since: Aug 24, 2006 Posts: 91 Last: Nov 17, 2011 [view latest posts] |
|
|
|
|
| RAMIDUS |
General Member Since: Aug 24, 2006 Posts: 91 Last: Nov 17, 2011 [view latest posts] |
|
|
|
Category: CoD4 MP Mapping Posted: Wednesday, Apr. 7, 2010 08:52 pm |
 |
Hi, I'm working on WaW map, but everyone say it's 100% the same as in CoD4, and the issues are the same, too, so I have a same problem as dkbiker3501:
I did it as you said : Quote: Name the script to something as such > mp_mymapname_doors.gsc 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
1) I have a map called test (testing scripts),
2) I have a test.gsc in raw/maps/test.gsc, which looks like this:
Quote: #include maps\_utility;
#include common_scripts\utility;
#using_animtree( "generic_human" );
main()
{
// Don't give the player the default loadout, we want to specify it for our custom made map
level.dodgeloadout = true;
// Sets up all of the FX in the level
maps\test_fx::main();
// _load, sets up all of the basic entity behaviors
maps\_load::main();
// Sets the player's weapon loadout... This line should be right after _load::main(), and no waits/delays before it.
set_loadout();
// Sets up ambient sounds
maps\test_amb::main();
// Sets up "canned" animations
maps\test_anim::main();
// now the only change:
maps\test_sc::main();
}
// Sets the custom weapon loadout
set_loadout()
{
// Precache's / sets the list of weapons to give to the player when he spawns in
maps\_loadout::add_weapon( "colt");
maps\_loadout::add_weapon( "m1garand" );
maps\_loadout::add_weapon( "fraggrenade" );
maps\_loadout::add_weapon( "m8_white_smoke" );
// Sets the player's offhand throw weapon (aka smoke/flash)
maps\_loadout::set_secondary_offhand( "smoke" );
// Sets the player's default (if he does not have a pistol) laststand pistol.
maps\_loadout::set_laststand_pistol( "colt" );
// Sets the player's viewarms
maps\_loadout::set_player_viewmodel( "viewmodel_usa_marine_arms");
// Sets the player's viewarms when attacked by an enemy in a melee sequence or if a canned animation calls for them
maps\_loadout::set_player_interactive_hands( "viewmodel_usa_marine_player" );
// Switches the player's weapon once he spawns in
maps\_loadout::set_switch_weapon( "m1garand_bayonet" );
// Sets the campaign, which is used for battlechatter and other various scripts
level.campaign = "american";
// Precaches the 3rd person model (for when playing coop)
mptype\player_usa_marine::precache();
}
3) then I have a file with moving syntax:
raw/maps/test_sc.gsc
4) By the tips, found around here, I also edited the zone file at zone_source/test.csv:
Quote: // NOTE: If you add a comment, put a space after the double forward slash or you will get issues
ignore,code_post_gfx
ignore,common
// map specific files
col_map_sp,maps/test.d3dbsp
gfx_map,maps/test.d3dbsp
rawfile,maps/test.gsc
rawfile,maps/test_amb.gsc
rawfile,maps/test_anim.gsc
rawfile,maps/test_fx.gsc
// now the only change:
rawfile,maps/test_sc.gsc
// Weapons
weapon,sp/m1garand
weapon,sp/colt
weapon,sp/fraggrenade
weapon,sp/m8_white_smoke
// Viewarms
xmodel,viewmodel_usa_marine_arms
xmodel,viewmodel_usa_marine_player
// 3rd person model
include,common_player_us
5) after dozen of load fails, I changed the name of test_script.gsc to test_sc.gsc to prevent misspells, (cause I'm quite tired right now) I'm sure I changed the refference in both main gsc and csv file, but the question is, why it keeps on issuing "couldn't find script maps/test_script" in the game, although the file with this name stopped existing half an hour ago? I don't get it... if you do, please help ![[sad]](images/BBCode/smilies/sad.gif) good night till then (11 p.m. in Czech Republic now)
|
 |
|
|