[Tutorial] How to add a buyable elevator (V2) [Now with call feature]

broken avatar :(
Created 768 days ago
by ZombieKid164
0 Members and 1 Guest are viewing this topic.
5,760 views

Poll

Question: Did this script help you?

Yes
2 (66.7%)
No
1 (33.3%)

Total Members Voted: 3

Voting closed: June 18, 2017, 01:28:57 am

broken avatar :(
×
broken avatar :(
Location: usCalifornia
Date Registered: 27 January 2018
Last active: 469 days ago
Posts
2
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
soap-0723's Groups
soap-0723's Contact & Social Links
How do you change it so that the power isn't required to operate it? sorry, im a noob.
broken avatar :(
×
broken avatar :(
Location: usCalifornia
Date Registered: 27 January 2018
Last active: 469 days ago
Posts
2
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
soap-0723's Groups
soap-0723's Contact & Social Links
Zombies wont follow me inside? i don't want people to go in there just to glitch my maps.. is there any fix?
broken avatar :(
×
broken avatar :(
Location: usArkansas
Date Registered: 1 November 2013
Last active: 17 days ago
Posts
5
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
joshs1982's Groups
joshs1982's Contact & Social Links
Could one of you please help me with my elevator code I'm not sure what I'm doing wrong? Here is my script.

main()
{
  level.elevDown=true;
  level.elevUp=true;
  level.elevMove=false;
  level.current_floor=0;
  level.current_floor=1;
  level.current_floor=2;
  switchTOP=getentarray("ups","targetname");
  for(i=0; i<switchTOP.size; i++)
   switchTOP[i] thread elev_think();
}

elev_think()
{
  IdoorLEFT=getent("leftindoor", "targetname");
  IdoorRIGHT=getent("rightindoor", "targetname");
  Odoor2L=getent("2leftdoor", "targetname");
  Odoor2R=getent("2rightdoor", "targetname");
  Odoor1L=getent("1leftdoor", "targetname");
  Odoor1R=getent("1rightdoor", "targetname");
  Odoor0L=getent("0leftdoor", "targetname");
  Odoor0R=getent("0rightdoor", "targetname");
  thread door_open(IdoorLEFT, IdoorRIGHT, OdoorBL, OdoorBR);
  while(1)
  {
   self waittill ("trigger");
   if(level.elevMove==false)
    {
     level.elevMove=true;
     thread elev_move();
    }
  }
}

elev_move()
{
  etime=5;
  zdirec="z";
  zdist1=376;
  zdist2=248;
  zdist3=0;
  IdoorLEFT=getent("leftindoor", "targetname");
  IdoorRIGHT=getent("rightindoor", "targetname");
  Odoor2L=getent("2leftdoor", "targetname");
  Odoor2R=getent("2rightdoor", "targetname");
  Odoor1L=getent("1leftdoor", "targetname");
  Odoor1R=getent("1rightdoor", "targetname");
  Odoor0L=getent("0leftdoor", "targetname");
  Odoor0R=getent("0rightdoor", "targetname");
  Elevator=getent("elevator", "targetname");
  if(level.current_floor==2)
   {
    door_close(IdoorLEFT, IdoorRIGHT, Odoor2L, Odoor2R);
    wait(.1);
    Elevator thread move_func(zdist1, etime, zdirec);
    IdoorLEFT thread move_func(zdist1, etime, zdirec);
    IdoorRIGHT thread move_func(zdist1, etime, zdirec);
    Elevator waittill ("movedone");
    door_open(IdoorLEFT, IdoorRIGHT, Odoor2L, Odoor2R);
    level.elevDown=true;
    level.elevUp=false;
    level.elevMove=false;
   }
   else if(level.current_floor==1)
   {
    door_close(IdoorLEFT, IdoorRIGHT, Odoor1L, Odoor1R);
    wait(.1);
    Elevator thread move_func(zdist2, etime, zdirec);
    IdoorLEFT thread move_func(zdist2, etime, zdirec);
    IdoorRIGHT thread move_func(zdist2, etime, zdirec);
    Elevator waittill ("movedone");
    door_open(IdoorLEFT, IdoorRIGHT, Odoor1L, Odoor1R);
    level.elevDown=true;
    level.elevUp=true;
    level.elevMove=false;
   }
  else(level.current_floor==0)
  {
   door_close(IdoorLEFT, IdoorRIGHT, OdoorTL, OdoorTR);
   wait(.1);
   Elevator thread move_func(zdist3, etime, zdirec);
   IdoorLEFT thread move_func(zdist3, etime, zdirec);
   IdoorRIGHT thread move_func(zdist3, etime, zdirec);
   Elevator waittill ("movedone");
   door_open(IdoorLEFT, IdoorRIGHT, Odoor0L, Odoor0R);
   level.elevDown=false;
   level.elevUp=true;
   level.elevMove=false;
  }
  wait(.1);
}

door_close(leftIN, rightIN, leftOUT, rightOUT)
{
  LDclose=-66.8;
  RDclose=-211.1;
  ydirec="x";
  dtime=1.1;
  leftIN thread move_func(LDclose,dtime, ydirec);
  rightIN thread move_func(RDclose,dtime, ydirec);
  wait(1);
  leftOUT thread move_func(LDclose,dtime, ydirec);
  rightOUT thread move_func(RDclose,dtime, ydirec);
  wait(1);
 }

door_open(leftyIN, rightyIN, leftyOUT, rightyOUT)
{
  LDopen=-26.8;
  RDopen=-251.1;
  ydirec="x";
  dtime=1.1;
  leftyOUT thread move_func(LDopen,dtime, ydirec);
  rightyOUT thread move_func(RDopen,dtime, ydirec);
  wait(1);
  leftyIN thread move_func(LDopen,dtime, ydirec);
  rightyIN thread move_func(RDopen,dtime, ydirec);
 }

move_func(dist,time,direc)
{
  if(direc=="z")
  self movez (dist, time, (time/2), (time/2));
  if(direc=="x")
   self movex (dist, time, (time/2), (time/2));
   self waittill ("movedone");
}

 

Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Twitch
Loading ...