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

Members Online

»
0 Active | 7 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 MP Mapping
CoD 2 mapping and level design.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: door scripts faillure
baasje
General Member
Since: Oct 24, 2005
Posts: 23
Last: Mar 1, 2008
[view latest posts]
Level 1
Category: CoD2 MP Mapping
Posted: Wednesday, Nov. 22, 2006 06:35 am
this is my script:

main()
{
maps\mp\_load::main();

thread door1_rotate();
thread door2_rotate();
thread door3_rotate();

}


door1_rotate()
{
door1 = getent("door1", "targetname");
trig = getent("door_trigger1", "targetname");
while (1)
{
trig waittill("trigger");
door1 rotateYaw(90, 1.5, 0.7, 0.7);
door1 waittill("rotatedone");
wait (3);
door1 rotateYaw(-90, 1.5, 0.7, 0.7);
door1 waittill("rotatedone");
}
}

door2_rotate()
{
door2 = getent("door2", "targetname");
trig = getent("door_trigger2", "targetname");
while (1)
{
trig waittill("trigger");
door2 rotateYaw(90, 1.5, 0.7, 0.7);
door2 waittill("rotatedone");
wait (3);
door2 rotateYaw(-90, 1.5, 0.7, 0.7);
door2 waittill("rotatedone");
}
}

door3_rotate()
{
door3 = getent("door3", "targetname");
trig = getent("door_trigger3", "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");
}
}

and the error:


******* script runtime error *******
undefined is not an object: (file 'maps/mp/mp_gert.gsc', line 48)
trig waittill("trigger");
*
called from:
(file 'maps/mp/mp_gert.gsc', line 7)
thread door3_rotate();
*
started from:
(file 'maps/mp/mp_gert.gsc', line 1)
main()
*
************************************

can anybody help please :)

Share |
lauramaegan
General Member
Since: Aug 9, 2004
Posts: 630
Last: Feb 11, 2007
[view latest posts]
Level 6
Category: CoD2 MP Mapping
Posted: Wednesday, Nov. 22, 2006 10:58 am
I don't do anything with cod2 but the first thing that stands out to me is that all of your triggers are being defined as the same thing:
trig = getent("door_trigger1", "targetname");
trig = getent("door_trigger2", "targetname");
trig = getent("door_trigger3", "targetname");

Try something like so:
trig1 = getent("door_trigger1", "targetname");
trig2 = getent("door_trigger2", "targetname");
trig3 = getent("door_trigger3", "targetname");

Share |
FlesyM
General Member
Since: Jul 24, 2005
Posts: 399
Last: Jan 24, 2008
[view latest posts]
Level 5
Category: CoD2 MP Mapping
Posted: Wednesday, Nov. 22, 2006 07:21 pm
what lauramaegan said could be true.
but it is also possible that the "trig"s are local to each functions.

since the error happened in door3_rotate() only, I got the feeling you do not have a trigger called "door_trigger3" in your map, resulting in "trig" not being defined, which caused the waittill not to work because it doesn't work on undefined entities.

but if you ask me, that method is really hard when the amount of doors gets high .... and repeating code is never good. if you know ur way around scripts, I suggest you make a prefab out of the doors (using auto "targets" - w key) and write only one script that will be applied to all doors on the map... it's a lot easier script wise.
Share |
Creator
General Member
Since: Mar 30, 2006
Posts: 240
Last: Feb 3, 2008
[view latest posts]
Level 4
Category: CoD2 MP Mapping
Posted: Wednesday, Nov. 22, 2006 09:57 pm
i dont think thats it, cause the threads are closed
check the trigger targetnames inside cod rad thats probable the problem

creator.
Share |
cybershot
General Member
Since: Dec 29, 2005
Posts: 944
Last: Mar 4, 2018
[view latest posts]
Level 7
Category: CoD2 MP Mapping
Posted: Thursday, Nov. 23, 2006 02:08 am
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;
}
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 MP Mapping

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

»