Thanks to megazoR
[12:22] mеgazor: i can send script but its very specific
[12:24] php: just wanted to give a heads up
[12:24] php: u got referenced!!
[12:24] php: omgggggg
[12:24] mеgazor: ye ![Smile](images/smilies/smile.png)
[12:24] mеgazor:
PHP Code:
escalator_stuff()
{
level.esc_time = .05;
//setCvar("esc_time", level.esc_time);
steps = getEntArray("step", "targetname");
for (i = 0; i < steps.size; i++) //26 steps
{
steps[i] thread steps(1);
wait level.esc_time;
}
wait 1;
level.esc_time = 1;
level.esc_speed = 5;
getEnt("esc_speed_"+level.esc_speed, "targetname").origin = (0, 8.01, 0);
getEnt("esc_speed_plus", "targetname") thread esc_speed("plus");
getEnt("esc_speed_minus", "targetname") thread esc_speed("minus");
//thread haha();
}
esc_speed(method)
{
self waittill("trigger", user);
if (user.origin[1] < -8280.88)
{
self thread esc_speed(method);
return;
}
getEnt("esc_speed_"+level.esc_speed, "targetname").origin = (0, 0, 0);
if (method == "plus")
{
level.esc_speed++;
if (level.esc_speed == 11)
level.esc_speed = 0;
}
else if (method == "minus")
{
level.esc_speed--;
if (level.esc_speed == -1)
level.esc_speed = 10;
}
if (level.esc_speed == 1)
level.esc_time = 16;
if (level.esc_speed == 2)
level.esc_time = 8;
if (level.esc_speed == 3)
level.esc_time = 4;
if (level.esc_speed == 4)
level.esc_time = 2;
if (level.esc_speed == 5)
level.esc_time = 1;
if (level.esc_speed == 6)
level.esc_time = .8;
if (level.esc_speed == 7)
level.esc_time = .6;
if (level.esc_speed == 8)
level.esc_time = .4;
if (level.esc_speed == 9)
level.esc_time = .2;
if (level.esc_speed == 10)
level.esc_time = .1;
if (isDefined(level.esc_stop))
level.esc_stop = undefined;
if (level.esc_speed == 0)
level.esc_stop = 1;
getEnt("esc_speed_"+level.esc_speed, "targetname").origin = (0, 8.01, 0);
self thread esc_speed(method);
}
steps(flag)
{
if (flag)
{
self moveTo((0, 0, -24), .05); //moveTo is a more accurate method than setting an origin
wait .05;
}
for (i = 0; i < 3; i++)
{
while (isDefined(level.esc_stop)) // To stop the escalator, I had to use this stupid code
{ // I tried many different variants and only this one worked
self moveTo(self.origin, .05);
wait .05;
}
self moveY(-17, level.esc_time);
wait level.esc_time; //the waittill() function doesn't work properly as it causes short pauses between motions
}
d = -2;
lol = .125;
for (i = 1; i < 5; i++)
{
if (i > 1)
{
d = (i-1)*(-4);
lol = (i-1)*.25;
}
while (isDefined(level.esc_stop))
{
self moveTo(self.origin, .05);
wait .05;
}
self moveTo(self.origin+(0, lol-17, d), level.esc_time);
wait level.esc_time;
}
for (i = 0; i < 12; i++)
{
while (isDefined(level.esc_stop))
{
self moveTo(self.origin, .05);
wait .05;
}
self moveTo(self.origin+(0, -16, -16), level.esc_time);
wait level.esc_time;
}
for (i = 4; i > 0; i--)
{
if (i > 1)
{
d = (i-1)*(-4);
lol = (i-1)*.25;
}
else
{
d = -2;
lol = .125;
}
while (isDefined(level.esc_stop))
{
self moveTo(self.origin, .05);
wait .05;
}
self moveTo(self.origin+(0, lol-17, d), level.esc_time);
wait level.esc_time;
}
for (i = 0; i < 3; i++)
{
while (isDefined(level.esc_stop))
{
self moveTo(self.origin, .05);
wait .05;
}
self moveY(-17, level.esc_time);
wait level.esc_time;
}
while (isDefined(level.esc_stop))
{
self moveTo(self.origin, .05);
wait .05;
}
self.origin = (0, 0, -24);
self thread steps(0);
}
*/