Ya know what i found is that cod 2 doesn't like door period. I think you should just take them all out. I put in door and half the time they work and the other half they don't. They just won't open sometimes from one side. so you go around to the other side and the door opens fine. then you run back to the front side that just failed and all of the sudden for no reason at all it's working again. I have decided that doors in cod 2 suck and it's a waste of time mapping them. but if you have to have a doors, here is a script that works better
//doors.gsc (bionic.nipple@gmail.com)
// Yes, another door opening script. What's different about this one
// is that you can add as many doors in your map that you want without
// having to change the scripting. I tried to keep the scripting as
// isolated from the mapper as possible.
//
// Usage:
// 1) drop this file in maps\mp\
// 2) add this line to mp_mapname::main()
// thread maps\mp\doors::main();
// 3) add doors to your map as described below
//
// Doors:
// 1) Draw a door brush. Deselect it.
// 2) Draw an origin brush (a brush with the "origin" texture). Center this
// brush on the door's "hinge". Deselct it.
// 3) Select the door brush and then select the origin brush.
// 4) Hit "n" and then double click on "script_brushmodel" from the list that
// pops up.
// 5) Near the bottom enter "targetname" for key and "door_xxx" for value
// where xxx is a unique name. e.g. door_church1
// 6) Hit enter after typing door_xxx. The key and value should now show up
// in the list in the middle.
// 7) Again, near the bottom enter "script_noteworthy" for key and "x" or
// "y" for value. "y" if the door faces north\south, "x" "if east\west"
// 8) Deselect those brushes. Draw a new brush with the "trigger" texture.
// 9) Hit "n" and double click "trigger_use_touch" for the list that pops up.
// 10) Do step #5 again for this brush. Use the same xxx you used before.
main(){
//[Nip] Search through and find all the door triggers in our map and monitor them.
ents = getentarray();
for (i=0; i
if (startsWith(ents
.classname, "trigger_use") && startsWith(ents.targetname, "door_")){
ents thread monitor_door();
}
}
}
monitor_door(){
//[Nip] We only want 1 trigger_use and 1 script_brushmodel for each targetname (door)
ents = getentarray(self.targetname, "targetname");
if (ents.size != 2){
logprint("DOOR_ERROR: There can be only 2 door ents for " + self.targetname +".\n");
return;
}
//[Nip] Find the door brushmodel that corresponds to this trigger.
door = undefined;
if (ents[0].classname == "script_brushmodel")
door = ents[0];
else if (ents[1].classname == "script_brushmodel")
door = ents[1];
else {
logprint("DOOR_ERROR: No script_brushmodel found for " + self.targetname +".\n");
return;
}
//[Nip] Find out which direction this door faces. Default to X ("north\south")
direction = "x";
if (isDefined(door.script_noteworthy) && door.script_noteworthy == "y")
direction = "y";
//[Nip] Save the home position of the door so we can close it regardless of what happens.
door.home = door.angles;
d = door getorigin();
while (1){
self waittill("trigger", player);
p = player getorigin();
//[Nip] Determine which way to rotate the door. I'd need a white
// board to explain this in detail. Sorry.
dest = 90;
if (p[0] > d[0]) dest *= -1;
if (p[1] > d[1]) dest *= -1;
if (direction == "y") dest *= -1;
//[Nip] Open the door, wait, closes the door.
door rotateto((0, dest, 0), 1);
door waittill("rotatedone");
wait 2;
door rotateto(door.home, 1);
door waittill("rotatedone");
}
}
//[Nip] Returns wether or not string starts with pattern.
// e.g assert(startsWith("mp_farmhouse", "mp_") == true);
startsWith(string, pattern){
if (string == pattern) return true;
if (pattern.size > string.size) return false;
for (i=0; i
if (string != pattern) return false;
return true;
}