Modme Forums
Menu:

Show/Hide door

Game Modding | Call of Duty: Black Ops 3 | Scripting


Pepergogo:

Hi
I just want to appear a door when the Boss fight starts and dissapear when the fight ends
Anyone know how to do it?

//Brutus Boss Fight
function brutus_doo_dah()
{
    level.brutuses = 14; //amount of brutuses to spawn
    level.brutus_in_between_spawn_time = 30; //time between spawns for Brutus. If you're only spawning one Brutus, set this to 0.
    level.stop_zombies_from_spawning = false; //set "true" to stop zombies from spawning during Brutus fight.
    level.kill_all_zombies_before_fight = true; //set "true" to kill all zombies before Brutus fight.

    level.brutus_reward = "door"; //what happens when you kill all the Brutuses. Right now, options are: ("door","powerup","gun")
    level.brutus_reward_2 = false; //add another reward if you want. just say "false" or delete the line if you don't want an extra reward.
    level.brutus_reward_3 = false; //add yet another reward if you want. Note that you cannot do more than one of the same reward.
    level.brutus_powerup_type = "nuke"; //if using a powerup as one of your rewards, this is what type. can be ("full_ammo","nuke","insta_kill","free_perk","fire_sale","double_points","carpenter","minigun",and "random")
    level.brutus_reward_weapons = array( "ar_damage", "lmg_cqb", "shotgun_pump", "smg_versatile" ); //weapons it can give you in the "gun" reward. put as many or as little as you like.
    level.brutus_gun_expire = true; //whether or not the gun will go away in time.
    level.brutus_delete_door_after_move = true; //set "true" to delete the door after its done moving. Would recommend if it won't be seen.
    level.brutus_gun_hintstring = "Press ^3[{+activate}]^7 to take weapon"; //if gun reward is activated, hintstring for picking up gun.
    level.brutus_one_gun_per_player = true; //for gun powerup, set "true" if you want a gun to spawn for each player, "false" for just one gun no matter what.
    level.brutus_different_guns_per_player = false; //for gun powerup, set "true" if you want each gun to be randomly different, false if you want them to be the same random gun. if one_gun_per_player = "false" this doesn't matter.
    
    
    trig = GetEnt("brutus_trig","targetname");
    trig waittill("trigger",player);
    if(level.stop_zombies_from_spawning == true)
        level flag::clear( "spawn_zombies" );
    if(level.kill_all_zombies_before_fight == true)
    {
        zombies = zombie_utility::get_round_enemy_array();
        if ( isdefined( zombies ) )
        {
            array::run_all( zombies, &Kill );
        }
    }
    
    
    thread spawn_my_brutus();   
    
    
    
    level waittill("all_brutuses_down");
    //IPrintLnBold("recieved");
    if(level.stop_zombies_from_spawning == true)
        level flag::set( "spawn_zombies" );
    brutus_reward();
}
function spawn_my_brutus()
{
    brutus_spawners =  struct::get_array("brutus_arena_spawn","targetname");
    for(i=0;i<level.brutuses;i++)
    {
        rand = RandomIntRange( 0, brutus_spawners.size );
        brutus_spawners[rand] thread brutus::arena_spawn_brutus();
        wait(level.brutus_in_between_spawn_time);
    }
}
function brutus_reward()
{
    //IPrintLnBold("brutus_reward");
    if(level.brutus_reward == "door" || level.brutus_reward_2 == "door" || level.brutus_reward_3 == "door")
    {
        //IPrintLnBold("door reward");
        time = 2; //2 is amount of time in seconds door takes to move.
        door_parts = GetEntArray("brutus_door","targetname");
        for(i=0;i<door_parts.size;i++)
        {
            target = Struct::Get(door_parts[i].target,"targetname");
            if(isdefined(target))
                door_parts[i] MoveTo(target.origin, time);
            if(isdefined(door_parts[i].script_vector))
                door_parts[i] MoveTo(door_parts[i].origin + (door_parts[i].script_vector), time);
        }
        wait(time);
        
        if(level.brutus_delete_door_after_move == true)
        {
            for(i=0;i<door_parts.size;i++)
            {
                
                door_parts[i] Delete();
            }
        }
    }
    if(level.brutus_reward == "powerup" || level.brutus_reward_2 == "powerup" || level.brutus_reward_3 == "powerup")
    {
        powerup_struct = GetEnt("brutus_powerup_struct","targetname");
        if(level.brutus_powerup_type != "random")
            thread zm_powerups::specific_powerup_drop( level.brutus_powerup_type, powerup_struct.origin);
        if(level.brutus_powerup_type == "random")
        {
            rand = RandomIntRange( 0, 7 ); //("full_ammo","nuke","insta_kill","free_perk","fire_sale","double_points","carpenter","minigun")
            if(rand == 0)
                thread zm_powerups::specific_powerup_drop( "full_ammo", powerup_struct.origin);
            if(rand == 1)
                thread zm_powerups::specific_powerup_drop( "nuke", powerup_struct.origin);
            if(rand == 2)
                thread zm_powerups::specific_powerup_drop( "insta_kill", powerup_struct.origin);
            if(rand == 3)
                thread zm_powerups::specific_powerup_drop( "free_perk", powerup_struct.origin);
            if(rand == 4)
                thread zm_powerups::specific_powerup_drop( "fire_sale", powerup_struct.origin);
            if(rand == 5)
                thread zm_powerups::specific_powerup_drop( "double_points", powerup_struct.origin);
            if(rand == 6)
                thread zm_powerups::specific_powerup_drop( "carpenter", powerup_struct.origin);
            if(rand == 7)
                thread zm_powerups::specific_powerup_drop( "minigun", powerup_struct.origin);
        }
    }
    if(level.brutus_reward == "gun" || level.brutus_reward_2 == "gun" || level.brutus_reward_3 == "gun")
    {
        //IPrintLnBold("gun reward");
        if(level.brutus_one_gun_per_player == false)
            gun_struct = struct::get("brutus_gun_struct","targetname");
            thread brutus_RewardGun(gun_struct.origin+(0,0,40), array::randomize(level.brutus_reward_weapons)[0]);
        if(level.brutus_one_gun_per_player == true && level.brutus_different_guns_per_player == true)
        {
            gun_structs = struct::get_array("brutus_gun_struct","targetname");
            players = GetPlayers();
            for(i=0;i<players.size;i++)
            {
                thread brutus_RewardGun(gun_structs[i].origin+(0,0,40), array::randomize(level.brutus_reward_weapons)[0]);
            }
        }
        if(level.brutus_one_gun_per_player == true && level.brutus_different_guns_per_player == false)
        {
            rand = RandomIntRange( 0, level.brutus_reward_weapons.size );
            gun_structs = struct::get_array("brutus_gun_struct","targetname");
            players = GetPlayers();
            for(i=0;i<players.size;i++)
            {
                thread brutus_RewardGun(gun_structs[i].origin+(0,0,40), level.brutus_reward_weapons[rand]);
            }
        }
    }
}
function brutus_RewardGun(pos, weapon)
{
    gun = spawn("script_model", pos);
    playsoundatposition("zmb_spawn_powerup", pos);
    
    gun SetModel(GetWeaponWorldModel(GetWeapon(weapon)));
    PlayFX(level._effect["powerup_grabbed_solo"], gun.origin);
    trig = spawn("trigger_radius", gun.origin, 0, 20, 50);
    gun thread brutus_SpinMe();
    gun thread brutus_GiveMe(weapon, trig);
    if(level.brutus_gun_expire == true)
        gun thread brutus_LifeTime(trig);
}
function brutus_LifeTime(trig)
{
    self endon("death");
    wait(120);//wait 2 minutes then delete
    if(isdefined(self))
    {
        self notify("rewardgun_delete");
    }
    if(isdefined(trig))
    {
        trig delete();
    }
    if(isdefined(self))
    {
        self delete();
    }
}
function brutus_GiveMe(weapon, trig)
{
    self endon("rewardgun_delete");
    while(1)
    {
        trig waittill("trigger", player);
        player thread brutus_SetGunHint(level.brutus_gun_hintstring, trig);
        if(player HasWeapon(getweapon("minigun")))
        {
            continue;
        }
        if(!(player UseButtonPressed()))
        {
            continue;
        }
        if(player laststand::player_is_in_laststand())
        {
            continue;
        }
        trig delete();
        self delete();
        player zm_weapons::weapon_give(getweapon(weapon));
        player SwitchToWeapon(getweapon(weapon));
        break;
        wait(.1);
    }
}

function brutus_SpinMe()
{
    self endon("rewardgun_delete");
    self endon("death");
    while(isdefined(self))
    {
        if(isdefined(self))
        {
            self rotateyaw(360,2);
        }
        wait(1.9);
    }
}
function brutus_SetGunHint(text, trig)
{
    if(isdefined(self.brutus_gun_hud))
    {
        return;
    }
    self.brutus_gun_hud = NewClientHudElem( self );
    self.brutus_gun_hud.horzAlign = "center";
    self.brutus_gun_hud.vertAlign = "middle";
    self.brutus_gun_hud.alignX = "center";
    self.brutus_gun_hud.alignY = "middle";
    self.brutus_gun_hud.foreground = 1;
    self.brutus_gun_hud.fontscale = 1;
    self.brutus_gun_hud.alpha = 1;
    self.brutus_gun_hud.color = ( 0.44, .74, .94 );
    self.brutus_gun_hud SetText(text);
    while(isdefined(trig) && self IsTouching(trig))
    {
        wait(.05);
    }
    self.brutus_gun_hud SetText("");
    self.brutus_gun_hud Destroy();
    self.brutus_gun_hud = undefined;
}


modric1337:

door_parts = GetEntArray("brutus_door","targetname"); is a preset reward for beating the boss, so use that targetname on the door(s) you want opened (clip and model)... as for hiding it you would have to make the door_parts hidden using Hide() earlier in the script and then do Show() when you anticipate players starting the boss.


Pepergogo:

door_parts = GetEntArray("brutus_door","targetname"); is a preset reward for beating the boss, so use that targetname on the door(s) you want opened (clip and model)... as for hiding it you would have to make the door_parts hidden using Hide() earlier in the script and then do Show() when you anticipate players starting the boss.

But for use "Hide()", do I need to write something like "Hide(brutus_door, targetname)" or different?