Author |
Topic: Rotating Doors |
jelvischan |
General Member Since: Jun 22, 2012 Posts: 48 Last: Feb 15, 2014 [view latest posts] |
|
|
Category: CoD2 MP Mapping Posted: Wednesday, Jul. 4, 2012 05:20 am |
|
My 2 doors rotate 90 degrees, but don't rotate back. Can someone check my scripts?
Code: ddoors()
{
door=getent("mcdoor","targetname");
door1=getent("mcdoor1","targetname");
trig=getent("trig_mcdoors","targetname");
while(1)
{
trig waittill ("trigger");
door rotateyaw (90,2,0.5,0.5);
door1 rotateyaw (-90,2,0.5,0.5);
door waittill ("rotatedone");
door1 waittill ("rotatedone");
door rotateyaw (-90,2,0.5,0.5);
door1 rotateyaw (90,2,0.5,0.5);
door waittill ("rotatedone");
door1 waittill ("rotatedone");
wait(5);
}
} |
|
|
|
serthy |
General Member Since: Sep 8, 2010 Posts: 482 Last: Jun 28, 2013 [view latest posts] |
|
|
|
Category: CoD2 MP Mapping Posted: Wednesday, Jul. 4, 2012 09:23 am |
|
hehehe easy :D
look at your code
you wait until yome1 triggers your switch then both doors will rotate simoultanous
then you call a door waittill( "rotatedone" ) so you script is waiting until door is done with the rotation and after this you wrote that your script should wait for door1' rotation end, but they will end at the same time, so it will wait until infinity ^^
you have to remove 1 waittill or use wait( 2 ) instead
Code:
ddoors()
{
door=getent("mcdoor","targetname");
door.oldangles = door.angles;
door1=getent("mcdoor1","targetname");
door1.oldangles = door1.angles;
trig=getent("trig_mcdoors","targetname");
// ( pitch , yaw , roll )
rotation = ( 0 , 90 , 0 );
time = 2;
opentime = 2;
while(1)
{
trig waittill ("trigger");
door rotateTo( door.angles + rotation , time , time / 2 , time / 2 );
door1 rotateTo( door1.angles + rotation , time , time / 2 , time / 2 );
wait( time + opentime );
door rotateTo( door.oldangles , time , time / 2 , time / 2 );
door1 rotateTo( door1.oldangles , time , time / 2 , time / 2 );
wait( time );
}
}
|
|
|
|
jelvischan |
General Member Since: Jun 22, 2012 Posts: 48 Last: Feb 15, 2014 [view latest posts] |
|
|
|
IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
Category: CoD2 MP Mapping Posted: Wednesday, Jul. 4, 2012 06:18 pm |
|
jelvischan writes...Quote: Wow how did you learn all this javascript?
Too bad you cant have sigs here on modsonline.
Would have mad a good quote to put in it. |
|
|
|
liltc64 |
General Member Since: Feb 12, 2007 Posts: 906 Last: Oct 22, 2012 [view latest posts] |
|
|
|
Category: CoD2 MP Mapping Posted: Wednesday, Jul. 4, 2012 07:23 pm |
|
|
|
|
|
jelvischan |
General Member Since: Jun 22, 2012 Posts: 48 Last: Feb 15, 2014 [view latest posts] |
|
|
Category: CoD2 MP Mapping Posted: Wednesday, Jul. 4, 2012 08:16 pm |
|
IzNoGoD writes...Quote: jelvischan writes...Quote: Wow how did you learn all this javascript?
Too bad you cant have sigs here on modsonline.
Would have mad a good quote to put in it.
It is java script right? |
|
|
|
serthy |
General Member Since: Sep 8, 2010 Posts: 482 Last: Jun 28, 2013 [view latest posts] |
|
|
|
|
jelvischan |
General Member Since: Jun 22, 2012 Posts: 48 Last: Feb 15, 2014 [view latest posts] |
|
|
Category: CoD2 MP Mapping Posted: Wednesday, Jul. 4, 2012 08:22 pm |
|
serthy writes...Quote: :0 No - lets say something similar..
Can you tell me what the name of the scripting language is? I wanna learn some online tutorials. |
|
|
|
StrYdeR |
General Member Since: May 11, 2004 Posts: 11672 Last: Apr 20, 2024 [view latest posts] |
|
|
|
|
|
jelvischan |
General Member Since: Jun 22, 2012 Posts: 48 Last: Feb 15, 2014 [view latest posts] |
|
|
Category: CoD2 MP Mapping Posted: Wednesday, Jul. 4, 2012 11:56 pm |
|
Hey I got those doors working! Thanks a lot guys!
Another question tho, I have a use button when someone presses it I want them to be teleported to the script>origin that I set up.
I got help from another person and they said that this code would work, but nothing happens when I click use in game:
Code: mchome()
{
trig=getent("home","targetname");
newplace=getent("backhome","targetname");
while(1)
{
trig waittill ("trigger");
self.origin = newplace.origin; //also tried newplace;
}
} |
|
|
|