UGX-Mods

Call of Duty: Black Ops 3 => Tutorial Desk => Scripting => Topic started by: ZombieKid164 on December 06, 2016, 08:10:04 pm

Title: [Tutorial] How to add a buyable elevator
Post by: ZombieKid164 on December 06, 2016, 08:10:04 pm
(Note: I originally posted this on modme, but I decided to post it here in case any ugx-only users needed it  :alone:)

Preview Video:

Hello fellow modders!
A lot of people have been asking for an elevator script, and I needed one, so I created one.
In this script (which you see in the video) you must turn on the power, then buy the elevator, and it has sliding doors that close while the elevator is moving!
All the things you will need are in the download.
The instructions are also in the download.

IMPORTANT:
Please DO NOT re-upload this script.
If you are going to use this in your map or video, please credit me. (Ex: "ZombieKid164 - Youtube: http://www.youtube.com/channel/UCAm_2-Z_RGUmkLJcN1OfJrQ (http://www.youtube.com/channel/UCAm_2-Z_RGUmkLJcN1OfJrQ)")

Downloads:

I hope you enjoy this scipt.  :D

If you find any problems, please comment them and I will try to fix them.

Thanks,
-ZombieKid164
Title: Re: [Tutorial] How to add a buyable elevator
Post by: OMGitsMinime on January 08, 2017, 06:33:00 pm
Hey great work been waiting on a script like this for ages! Any chance you can add a call elevator trigger. That way if the elevator is up it can be called back down, or vice versa! Thanks!
Title: Re: [Tutorial] How to add a buyable elevator
Post by: h00dedsn1per on January 25, 2017, 05:07:58 pm
is there anway to modify the script so it is an elevator that starts off at the top?
Title: Re: [Tutorial] How to add a buyable elevator
Post by: wiilliam76 on January 30, 2017, 02:02:31 pm
is there anway to modify the script so it is an elevator that starts off at the top?

You succeeded ? me no :(
Title: Re: [Tutorial] How to add a buyable elevator
Post by: ZombieKid164 on January 31, 2017, 05:39:50 pm
is there anway to modify the script so it is an elevator that starts off at the top?

Yes, but you would need to move quite a bit of the script around.
Title: Re: [Tutorial] How to add a buyable elevator
Post by: qbm1 on February 03, 2017, 12:18:29 am
That's as close as i got to having the lift go top to bottom  :'(  Any advancements on this please


Code Snippet
Plaintext
// ZombieKid164's buyable elevator
#using scripts\zm\_zm_score;
#using scripts\shared\flag_shared;

function init()
{

//Things you can edit below \/
level.elevator_cost = undefined; // Change this to change the cost of the elevator. Leave it undefined to make it free.
level.elevate_height = 250 * 2; //This is how far the elevator will travel down.
level.elevator_transition_time = 10; //How long it will take for the elevator travel.
level.elevator_cooldown_time = 10; // Cooldown time of the elevator.
//Things you can edit above /\

level.elevator_trigger = GetEnt( "elevator_trigger", "targetname" );
level.elevator_trigger_bottom = GetEnt( "elevator_trigger_bottom", "targetname" );
level.elevator_trigger_outside_top = GetEnt( "elevator_trigger_outside_top", "targetname");
level.elevator_model = GetEnt( "elevator", "targetname" );
level.elevator_bottom_door_model = GetEnt("bottom_door", "targetname" );
level.elevator_top_door_model = GetEnt("top_door", "targetname" );
main();
}

function main()
{
level endon( "intermission" );
wait_for_power();
thread top_door_open();
level.elevator_trigger_top SetHintString( "" );

while(1)
{
if( isDefined(level.elevator_cost) )
while(1)
{
level.elevator_trigger SetHintString( "Hold ^3&&1^7 to Use Elevator [Cost: "+level.elevator_cost+"]" );
level.elevator_trigger waittill( "trigger", player );
if( isDefined(level.elevator_cost) && player.score >= level.elevator_cost )
{
player zm_score::minus_to_player_score( level.elevator_cost );
break;
}
else if( isDefined( level.elevator_cost ) && player.score < level.elevator_cost )
{
level.elevator_trigger SetHintString( "You do not have enough money." );
wait(4);
level.elevator_trigger SetHintString( "Hold ^3&&1^7 to Use Elevator [Cost: "+level.elevator_cost+"]" );
continue;
}
}
else
{
level.elevator_trigger SetHintString( "Hold ^3&&1^7 to Use Elevator" );
level.elevator_trigger waittill( "trigger", player );
level.elevator_trigger SetHintString( "" );
}

thread top_door_close();
wait(1);
thread elevator_fall( level.elevate_height, level.elevator_transition_time );
wait( level.elevator_transition_time );
thread bottom_door_open();
level.elevator_trigger_bottom SetHintString( "Elevator is cooling down." );
wait( level.elevator_cooldown_time );

if( isDefined(level.elevator_cost) )
while(1)
{
level.elevator_trigger_bottom SetHintString( "Hold ^3&&1^7 to Use Elevator [Cost: "+level.elevator_cost+"]" );
level.elevator_trigger_bottom waittill( "trigger", player );
if( isDefined(level.elevator_cost) && player.score >= level.elevator_cost )
{
player zm_score::minus_to_player_score( level.elevator_cost );
break;
}
else if( isDefined( level.elevator_cost ) && player.score < level.elevator_cost )
{
level.elevator_trigger_bottom SetHintString( "You do not have enough money." );
wait(4);
level.elevator_trigger_bottom SetHintString( "Hold ^3&&1^7 to Use Elevator [Cost: "+level.elevator_cost+"]" );
continue;
}
}
else
{
level.elevator_trigger_bottom SetHintString( "Hold ^3&&1^7 to Use Elevator" );
level.elevator_trigger_bottom waittill( "trigger", player );
level.elevator_trigger_bottom SetHintString( "" );
}
level.elevator_trigger_bottom SetHintString( "" );
thread top_door_close();
wait(1);
thread elevator_rise( level.elevate_height, level.elevator_transition_time );
wait( level.elevator_transition_time );
thread top_door_open();
level.elevator_trigger SetHintString( "Elevator is cooling down." );
wait( level.elevator_cooldown_time );


}
}


function elevator_rise( height, speed )
{
level.elevator_model movez (height - (height * 2), speed);
level.elevator_model waittill ("movedone");
}

function elevator_fall( height, speed )
{
level.elevator_model movez (height, speed);
level.elevator_model waittill ("movedone");
}

function bottom_door_open()
{
level.elevator_bottom_door_model movex (130, 1);
}

function bottom_door_close()
{
level.elevator_bottom_door_model movex (130 - (130 * 2), 1);
}

function top_door_open()
{
level.elevator_top_door_model movex (130, 1);
}

function top_door_close()
{
level.elevator_top_door_model movex (130 - (130 * 2), 1);
}


function wait_for_power()
{
level.elevator_trigger_outside_top SetHintString( &"ZOMBIE_NEED_POWER" );
level flag::wait_till( "power_on" );
level.elevator_trigger_outside_top SetHintString( "" );
}
Title: Re: [Tutorial] How to add a buyable elevator
Post by: IceGrenade on February 03, 2017, 02:00:35 pm
Dude don't you just need to set some values to negative... then boom it works XD
Title: Re: [Tutorial] How to add a buyable elevator
Post by: qbm1 on February 03, 2017, 03:07:56 pm
I don't think it's that easy tbh mate. Give it a play see if you can figure it out, if you have time  :)
Title: Re: [Tutorial] How to add a buyable elevator
Post by: JAVO2332 on February 03, 2017, 03:54:07 pm
in "level.elevate_height" you need to add a - to go down and the trigger_down you have to put it up and the up in the down floor.


//Things you can edit below \/
   level.elevator_cost = 500; // Change this to change the cost of the elevator. Leave it undefined to make it free.
   level.elevate_height = -364; //This is how far the elevator will travel up.
   level.elevator_transition_time = 5; //How long it will take for the elevator travel.
   level.elevator_cooldown_time = 30; // Cooldown time of the elevator.
   //Things you can edit above /\
Title: Re: [Tutorial] How to add a buyable elevator
Post by: qbm1 on February 03, 2017, 10:03:50 pm
Thanks that some what works. Except the elevator still starts at the bottom and goes down under the map but the doors work right now ;)
Title: Re: [Tutorial] How to add a buyable elevator
Post by: ZombieKid164 on February 15, 2017, 09:46:02 pm
is there anway to modify the script so it is an elevator that starts off at the top?

I'm just going to make an edited version of the script so it starts off at the top to stop all of the confusion. Should come out soon.  ;)

Double Post Merge: February 15, 2017, 10:03:42 pm
Okay, so I've made an edited version of the script which should work, which you can find here: https://mega.nz/#!UlMVDajQ!cQose0fJsRWnSTI0goFTmu0TWTBs7fKkEpRQQJeWQyE (https://mega.nz/#!UlMVDajQ!cQose0fJsRWnSTI0goFTmu0TWTBs7fKkEpRQQJeWQyE)

Just a couple of steps for install:
1) Download and replace the regular script with this one (root\share\raw\scripts\_ZK...)
2) In radiant, move the elevator platform to the top landing area and should work normal

One note: I am having computer issues at the moment so I do not know if this works correctly or not... So it might not work... Just reply with what happens if it does not work and I'll try to fix it.

P.S.: Sorry I took so long to do this, I've been really busy :\
Title: Re: [Tutorial] How to add a buyable elevator
Post by: LLamaMods101 on February 21, 2017, 11:07:21 am
I'm just going to make an edited version of the script so it starts off at the top to stop all of the confusion. Should come out soon.  ;)

Double Post Merge: February 15, 2017, 10:03:42 pm
Okay, so I've made an edited version of the script which should work, which you can find here: https://mega.nz/#!UlMVDajQ!cQose0fJsRWnSTI0goFTmu0TWTBs7fKkEpRQQJeWQyE (https://mega.nz/#!UlMVDajQ!cQose0fJsRWnSTI0goFTmu0TWTBs7fKkEpRQQJeWQyE)

Just a couple of steps for install:
1) Download and replace the regular script with this one (root\share\raw\scripts\_ZK...)
2) In radiant, move the elevator platform to the top landing area and should work normal

One note: I am having computer issues at the moment so I do not know if this works correctly or not... So it might not work... Just reply with what happens if it does not work and I'll try to fix it.

P.S.: Sorry I took so long to do this, I've been really busy :\

na fam dont work
Title: Re: [Tutorial] How to add a buyable elevator
Post by: ZombieKid164 on February 23, 2017, 09:46:01 pm
na fam dont work

What happened when you tried it? (You're going to be a little more specific than "It didn't work." As I said, I can not test at the moment due to computer issues.)
Title: Re: [Tutorial] How to add a buyable elevator
Post by: ect0 on March 16, 2017, 10:48:21 pm
can we please make it able to have multiple? i cba going round copying and making separate files
Title: Re: [Tutorial] How to add a buyable elevator
Post by: ZombieKid164 on May 18, 2017, 09:56:05 pm
This post is now obsolete (unless you want a non-callable elevator). Please refer to my new post, here: http://ugx-mods.com/forum/index.php/topic,15302.0.html (http://ugx-mods.com/forum/index.php/topic,15302.0.html)
Title: Re: [Tutorial] How to add a buyable elevator
Post by: ImTwisted on April 12, 2021, 01:32:56 pm
How can I make this elevator stop at multiple floors? I want to make it stop at 10 floors or so.