Author |
Topic: Moving a brush. |
jelvischan |
General Member Since: Jun 22, 2012 Posts: 48 Last: Feb 15, 2014 [view latest posts] |
|
|
Category: CoD2 MP Mapping Posted: Friday, Jul. 6, 2012 05:20 pm |
|
I have this code, but there seems to be a problem, can someone take a look at it and see if anything is wrong?
The problem is that when I trigger trig_Secret1, nothing happens... the brush doesn't move.
Code: secret()
{
plat=getent("secret","targetname");
trig=getent("trig_secret1","targetname");
esc1=getent("openup","targetname");
while(1)
{
trig waittill ("trigger");
esc1 notsolid();
plat movex (300,3,2,2);
plat waittill ("movedone");
wait(2);
plat movey (1792,3,2,2);
plat waittill ("movedone");
wait(2);
plat movex (-2500,3,2,2);
plat waittill ("movedone");
wait(2);
plat movez (1368,3,2,2);
plat waittill ("movedone");
wait(2);
esc1 solid();
}
} |
|
|
|
Tally |
General Member Since: Apr 21, 2005 Posts: 819 Last: Oct 26, 2012 [view latest posts] |
|
|
Category: CoD2 MP Mapping Posted: Friday, Jul. 6, 2012 05:57 pm |
|
jelvischan writes...Quote: I have this code, but there seems to be a problem, can someone take a look at it and see if anything is wrong?
The problem is that when I trigger trig_Secret1, nothing happens... the brush doesn't move.
Code: secret()
{
plat=getent("secret","targetname");
trig=getent("trig_secret1","targetname");
esc1=getent("openup","targetname");
while(1)
{
trig waittill ("trigger");
esc1 notsolid();
plat movex (300,3,2,2);
plat waittill ("movedone");
wait(2);
plat movey (1792,3,2,2);
plat waittill ("movedone");
wait(2);
plat movex (-2500,3,2,2);
plat waittill ("movedone");
wait(2);
plat movez (1368,3,2,2);
plat waittill ("movedone");
wait(2);
esc1 solid();
}
}
The reason why trig_secret1 doesn't move is because you aren't telling it to. Other than having the trigtrig_secret1 wait for a player to trigger it, there is nothing in that piece of code to handle trigtrig_secret1. |
|
|
|
jelvischan |
General Member Since: Jun 22, 2012 Posts: 48 Last: Feb 15, 2014 [view latest posts] |
|
|
Category: CoD2 MP Mapping Posted: Friday, Jul. 6, 2012 06:03 pm |
|
Tally writes...Quote: jelvischan writes...Quote: I have this code, but there seems to be a problem, can someone take a look at it and see if anything is wrong?
The problem is that when I trigger trig_Secret1, nothing happens... the brush doesn't move.
Code: secret()
{
plat=getent("secret","targetname");
trig=getent("trig_secret1","targetname");
esc1=getent("openup","targetname");
while(1)
{
trig waittill ("trigger");
esc1 notsolid();
plat movex (300,3,2,2);
plat waittill ("movedone");
wait(2);
plat movey (1792,3,2,2);
plat waittill ("movedone");
wait(2);
plat movex (-2500,3,2,2);
plat waittill ("movedone");
wait(2);
plat movez (1368,3,2,2);
plat waittill ("movedone");
wait(2);
esc1 solid();
}
}
The reason why trig_secret1 doesn't move is because you aren't telling it to. Other than having the trigtrig_secret1 wait for a player to trigger it, there is nothing in that piece of code to handle trigtrig_secret1.
No no, I don't want trig_Secret1 to move. I want secret to move after I trigger trig_secret1, but in-game I do just that and nothing happens. |
|
|
|
Tally |
General Member Since: Apr 21, 2005 Posts: 819 Last: Oct 26, 2012 [view latest posts] |
|
|
Category: CoD2 MP Mapping Posted: Friday, Jul. 6, 2012 08:56 pm |
|
Try this:
Code: init()
{
plat = getent( "secret","targetname" );
trig = getent( "trig_secret1","targetname" );
esc1 = getent( "openup","targetname" );
trig thread secret( plat, esc1 );
}
secret( plat, esc1 )
{
level endon( "intermission" );
for( ;; )
{
self waittill( "trigger", player );
if( isPlayer( player ) && player isTouching( self ) )
{
esc1 notsolid();
plat movex (300,3,2,2);
plat waittill ("movedone");
wait(2);
plat movey (1792,3,2,2);
plat waittill ("movedone");
wait(2);
plat movex (-2500,3,2,2);
plat waittill ("movedone");
wait(2);
plat movez (1368,3,2,2);
plat waittill ("movedone");
wait(2);
esc1 solid();
}
}
}
completely untested, but should do what you want to do. |
|
|
|
jelvischan |
General Member Since: Jun 22, 2012 Posts: 48 Last: Feb 15, 2014 [view latest posts] |
|
|
|
jelvischan |
General Member Since: Jun 22, 2012 Posts: 48 Last: Feb 15, 2014 [view latest posts] |
|
|
Category: CoD2 MP Mapping Posted: Friday, Jul. 6, 2012 09:55 pm |
|
Tally writes...Quote: Try this:
Code: init()
{
plat = getent( "secret","targetname" );
trig = getent( "trig_secret1","targetname" );
esc1 = getent( "openup","targetname" );
trig thread secret( plat, esc1 );
}
secret( plat, esc1 )
{
level endon( "intermission" );
for( ;; )
{
self waittill( "trigger", player );
if( isPlayer( player ) && player isTouching( self ) )
{
esc1 notsolid();
plat movex (300,3,2,2);
plat waittill ("movedone");
wait(2);
plat movey (1792,3,2,2);
plat waittill ("movedone");
wait(2);
plat movex (-2500,3,2,2);
plat waittill ("movedone");
wait(2);
plat movez (1368,3,2,2);
plat waittill ("movedone");
wait(2);
esc1 solid();
}
}
}
completely untested, but should do what you want to do.
Just tested with code, and nothing happens. I checked to make sure all the entity names matched, and they did. I don't have to thread anything do I at the top in mymapname.gsc? |
|
|
|