Game Modding | Call of Duty: Black Ops 3 | Scripting
ModmeBot:
Thread By: Akrime
So, I'm working on an elevator (Five style). I'm new to triggers, so I've set up the "use trigger". I want to change them, so the player has to pay 250 points to use the elevator.
Here's a preview of my elevator (the door moving slightly down is fixed now):
I might release this elevator for public use, if you guys want it.
ModmeBot:
Reply By: ZombieKid164
I actually have an elevator (better than my released versions) which has actual elevator parts, sounds, etc., and yes, the script works perfectly. Send me a message on discord if you are interested. I'm ZombieKid164#7657, but you could also find me on the modme discord.
ModmeBot:
Reply By: Abnormal202
not bad. Mind if I see your script? I always appreciate when people script for their own. I've made many an elevator in my time and could help you with any specific problems you have.
ModmeBot:
Reply By: Akrime
Abnormal202
not bad. Mind if I see your script? I always appreciate when people script for their own. I've made many an elevator in my time and could help you with any specific problems you have.
// Lift
level.liftStatus = "down";
level.liftDoorStatus = "open";
thread Lift();
function Lift()
{
// Variables
liftDoorRight = GetEntArray("liftdoorright", "targetname");
liftDoorLeft = GetEntArray("liftdoorleft", "targetname");
lift = GetEntArray("lift", "targetname");
trig = GetEnt("lifttrigger", "targetname");
// Process
trig setHintString("Press &&1 to use the elevator");
while(true)
{
trig waittill("trigger", player);
LiftDoors(liftDoorRight, liftDoorLeft, 39, 1);
wait 1.5;
MoveEntireLift(1298.5, trig, lift, liftDoorRight, liftDoorLeft, 7);
wait 7.5;
LiftDoors(liftDoorRight, liftDoorLeft, 39, 1);
wait 1.5;
}
}
function MoveEntireLift(distance, trigger, lift, liftDoorRight, liftDoorLeft, seconds)
{
if(level.liftStatus == "down")
{
// Move doors up
foreach(liftDoorRight in liftDoorRight)
{
liftDoorRight MoveZ(distance, seconds);
}
foreach(liftDoorLeft in liftDoorLeft)
{
liftDoorLeft MoveZ(distance, seconds);
}
// Move every model up
foreach(lift in lift)
{
lift MoveZ(distance, seconds);
}
level.liftstatus = "up";
}
else
{
// Move doors down
foreach(liftDoorRight in liftDoorRight)
{
liftDoorRight MoveZ(-distance, seconds);
}
foreach(liftDoorLeft in liftDoorLeft)
{
liftDoorLeft MoveZ(-distance, seconds);
}
// Move every model down
foreach(lift in lift)
{
lift MoveZ(-distance, seconds);
}
level.liftstatus = "down";
}
}
function LiftDoors(liftDoorRight, liftDoorLeft, distance, seconds)
{
// NOTE: This function checks if the doors are already closed or not, so it's impossible that the doors open twice
if(level.liftDoorStatus == "closed")
{
foreach(liftDoorRight in liftDoorRight)
{
liftDoorRight MoveY(-distance, seconds);
}
foreach(liftDoorLeft in liftDoorLeft)
{
liftDoorLeft MoveY(distance, seconds);
}
level.liftDoorStatus = "open";
}
else
{
foreach(liftDoorRight in liftDoorRight)
{
liftDoorRight MoveY(distance, seconds);
}
foreach(liftDoorLeft in liftDoorLeft)
{
liftDoorLeft MoveY(-distance, seconds);
}
level.liftDoorStatus = "closed";
}
}
ModmeBot:
Reply By: Harry Bo21
#using scripts\zm\_zm_audio;
#using scripts\zm\_zm_score;
function Lift()
{
// Variables
liftDoorRight = GetEntArray("liftdoorright", "targetname");
liftDoorLeft = GetEntArray("liftdoorleft", "targetname");
lift = GetEntArray("lift", "targetname");
trig = GetEnt("lifttrigger", "targetname");
// Process
trig setHintString("Press &&1 to use the elevator [Cost: 250]");
while(true)
{
trig waittill("trigger", player);
if( !player zm_score::can_player_purchase( 250 ) )
{
self playSound( "evt_perk_deny" );
player zm_audio::create_and_play_dialog( "general", "outofmoney" );
continue;
}
LiftDoors(liftDoorRight, liftDoorLeft, 39, 1);
wait 1.5;
MoveEntireLift(1298.5, trig, lift, liftDoorRight, liftDoorLeft, 7);
wait 7.5;
LiftDoors(liftDoorRight, liftDoorLeft, 39, 1);
wait 1.5;
}
}
ModmeBot:
Reply By: Akrime
Harry Bo21
#using scripts\zm\_zm_audio; #using scripts\zm\_zm_score; function Lift() { // Variables liftDoorRight = GetEntArray("liftdoorright", "targetname"); liftDoorLeft = GetEntArray("liftdoorleft", "targetname"); lift = GetEntArray("lift", "targetname"); trig = GetEnt("lifttrigger", "targetname"); // Process trig setHintString("Press &&1 to use the elevator [Cost: 250]"); while(true) { trig waittill("trigger", player); if( !player zm_score::can_player_purchase( 250 ) ) { self playSound( "evt_perk_deny" ); player zm_audio::create_and_play_dialog( "general", "outofmoney" ); continue; } LiftDoors(liftDoorRight, liftDoorLeft, 39, 1); wait 1.5; MoveEntireLift(1298.5, trig, lift, liftDoorRight, liftDoorLeft, 7); wait 7.5; LiftDoors(liftDoorRight, liftDoorLeft, 39, 1); wait 1.5; } }