Custom Elevator Script
Game Modding | Call of Duty: Black Ops 3 | Scripting
Kricket :
I'm trying to make a custom elevator script that works with using structs to determine how the doors move instead of just using movex or movey, as I want it to work in any orientation, but I'm not really sure what I'm doing wrong. My doors won't close, let alone have the whole elevator move up and down. Any help would be appreciated.
#using scripts\codescripts\struct;
#using scripts\shared\array_shared;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\compass;
#using scripts\shared\exploder_shared;
#using scripts\shared\flag_shared;
#using scripts\shared\laststand_shared;
#using scripts\shared\math_shared;
#using scripts\shared\scene_shared;
#using scripts\shared\util_shared;
#using scripts\zm\_zm_perks;
#insert scripts\shared\shared.gsh;
#insert scripts\shared\version.gsh;
#insert scripts\zm\_zm_utility.gsh;
#using scripts\zm\_load;
#using scripts\zm\_zm;
#using scripts\zm\_zm_audio;
#using scripts\zm\_zm_powerups;
#using scripts\zm\_zm_utility;
#using scripts\zm\_zm_weapons;
#using scripts\zm\_zm_zonemgr;
#using scripts\shared\ai\zombie_utility;
#using scripts\zm\zm_usermap;
#namespace elevator;
function init ()
{
level flag :: wait_till ( "initial_blackscreen_passed" );
level . elevator = GetEntArray ( "elevator" , "targetname" );
level . move = 200 ;
level . opentime = 2 ;
level . closetime = 5 ;
level . cooldown = 0 ;
level . location = 0 ;
level . total = GetEntArray ( "true" , "collection" );
thread up ();
thread down ();
thread call ();
thread cooldown ();
}
function up (){
if ( level . cooldown == 0 ){
level . up = GetEnt ( "e_use_up" , "targetname" );
level . up SetHintString ( "Hold ^3&&1^7 to use Elevator" );
left_door = GetEnt ( "door_left" , "targetname" );
right_door = GetEnt ( "door_right" , "targetname" );
oleft2 = struct :: get ( "left2" , "targetname" );
oright2 = struct :: get ( "right2" , "targetname" );
cleft = struct :: get ( "center_left" , "targetname" );
cright = struct :: get ( "center_right" , "targetname" );
struct_open_left2 = oleft2 GetOrigin ();
struct_open_right2 = oright2 GetOrigin ();
struct_close_left = cleft GetOrigin ();
struct_close_right = cright GetOrigin ();
while ( 1 ){
level . up waittill ( "trigger" , player );
thread cooldown ();
wait ( 1 );
left_door MoveTo ( struct_close_left , level . closetime );
right_door MoveTo ( struct_close_right , level . closetime );
wait ( .1 );
foreach ( block in level . total ){
block SetMovingPlatformEnabled ( true );
block MoveZ ( level . move , 5 );
}
wait ( 5 );
foreach ( door in left_door ){
door MoveTo ( struct_open_left2 , level . opentime );
}
foreach ( door in right_door ){
door MoveTo ( struct_open_right2 , level . opentime );
}
level . location = 1 ;
wait ( .1 );
}
}
else
level . up SetHintString ( "Must wait for recharge" );
level . up SetCursorHint ( "HINT_NOICON" );
}
function down (){
level . down = GetEnt ( "e_use_down" , "targetname" );
if ( level . cooldown == 0 ){
level . down SetHintString ( "Hold ^3&&1^7 to use Elevator" );
left_door = GetEntArray ( "door_left" , "targetname" );
right_door = GetEntArray ( "door_right" , "targetname" );
oleft = struct :: get ( "left" , "targetname" );
oright = struct :: get ( "right" , "targetname" );
cleft2 = struct :: get ( "center_left2" , "targetname" );
cright2 = struct :: get ( "center_right2" , "targetname" );
struct_open_left = oleft GetOrigin ();
struct_open_right = oright GetOrigin ();
struct_close_left2 = cleft2 GetOrigin ();
struct_close_right2 = cright2 GetOrigin ();
while ( 1 ){
level . down waittill ( "trigger" , player );
thread cooldown ();
wait ( 1 );
foreach ( door in left_door ){
door MoveTo ( struct_close_left2 , level . closetime );
}
foreach ( door in right_door ){
door MoveTo ( struct_close_right2 , level . closetime );
}
wait ( .1 );
foreach ( block in level . total ){
block SetMovingPlatformEnabled ( true );
block MoveZ ( - level . move , 5 );
}
wait ( 5 );
foreach ( door in left_door ){
door MoveTo ( struct_open_left , level . opentime );
}
foreach ( door in right_door ){
door MoveTo ( struct_open_right , level . opentime );
}
level . location = 0 ;
wait ( .1 );
}
}
else
level . down SetHintString ( "Must wait for recharge" );
level . down SetCursorHint ( "HINT_NOICON" );
}
function cooldown (){
level . cooldown = 1 ;
wait ( 25 );
level . cooldown = 0 ;
}
function cooldown2 (){
level . cooldown = 1 ;
wait ( 15 );
level . cooldown = 0 ;
}
function call (){
while ( 1 ){
if ( level . cooldown == 0 ){
if ( level . location == 1 ){
callup = GetEnt ( "call2" , "targetname" );
callup SetHintString ( "" );
callup SetCursorHint ( "HINT_NOICON" );
calldown = GetEnt ( "call1" , "targetname" );
calldown SetHintString ( "Hold ^3&&1^7 to call Elevator" );
calldown waittill ( "trigger" , player );
left_door = GetEnt ( "door_left" , "targetname" );
right_door = GetEnt ( "door_right" , "targetname" );
oleft = struct :: get ( "left" , "targetname" );
oright = struct :: get ( "right" , "targetname" );
cleft2 = struct :: get ( "center_left2" , "targetname" );
cright2 = struct :: get ( "center_right2" , "targetname" );
struct_open_left = oleft GetOrigin ();
struct_open_right = oright GetOrigin ();
struct_close_left2 = cleft2 GetOrigin ();
struct_close_right2 = cright2 GetOrigin ();
wait ( 1 );
thread cooldown2 ();
foreach ( door in left_door ){
door MoveTo ( struct_close_left2 , level . closetime );
}
foreach ( door in right_door ){
door MoveTo ( struct_close_right2 , level . closetime );
}
wait ( .1 );
foreach ( block in level . total ){
block SetMovingPlatformEnabled ( true );
block MoveZ ( - level . move , 5 );
}
wait ( 5 );
foreach ( door in left_door ){
door MoveTo ( struct_open_left , level . opentime );
}
foreach ( door in right_door ){
door MoveTo ( struct_open_right , level . opentime );
}
level . location = 0 ;
wait ( .1 );
}
if ( level . location == 0 ){
calldown = GetEnt ( "call1" , "targetname" );
calldown SetHintString ( "" );
calldown SetCursorHint ( "HINT_NOICON" );
callup = GetEnt ( "call2" , "targetname" );
callup SetHintString ( "Hold ^3&&1^7 to call Elevator" );
callup waittill ( "trigger" , player );
left_door = GetEnt ( "door_left" , "targetname" );
right_door = GetEnt ( "door_right" , "targetname" );
oleft2 = struct :: get ( "left2" , "targetname" );
oright2 = struct :: get ( "right2" , "targetname" );
cleft = struct :: get ( "center_left" , "targetname" );
cright = struct :: get ( "center_right" , "targetname" );
struct_open_left2 = oleft2 GetOrigin ();
struct_open_right2 = oright2 GetOrigin ();
struct_close_left = cleft GetOrigin ();
struct_close_right = cright GetOrigin ();
wait ( 1 );
thread cooldown2 ();
foreach ( door in left_door ){
door MoveTo ( struct_close_left2 , level . closetime );
}
foreach ( door in right_door ){
door MoveTo ( struct_close_right2 , level . closetime );
}
wait ( .1 );
foreach ( block in level . total ){
block SetMovingPlatformEnabled ( true );
block MoveZ ( level . move , 5 );
}
wait ( 5 );
foreach ( door in left_door ){
door MoveTo ( struct_open_left , level . opentime );
}
foreach ( door in right_door ){
door MoveTo ( struct_open_right , level . opentime );
}
level . location = 1 ;
wait ( .1 );
}
}
else {
callup = GetEnt ( "call2" , "targetname" );
callup SetCursorHint ( "HINT_NOICON" );
calldown = GetEnt ( "call1" , "targetname" );
calldown SetCursorHint ( "HINT_NOICON" );
if ( level . location == 1 ){
calldown SetHintString ( "Cannot Call, Must Recharge" );
}
if ( level . location == 0 ){
callup SetHintString ( "Cannot Call, Must Recharge" );
}
}
}
}
As a side note, I've tried using GetEnt for the structs in the door and that doesn't seem to work either. Thanks.
Harry Bo21 :
coz a "struct" isnt a "ent" struct::get
Kricket :
coz a "struct" isnt a "ent" struct::get I was just saying I tried that, I have struct::get currently in my code, I was just letting people know that it wouldn't and I needed help in a different way.
Pepergogo :
https://forum.modme.co/threads/tutorial-buyable-elevator.650/
Kricket :
https://forum.modme.co/threads/tutorial-buyable-elevator.650/ That tutorial uses the movex and movey command instead of using structs for the whole thing, It doesn't function at correct orientations, I want to make one that does. So I need help knowing what's wrong with my code. I've designed a prefab and written code that should theoretically work. But right now it doesn't so I wanna know what I did wrong. Thanks.
KillJoy :
the location you're moving to (the struct) needs an origin ie
kj_keeper MoveTo ( keeper_loc01 . origin , 1.5 );
Kricket :
the location you're moving to (the struct) needs an origin ie
kj_keeper MoveTo ( keeper_loc01 . origin , 1.5 );
So I got everything working except for some reason my trigs get scrambled and trigs that shouldn't pop up do. I thought I had it all done, was making a recording to show off, and it broke on me lol. Any help would be great, thanks.
#using scripts\codescripts\struct;
#using scripts\shared\array_shared;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\compass;
#using scripts\shared\exploder_shared;
#using scripts\shared\flag_shared;
#using scripts\shared\laststand_shared;
#using scripts\shared\math_shared;
#using scripts\shared\scene_shared;
#using scripts\shared\util_shared;
#using scripts\zm\_zm_perks;
#insert scripts\shared\shared.gsh;
#insert scripts\shared\version.gsh;
#insert scripts\zm\_zm_utility.gsh;
#using scripts\zm\_load;
#using scripts\zm\_zm;
#using scripts\zm\_zm_audio;
#using scripts\zm\_zm_powerups;
#using scripts\zm\_zm_utility;
#using scripts\zm\_zm_weapons;
#using scripts\zm\_zm_zonemgr;
#using scripts\shared\ai\zombie_utility;
#using scripts\zm\zm_usermap;
#namespace elevator;
function init ()
{
level flag :: wait_till ( "initial_blackscreen_passed" );
level . elevator = GetEntArray ( "elevator" , "targetname" ); //These are all the pieces of the elevator except the door
level . move = 200 ; //how high it goes or how far it drops
level . opentime = 2 ; //time to open doors
level . closetime = 5 ; //time to close doors
level . recharge = 20 ; //time between uses
level . location = 0 ; //indicator of first floor or second floor
level . cooldown = 0 ;
level . total = [];
for ( i = 0 ; i & lt ; level . elevator . size ; i ++ ){
level . total [ level . total . size ] = level . elevator [ i ]; //this is really redundant but makes an array with elevator, originally tried adding doors and didn't work
}
thread up (); //calling of the up function
thread down (); //down
thread call (); //and a function for calling up or down
}
function up (){
if ( level . cooldown == 0 ){ //placeholder froma previous trial
level . up = GetEnt ( "e_use_up" , "targetname" ); //Gets the trigger for the elevator to go up
level . down = GetEnt ( "e_use_down" , "targetname" ); //trigger down
level . callup = GetEnt ( "call2" , "targetname" ); //calling up trigger
level . calldown = GetEnt ( "call1" , "targetname" ); //calling down trigger
level . up SetHintString ( "Hold ^3&&1^7 to use Elevator" );
left_door = GetEnt ( "door_left" , "targetname" ); //left and right door variables
right_door = GetEnt ( "door_right" , "targetname" );
//setting up structs for door movement
oleft2 = struct :: get ( "left2" , "targetname" );
oright2 = struct :: get ( "right2" , "targetname" );
cleft = struct :: get ( "center_left" , "targetname" );
cright = struct :: get ( "center_right" , "targetname" );
//finding origins of said structs
struct_open_left2 = oleft2 . origin ;
struct_open_right2 = oright2 . origin ;
struct_close_left = cleft . origin ;
struct_close_right = cright . origin ;
//while loop to wait for the elevator to go up
while ( 1 ){
level . up waittill ( "trigger" , player );
level . up Hide (); //Trying to hide all the triggers so it stops breaking, ps this isn't working.
level . down Hide ();
level . calldown Hide ();
level . callup Hide ();
wait ( 1 );
left_door MoveTo ( struct_close_left , level . closetime ); //This works, this is the door movement for it closing
right_door MoveTo ( struct_close_right , level . closetime );
wait ( level . closetime ); //this is locking the elevator together as a moving platform, and bringing the player up.
for ( i = 0 ; i & lt ; level . total . size ; i ++ ){
level . total [ i ] SetMovingPlatformEnabled ( true );
level . total [ i ] MoveZ ( level . move , 5 );
}
left_door SetMovingPlatformEnabled ( true ); //bringing doors with it
left_door MoveZ ( level . move , 5 );
right_door SetMovingPlatformEnabled ( true );
right_door MoveZ ( level . move , 5 );
wait ( 5 );
left_door MoveTo ( struct_open_left2 , level . opentime ); //opening doors
right_door MoveTo ( struct_open_right2 , level . opentime );
level . location = 1 ; //setting of what location the elevator is at
IPrintLnBold ( "Elevator Must Recharge" );
wait ( level . recharge ); //wait to show next trigs til after wait time
level . down Show ();
level . calldown Show ();
}
}
}
function down (){
level . up = GetEnt ( "e_use_up" , "targetname" ); //This is all the same stuff as above but for the elevator going down
level . down = GetEnt ( "e_use_down" , "targetname" ); //Once again the main function of the elevator works, but for some reason the trigs get all scrambles
level . callup = GetEnt ( "call2" , "targetname" );
level . calldown = GetEnt ( "call1" , "targetname" );
if ( level . cooldown == 0 ){
level . down SetHintString ( "Hold ^3&&1^7 to use Elevator" );
left_door = GetEnt ( "door_left" , "targetname" );
right_door = GetEnt ( "door_right" , "targetname" );
oleft = struct :: get ( "left" , "targetname" );
oright = struct :: get ( "right" , "targetname" );
cleft2 = struct :: get ( "center_left2" , "targetname" );
cright2 = struct :: get ( "center_right2" , "targetname" );
struct_open_left = oleft . origin ;
struct_open_right = oright . origin ;
struct_close_left2 = cleft2 . origin ;
struct_close_right2 = cright2 . origin ;
while ( 1 ){
level . down waittill ( "trigger" , player );
level . up Hide ();
level . down Hide ();
level . callup Hide ();
level . calldown Hide ();
wait ( 1 );
left_door MoveTo ( struct_close_left2 , level . closetime );
right_door MoveTo ( struct_close_right2 , level . closetime );
wait ( level . closetime );
for ( i = 0 ; i & lt ; level . total . size ; i ++ ){
level . total [ i ] SetMovingPlatformEnabled ( true );
level . total [ i ] MoveZ ( - level . move , 5 );
}
left_door SetMovingPlatformEnabled ( true );
left_door MoveZ ( - level . move , 5 );
right_door SetMovingPlatformEnabled ( true );
right_door MoveZ ( - level . move , 5 );
wait ( 5 );
left_door MoveTo ( struct_open_left , level . opentime );
right_door MoveTo ( struct_open_right , level . opentime );
level . location = 0 ;
IPrintLnBold ( "Elevator Must Recharge" );
wait ( level . recharge );
level . up Show ();
level . callup Show ();
}
}
}
function call (){
while ( 1 ){ //Tests for location to determine which call button will actually work
if ( level . location == 1 ){ //This is the call function, its probably what's causing the issue, idk if I should split it into callup and calldown? probably.
callup = GetEnt ( "call2" , "targetname" );
calldown = GetEnt ( "call1" , "targetname" );
calldown SetHintString ( "Hold ^3&&1^7 to call Elevator" );
calldown Show ();
level . up = GetEnt ( "e_use_up" , "targetname" );
level . down = GetEnt ( "e_use_down" , "targetname" );
calldown waittill ( "trigger" , player );
callup Hide ();
calldown Hide ();
level . up Hide ();
level . down Hide ();
left_door = GetEnt ( "door_left" , "targetname" );
right_door = GetEnt ( "door_right" , "targetname" );
oleft = struct :: get ( "left" , "targetname" );
oright = struct :: get ( "right" , "targetname" );
cleft2 = struct :: get ( "center_left2" , "targetname" );
cright2 = struct :: get ( "center_right2" , "targetname" ); //setting up structs
struct_open_left = oleft . origin ;
struct_open_right = oright . origin ;
struct_close_left2 = cleft2 . origin ;
struct_close_right2 = cright2 . origin ;
wait ( 1 );
left_door MoveTo ( struct_close_left2 , level . closetime );
right_door MoveTo ( struct_close_right2 , level . closetime );
wait ( level . closetime );
for ( i = 0 ; i & lt ; level . total . size ; i ++ ){
level . total [ i ] SetMovingPlatformEnabled ( true );
level . total [ i ] MoveZ ( - level . move , 5 );
}
left_door SetMovingPlatformEnabled ( true );
left_door MoveZ ( - level . move , 5 );
right_door SetMovingPlatformEnabled ( true );
right_door MoveZ ( - level . move , 5 );
wait ( 5 );
left_door MoveTo ( struct_open_left , level . opentime ); //pretty much all the same stuff
right_door MoveTo ( struct_open_right , level . opentime );
level . location = 0 ;
IPrintLnBold ( "Elevator Must Recharge" );
wait ( level . recharge );
callup Show ();
level . up Show ();
level . down Show ();
}
if ( level . location == 0 ){
calldown = GetEnt ( "call1" , "targetname" );
calldown SetCursorHint ( "HINT_NOICON" );
callup = GetEnt ( "call2" , "targetname" );
callup Show ();
callup SetHintString ( "Hold ^3&&1^7 to call Elevator" );
level . up = GetEnt ( "e_use_up" , "targetname" );
level . down = GetEnt ( "e_use_down" , "targetname" );
callup waittill ( "trigger" , player );
callup Hide ();
calldown Hide ();
level . up Hide ();
level . down Hide ();
left_door = GetEnt ( "door_left" , "targetname" );
right_door = GetEnt ( "door_right" , "targetname" );
oleft2 = struct :: get ( "left2" , "targetname" );
oright2 = struct :: get ( "right2" , "targetname" );
cleft = struct :: get ( "center_left" , "targetname" );
cright = struct :: get ( "center_right" , "targetname" );
struct_open_left2 = oleft2 . origin ;
struct_open_right2 = oright2 . origin ;
struct_close_left = cleft . origin ;
struct_close_right = cright . origin ;
wait ( 1 );
left_door MoveTo ( struct_close_left , level . closetime );
right_door MoveTo ( struct_close_right , level . closetime );
wait ( level . closetime );
for ( i = 0 ; i & lt ; level . total . size ; i ++ ){
level . total [ i ] SetMovingPlatformEnabled ( true );
level . total [ i ] MoveZ ( level . move , 5 );
}
left_door SetMovingPlatformEnabled ( true );
left_door MoveZ ( level . move , 5 );
right_door SetMovingPlatformEnabled ( true );
right_door MoveZ ( level . move , 5 );
wait ( 5 );
left_door MoveTo ( struct_open_left2 , level . opentime );
right_door MoveTo ( struct_open_right2 , level . opentime );
level . location = 1 ;
IPrintLnBold ( "Elevator Must Recharge" );
wait ( level . recharge );
calldown Show ();
level . up Show ();
level . down Show ();
}
}
}
tmk_boi :
So I got everything working except for some reason my trigs get scrambled and trigs that shouldn't pop up do. I thought I had it all done, was making a recording to show off, and it broke on me lol. Any help would be great, thanks.
#using scripts\codescripts\struct;
#using scripts\shared\array_shared;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\compass;
#using scripts\shared\exploder_shared;
#using scripts\shared\flag_shared;
#using scripts\shared\laststand_shared;
#using scripts\shared\math_shared;
#using scripts\shared\scene_shared;
#using scripts\shared\util_shared;
#using scripts\zm\_zm_perks;
#insert scripts\shared\shared.gsh;
#insert scripts\shared\version.gsh;
#insert scripts\zm\_zm_utility.gsh;
#using scripts\zm\_load;
#using scripts\zm\_zm;
#using scripts\zm\_zm_audio;
#using scripts\zm\_zm_powerups;
#using scripts\zm\_zm_utility;
#using scripts\zm\_zm_weapons;
#using scripts\zm\_zm_zonemgr;
#using scripts\shared\ai\zombie_utility;
#using scripts\zm\zm_usermap;
#namespace elevator;
function init ()
{
level flag :: wait_till ( "initial_blackscreen_passed" );
level . elevator = GetEntArray ( "elevator" , "targetname" ); //These are all the pieces of the elevator except the door
level . move = 200 ; //how high it goes or how far it drops
level . opentime = 2 ; //time to open doors
level . closetime = 5 ; //time to close doors
level . recharge = 20 ; //time between uses
level . location = 0 ; //indicator of first floor or second floor
level . cooldown = 0 ;
level . total = [];
for ( i = 0 ; i & lt ; level . elevator . size ; i ++ ){
level . total [ level . total . size ] = level . elevator [ i ]; //this is really redundant but makes an array with elevator, originally tried adding doors and didn't work
}
thread up (); //calling of the up function
thread down (); //down
thread call (); //and a function for calling up or down
}
function up (){
if ( level . cooldown == 0 ){ //placeholder froma previous trial
level . up = GetEnt ( "e_use_up" , "targetname" ); //Gets the trigger for the elevator to go up
level . down = GetEnt ( "e_use_down" , "targetname" ); //trigger down
level . callup = GetEnt ( "call2" , "targetname" ); //calling up trigger
level . calldown = GetEnt ( "call1" , "targetname" ); //calling down trigger
level . up SetHintString ( "Hold ^3&&1^7 to use Elevator" );
left_door = GetEnt ( "door_left" , "targetname" ); //left and right door variables
right_door = GetEnt ( "door_right" , "targetname" );
//setting up structs for door movement
oleft2 = struct :: get ( "left2" , "targetname" );
oright2 = struct :: get ( "right2" , "targetname" );
cleft = struct :: get ( "center_left" , "targetname" );
cright = struct :: get ( "center_right" , "targetname" );
//finding origins of said structs
struct_open_left2 = oleft2 . origin ;
struct_open_right2 = oright2 . origin ;
struct_close_left = cleft . origin ;
struct_close_right = cright . origin ;
//while loop to wait for the elevator to go up
while ( 1 ){
level . up waittill ( "trigger" , player );
level . up Hide (); //Trying to hide all the triggers so it stops breaking, ps this isn't working.
level . down Hide ();
level . calldown Hide ();
level . callup Hide ();
wait ( 1 );
left_door MoveTo ( struct_close_left , level . closetime ); //This works, this is the door movement for it closing
right_door MoveTo ( struct_close_right , level . closetime );
wait ( level . closetime ); //this is locking the elevator together as a moving platform, and bringing the player up.
for ( i = 0 ; i & lt ; level . total . size ; i ++ ){
level . total [ i ] SetMovingPlatformEnabled ( true );
level . total [ i ] MoveZ ( level . move , 5 );
}
left_door SetMovingPlatformEnabled ( true ); //bringing doors with it
left_door MoveZ ( level . move , 5 );
right_door SetMovingPlatformEnabled ( true );
right_door MoveZ ( level . move , 5 );
wait ( 5 );
left_door MoveTo ( struct_open_left2 , level . opentime ); //opening doors
right_door MoveTo ( struct_open_right2 , level . opentime );
level . location = 1 ; //setting of what location the elevator is at
IPrintLnBold ( "Elevator Must Recharge" );
wait ( level . recharge ); //wait to show next trigs til after wait time
level . down Show ();
level . calldown Show ();
}
}
}
function down (){
level . up = GetEnt ( "e_use_up" , "targetname" ); //This is all the same stuff as above but for the elevator going down
level . down = GetEnt ( "e_use_down" , "targetname" ); //Once again the main function of the elevator works, but for some reason the trigs get all scrambles
level . callup = GetEnt ( "call2" , "targetname" );
level . calldown = GetEnt ( "call1" , "targetname" );
if ( level . cooldown == 0 ){
level . down SetHintString ( "Hold ^3&&1^7 to use Elevator" );
left_door = GetEnt ( "door_left" , "targetname" );
right_door = GetEnt ( "door_right" , "targetname" );
oleft = struct :: get ( "left" , "targetname" );
oright = struct :: get ( "right" , "targetname" );
cleft2 = struct :: get ( "center_left2" , "targetname" );
cright2 = struct :: get ( "center_right2" , "targetname" );
struct_open_left = oleft . origin ;
struct_open_right = oright . origin ;
struct_close_left2 = cleft2 . origin ;
struct_close_right2 = cright2 . origin ;
while ( 1 ){
level . down waittill ( "trigger" , player );
level . up Hide ();
level . down Hide ();
level . callup Hide ();
level . calldown Hide ();
wait ( 1 );
left_door MoveTo ( struct_close_left2 , level . closetime );
right_door MoveTo ( struct_close_right2 , level . closetime );
wait ( level . closetime );
for ( i = 0 ; i & lt ; level . total . size ; i ++ ){
level . total [ i ] SetMovingPlatformEnabled ( true );
level . total [ i ] MoveZ ( - level . move , 5 );
}
left_door SetMovingPlatformEnabled ( true );
left_door MoveZ ( - level . move , 5 );
right_door SetMovingPlatformEnabled ( true );
right_door MoveZ ( - level . move , 5 );
wait ( 5 );
left_door MoveTo ( struct_open_left , level . opentime );
right_door MoveTo ( struct_open_right , level . opentime );
level . location = 0 ;
IPrintLnBold ( "Elevator Must Recharge" );
wait ( level . recharge );
level . up Show ();
level . callup Show ();
}
}
}
function call (){
while ( 1 ){ //Tests for location to determine which call button will actually work
if ( level . location == 1 ){ //This is the call function, its probably what's causing the issue, idk if I should split it into callup and calldown? probably.
callup = GetEnt ( "call2" , "targetname" );
calldown = GetEnt ( "call1" , "targetname" );
calldown SetHintString ( "Hold ^3&&1^7 to call Elevator" );
calldown Show ();
level . up = GetEnt ( "e_use_up" , "targetname" );
level . down = GetEnt ( "e_use_down" , "targetname" );
calldown waittill ( "trigger" , player );
callup Hide ();
calldown Hide ();
level . up Hide ();
level . down Hide ();
left_door = GetEnt ( "door_left" , "targetname" );
right_door = GetEnt ( "door_right" , "targetname" );
oleft = struct :: get ( "left" , "targetname" );
oright = struct :: get ( "right" , "targetname" );
cleft2 = struct :: get ( "center_left2" , "targetname" );
cright2 = struct :: get ( "center_right2" , "targetname" ); //setting up structs
struct_open_left = oleft . origin ;
struct_open_right = oright . origin ;
struct_close_left2 = cleft2 . origin ;
struct_close_right2 = cright2 . origin ;
wait ( 1 );
left_door MoveTo ( struct_close_left2 , level . closetime );
right_door MoveTo ( struct_close_right2 , level . closetime );
wait ( level . closetime );
for ( i = 0 ; i & lt ; level . total . size ; i ++ ){
level . total [ i ] SetMovingPlatformEnabled ( true );
level . total [ i ] MoveZ ( - level . move , 5 );
}
left_door SetMovingPlatformEnabled ( true );
left_door MoveZ ( - level . move , 5 );
right_door SetMovingPlatformEnabled ( true );
right_door MoveZ ( - level . move , 5 );
wait ( 5 );
left_door MoveTo ( struct_open_left , level . opentime ); //pretty much all the same stuff
right_door MoveTo ( struct_open_right , level . opentime );
level . location = 0 ;
IPrintLnBold ( "Elevator Must Recharge" );
wait ( level . recharge );
callup Show ();
level . up Show ();
level . down Show ();
}
if ( level . location == 0 ){
calldown = GetEnt ( "call1" , "targetname" );
calldown SetCursorHint ( "HINT_NOICON" );
callup = GetEnt ( "call2" , "targetname" );
callup Show ();
callup SetHintString ( "Hold ^3&&1^7 to call Elevator" );
level . up = GetEnt ( "e_use_up" , "targetname" );
level . down = GetEnt ( "e_use_down" , "targetname" );
callup waittill ( "trigger" , player );
callup Hide ();
calldown Hide ();
level . up Hide ();
level . down Hide ();
left_door = GetEnt ( "door_left" , "targetname" );
right_door = GetEnt ( "door_right" , "targetname" );
oleft2 = struct :: get ( "left2" , "targetname" );
oright2 = struct :: get ( "right2" , "targetname" );
cleft = struct :: get ( "center_left" , "targetname" );
cright = struct :: get ( "center_right" , "targetname" );
struct_open_left2 = oleft2 . origin ;
struct_open_right2 = oright2 . origin ;
struct_close_left = cleft . origin ;
struct_close_right = cright . origin ;
wait ( 1 );
left_door MoveTo ( struct_close_left , level . closetime );
right_door MoveTo ( struct_close_right , level . closetime );
wait ( level . closetime );
for ( i = 0 ; i & lt ; level . total . size ; i ++ ){
level . total [ i ] SetMovingPlatformEnabled ( true );
level . total [ i ] MoveZ ( level . move , 5 );
}
left_door SetMovingPlatformEnabled ( true );
left_door MoveZ ( level . move , 5 );
right_door SetMovingPlatformEnabled ( true );
right_door MoveZ ( level . move , 5 );
wait ( 5 );
left_door MoveTo ( struct_open_left2 , level . opentime );
right_door MoveTo ( struct_open_right2 , level . opentime );
level . location = 1 ;
IPrintLnBold ( "Elevator Must Recharge" );
wait ( level . recharge );
calldown Show ();
level . up Show ();
level . down Show ();
}
}
}
u sure u didnt make the triggers move?
Kricket :
u sure u didnt make the triggers move? I didn't ever make the triggers move, it's not that the triggers are moving, its that after a few uses, triggers that shouldnt be popping up are and the ones that should aren't
tmk_boi :
I didn't ever make the triggers move, it's not that the triggers are moving, its that after a few uses, triggers that shouldnt be popping up are and the ones that should aren't triggers cant really be created and i dont know what you mean so show me a gif or whatever
Kricket :
triggers cant really be created and i dont know what you mean so show me a gif or whatever I'm using the Hide() and Show() commands to make my triggers appear and disappear depending on location of the elevator, but after a use or two the triggers that I want to appear don't and the one's I don't do appear