Page 1 of 2
a script
Posted: December 8th, 2006, 9:17 pm
by HavoC
would anyone happen to know how i could make a script that you have to go somehwere else in a map and press a button then it allows you to go through a teleporter, and if you dont make it back in a certain mount of time u do it again? i already have a teleporter script so i just need this 1 thx, i sux at scripting xD
Posted: December 9th, 2006, 8:49 pm
by Luke
I don't quite understand what you want to do. Press a button that allows you to use a teleporter, that sounds easy enough, make the button turn on the teleporter trigger?. If you don't make it back in a certain amount of time, you have to do it again. Back where? how and why do you have to get back?
Maybe you could add a wait time after you're teleported and it turns on a trigger multiple after that time. so if you were touching it after that time you could make it set the users origin.
a script
Posted: December 11th, 2006, 3:15 am
by HavoC
ok, i did explain it kind of bad last time sry, ok if this helps i meant, theres a teleporter, and in order to be able to use the teleporter u have to press a certain button. Once u press the button u can then use the teleporter. thx if this helped
Posted: December 11th, 2006, 3:36 am
by Nightmare
ok, make a two triggers one will activate(activate_trig) the other trigger(teleporter_trig).
Place them where you want and add this to your script. Note: Untested.
Code: Select all
teleporter_timer()
{
activate_trig = getent("activate_trig","targetname");
teleport_trig = getent("teleport_trig","targetname");
teleport_trig thread maps\mp\_utility::triggerOff();
while(1)
{
activate_trig waittill ("trigger");
teleport_trig thread maps\mp\_utility::triggerOn();
wait 10;
teleport_trig thread maps\mp\_utility::triggerOff();
}
}
teleporter()
{
while(1)
{
players = getentarray("player", "classname");
for(i=0;i<players.size;i++)
{
finishtrig = getent ("teleport_trig","targetname");
finishtrig waittill ("trigger",user);
user setOrigin( (452, 1072,168) );
}
wait .5;
}
}
a script
Posted: December 11th, 2006, 4:12 am
by HavoC
thx, but would u no where the bad syntax is in the script? i get error bad syntax
Code: Select all
main()
{
thread teleporter_timer();
{
teleporter_timer()
{
activate_trig = getent("activate_trig","targetname");
teleport_trig = getent("teleport_trig","targetname");
teleport_trig thread maps\mp\_utility::triggerOff();
while(1)
{
activate_trig waittill ("trigger");
teleport_trig thread maps\mp\_utility::triggerOn();
wait 10;
teleport_trig thread maps\mp\_utility::triggerOff();
}
}
teleporter()
{
while(1)
{
players = getentarray("player", "classname");
for(i=0;i<players.size;i++)
{
finishtrig = getent ("teleport_trig","targetname");
finishtrig waittill ("trigger",user);
user setOrigin( (452, 1072,168) );
}
wait .5;
}
}
Posted: December 11th, 2006, 1:13 pm
by All-Killer
run youre game in developer 1 to give us the extact error. Typ in console /developer 1 and then load youre map. than you will see a bigger explanation about the error
Posted: December 11th, 2006, 3:12 pm
by Luke
Yeah, from having a quick look it looks like the teleporter thread isn't being threaded, and the main thread wasn't closed with a }.
Try
Code: Select all
main()
{
thread teleporter_timer();
thread teleporter();
}
a script
Posted: December 11th, 2006, 5:14 pm
by HavoC
k thx luke that got rid of the error, but tell me if im doing this wrong plz cause this is wut i did and its not working, first i just made a small button and put i trigger use right near it, i named the trigger use activate_trig, then i made a trigger multiple for the teleporter and named it teleport_trig. then i made the trigger multiple for the teleporter a target also, which i just named hi then i made a script origin and that had a targetname which was hi. then it didnt work. tell me if im doing something rong plz, thxill try and look out if i named something rong or something
a script
Posted: December 11th, 2006, 5:18 pm
by HavoC
sry guyz, i named the targetname rong, it works now, thx for the script and the help

Posted: December 11th, 2006, 7:44 pm
by All-Killer
hehe, first off all when somtings not work check the targetnames in the editor and script. At me when i getent all the targetnames i copy pasy and sometimes forget to change something and then it dont work
Posted: December 11th, 2006, 9:46 pm
by Nightmare
no problem man
I am starting to beat drof at this. Watch out drof, your days are numbered

Posted: December 12th, 2006, 12:34 am
by Drofder2004
Nightmare wrote:I am starting to beat drof at this.
* Drofder has moved on from amateur scripts
a script
Posted: December 12th, 2006, 2:12 am
by HavoC
ok, wen i use the moving platform script from nightmares tut it works but when i try to put more directions in for platform to do, it does it on the rong side it does them backyards. any idea? the scripts are
Code: Select all
main()
{
thread platform1();
}
platform1()
{
platform = getent ("platform1","targetname");
while(1)
{
platform moveY (88,1,0.3,0.3);
wait(5);
platform moveZ (188,1,0.3,0.3);
wait(5);
platform moveX (266,1,0.3,0.3);
wait(5);
platform moveZ (266,1,0.3,0.3);
wait(5);
platform moveY (200,1,0.3,0.3);
wait(5);
platform moveX (266,1,0.3,0.3);
wait(5);
platform moveY (266,1,0.3,0.3);
wait(5);
platform moveZ (266,1,0.3,0.3);
wait(5);
platform moveY (266,1,0.3,0.3);
wait(5);
platform moveZ (195,1,0.3,0.3);
wait(5);
platform moveZ (-195,1,0.3,0.3);
wait(5);
platform moveY (-266,1,0.3,0.3);
wait(5);
platform moveZ (-266,1,0.3,0.3);
wait(5);
platform moveY (-266,1,0.3,0.3);
wait(5);
platform moveX (-266,1,0.3,0.3);
wait(5);
platform moveY (-200,1,0.3,0.3);
wait(5);
platform moveZ (-266,1,0.3,0.3);
wait(5);
platform moveX (-266,1,0.3,0.3);
wait(5);
platform moveZ (-188,1,0.3,0.3);
wait(5);
platform moveY (-88,1,0.3,0.3);
wait(5);
platform waittill ("movedone");
}
}
and
Code: Select all
main()
{
thread platform2();
}
platform2()
{
platform = getent ("platform2","targetname");
trigger = getent ("trig_platform","targetname");
while(1)
{
platform moveY (88,1,0.3,0.3);
wait(5);
platform moveZ (188,1,0.3,0.3);
wait(5);
platform moveX (266,1,0.3,0.3);
wait(5);
platform moveZ (266,1,0.3,0.3);
wait(5);
platform moveY (200,1,0.3,0.3);
wait(5);
platform moveX (266,1,0.3,0.3);
wait(5);
platform moveY (266,1,0.3,0.3);
wait(5);
platform moveZ (266,1,0.3,0.3);
wait(5);
platform moveY (266,1,0.3,0.3);
wait(5);
platform moveZ (195,1,0.3,0.3);
wait(5);
platform moveZ (-195,1,0.3,0.3);
wait(5);
platform moveY (-266,1,0.3,0.3);
wait(5);
platform moveZ (-266,1,0.3,0.3);
wait(5);
platform moveY (-266,1,0.3,0.3);
wait(5);
platform moveX (-266,1,0.3,0.3);
wait(5);
platform moveY (-200,1,0.3,0.3);
wait(5);
platform moveZ (-266,1,0.3,0.3);
wait(5);
platform moveX (-266,1,0.3,0.3);
wait(5);
platform moveZ (-188,1,0.3,0.3);
wait(5);
platform moveY (-88,1,0.3,0.3);
wait(5);
platform waittill ("movedone");
}
}
, so they do work but it does it in reverse
Posted: December 12th, 2006, 2:44 am
by Nightmare
then what you want to do is switch the negatives in front of the first numbers
also add a
after every movement to ensure that your platforms are glitch free
a script
Posted: December 12th, 2006, 6:14 pm
by HavoC
k i tryed, but now the platform disappeared? would u knw y that happened?