a script

Have questions about CoD/UO mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

HavoC
CJ Fan
CJ Fan
Posts: 104
Joined: September 12th, 2006, 1:27 am

a script

Post by HavoC » December 8th, 2006, 9:17 pm

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

Luke
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 1774
Joined: May 31st, 2005, 12:42 am
Location: Cornwall, UK

Post by Luke » December 9th, 2006, 8:49 pm

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.
Watch this before posting a question: http://www.albinoblacksheep.com/flash/posting.php

HavoC
CJ Fan
CJ Fan
Posts: 104
Joined: September 12th, 2006, 1:27 am

a script

Post by HavoC » December 11th, 2006, 3:15 am

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

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » December 11th, 2006, 3:36 am

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;
   }
}
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

HavoC
CJ Fan
CJ Fan
Posts: 104
Joined: September 12th, 2006, 1:27 am

a script

Post by HavoC » December 11th, 2006, 4:12 am

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; 
   } 
}

All-Killer
CJ Worshipper
CJ Worshipper
Posts: 383
Joined: December 16th, 2005, 6:38 pm

Post by All-Killer » December 11th, 2006, 1:13 pm

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
Image

Luke
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 1774
Joined: May 31st, 2005, 12:42 am
Location: Cornwall, UK

Post by Luke » December 11th, 2006, 3:12 pm

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();
}
Watch this before posting a question: http://www.albinoblacksheep.com/flash/posting.php

HavoC
CJ Fan
CJ Fan
Posts: 104
Joined: September 12th, 2006, 1:27 am

a script

Post by HavoC » December 11th, 2006, 5:14 pm

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

HavoC
CJ Fan
CJ Fan
Posts: 104
Joined: September 12th, 2006, 1:27 am

a script

Post by HavoC » December 11th, 2006, 5:18 pm

sry guyz, i named the targetname rong, it works now, thx for the script and the help :D

All-Killer
CJ Worshipper
CJ Worshipper
Posts: 383
Joined: December 16th, 2005, 6:38 pm

Post by All-Killer » December 11th, 2006, 7:44 pm

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
Image

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » December 11th, 2006, 9:46 pm

no problem man

I am starting to beat drof at this. Watch out drof, your days are numbered :twisted:
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13315
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Post by Drofder2004 » December 12th, 2006, 12:34 am

Nightmare wrote:I am starting to beat drof at this.
:roll:


* Drofder has moved on from amateur scripts
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

HavoC
CJ Fan
CJ Fan
Posts: 104
Joined: September 12th, 2006, 1:27 am

a script

Post by HavoC » December 12th, 2006, 2:12 am

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

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » December 12th, 2006, 2:44 am

then what you want to do is switch the negatives in front of the first numbers
also add a

Code: Select all

platform waittill ("movedone");
after every movement to ensure that your platforms are glitch free
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

HavoC
CJ Fan
CJ Fan
Posts: 104
Joined: September 12th, 2006, 1:27 am

a script

Post by HavoC » December 12th, 2006, 6:14 pm

k i tryed, but now the platform disappeared? would u knw y that happened?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest