Page 1 of 1

Working Gate Help

Posted: September 9th, 2009, 9:17 pm
by XNevanderX
Hey! I'm currently trying to make a functioning gate in my jump map that works like these types of gates:

Image

The idea of the gate movement is illustrated in the attached pic.

Anyone know how to make it work?

Re: Working Gate Help

Posted: September 9th, 2009, 10:11 pm
by Drofder2004
Post your current code and explain what you have tried so far maybe?

Re: Working Gate Help

Posted: September 9th, 2009, 10:58 pm
by XNevanderX
So far this is what I have in the GSC. My friend wrote most of it but he can't seem to figure it out either. We've tried replacing rotateYaw with rotatePitch, which made it fly into the sky, now it just goes at a backwards angle.

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

ambientPlay("NEV_FirstOneV2");

level.gate = "up";
getEnt( "gatetrig", "targetname" ) thread gate();

}

gate()
{
gate = getEnt( "gate", "targetname" );
self waittill( "trigger" );

if( level.gate == "up" )
{
gate rotateYaw( -90, 10 );
wait 10;
level.gate = "down";
}
else
{
gate rotateYaw( 90, 10 );
wait 10;
level.gate = "up";
}

wait 10;
self thread gate();
}

Re: Working Gate Help

Posted: September 10th, 2009, 12:26 am
by Drofder2004
KillerSam wrote:have you added an origin brush
That is all.

The most likely reason for the brush "spinning around the map", is because with no origin brush, the origin = 0,0,0, which is most likely what the brush is rotating around.

Re: Working Gate Help

Posted: September 10th, 2009, 8:17 pm
by XNevanderX
Well I had another friend work with it and this is what he ended up with in the script. He added what KS said to add but it's still not working. :(

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

ambientPlay("NEV_FirstOneV2");

thread gate();

getEnt( "gatetrig", "targetname" ) thread gate();
}

gate()
{
trigger = getEnt ("gatetrig","targetname");

alm = getEnt ("nev_gate","targetname");
{
trigger waittill ("trigger");

alm rotateYaw(90, 1);

alm waittill ("movedone");
}

}

Re: Working Gate Help

Posted: September 10th, 2009, 10:05 pm
by Drofder2004
Bad KS!

Code: Select all

main()
{
   maps\mp\_load::main();
   ambientPlay("NEV_FirstOneV2");

   getEnt( "gatetrig", "targetname" ) thread gate();
}

gate()
{
   alm = getEnt ("nev_gate","targetname");
   while(1)
   {
      self waittill ("trigger");

      alm rotateYaw(90, 1);
      alm waittill ("rotatedone");
      wait 10;
      alm rotateYaw(-90, 1);
   }
}
OR!

Code: Select all

main()
{
   maps\mp\_load::main();
   ambientPlay("NEV_FirstOneV2");

   getEnt( "gatetrig", "targetname" ) thread gate();
}

gate()
{
   alm = getEnt ("nev_gate","targetname");

   self waittill ("trigger");
   alm rotateYaw(90, 1);
}

Re: Working Gate Help

Posted: September 10th, 2009, 10:44 pm
by XNevanderX
Ok I've had my friend work on it for a while and here's what he's got. It only goes down then it won't go back up, so I'm missing one piece somewhere. Note I have two gates now.

Code: Select all

main()
{
maps\mp\_load::main();
thread gate();
thread gate2();
}

gate()
{
trigger = getent ("gatetrig","targetname");
alm = getent ("nev_gate","targetname");
while(1)
{
trigger	waittill ("trigger");
alm rotatepitch(90, 1);
alm waittill ("movedone");
trigger	waittill ("trigger");
alm rotatepitch(-90, 1);
alm waittill ("movedone");
}
}

gate2()
{
trigger = getent ("gatetrig2","targetname");
alm2 = getent ("nev_gate2","targetname");
while(1)
{
trigger	waittill ("trigger");
alm2 rotatepitch(-90, 1);
alm2 waittill ("movedone");
trigger	waittill ("trigger");
alm2 rotatepitch(90, 1);
alm2 waittill ("movedone");
}
}

Re: Working Gate Help

Posted: September 10th, 2009, 10:52 pm
by Drofder2004
Go look at my first code. That should work fine.

Re: Working Gate Help

Posted: September 10th, 2009, 11:56 pm
by XNevanderX
Ok guys, finally got it to work up and down. It works perfectly, now I'm just cleaning up around it so that it fits smoothly and all. My friend cool helped me with pretty much all of it, using information posted here by you guys. Thanks so much, now I can get this map done! :D

In case you were wondering, the final script looks like this:

Code: Select all

main()
{
	maps\mp\_load::main();
	
	ambientPlay("NEV_FirstOneV2");
	
	getEnt( "gatetrig", "targetname" ) thread gate();
	getEnt( "gatetrig2", "targetname" ) thread gate2();
}

gate()
{
	gate = getEnt( "nev_gate", "targetname" );
	
	while( 1 )
	{
		self waittill( "trigger" );
		gate rotatepitch( 90, 1 );
		gate waittill( "rotatedone" );
		self waittill( "trigger" );
		gate rotatepitch( -90, 1 );
		gate waittill( "rotatedone" );
	}
}

gate2()
{
	gate = getEnt( "nev_gate2", "targetname");
	
	while( 1 )
	{
		self waittill( "trigger" );
		gate rotatepitch( -90, 1 );
		gate waittill( "rotatedone" );
		self waittill( "trigger" );
		gate rotatepitch( 90, 1 );
		gate waittill( "rotatedone" );
	}
}