Modme Forums
Menu:

“For” cycle question

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


Pepergogo:

Hi
I was wondering if anyone know if it's possible to end this "'for' cycle" after certain time without doing all the instructions?

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);

    }

This is because, sometime the Boss bugs and basically end the game is impossible, so I want to end the Boss fight by doing it or waiting certain time, this just in case the Boss fight bugs.

This is basically the Boss Fight code:

trig waittill("trigger",player);

    //S-H Door
    bfdoor1 Show();
    bfdoor2 Show();
    bfdoor3 Show();

    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" );
   
    //S-H Door
    bfdoor1 Delete();
    bfdoor2 Delete();
    bfdoor3 Delete();

    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);
    }
}


Spiki:

in the start of

function spawn_my_brutus()
add
level endon("stop_brutus_spawn");
so its like this
function spawn_my_brutus()
{
level endon("stop_brutus_spawn");
    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);
    }
}

then whenever you want to stop this function call
level notify("stop_brutus_spawn");
from anywhere. (so after a wait or whenever you want to stop).

also i have no idea how
for(i=0;i<level.brutuses;i++)
goes on infinitely since its a not an infinite loop. if level.brutuses increases everytime a brutus spawns then you got a problem. too lazy to check nates code


Pepergogo:

No, but ingame, the level.brutuses doesn't increases everytime a Brutus spawn.
I'll just put a number, say 20, and it spawn 20 of them but wait certain time beetween them with the "level.brutus_in_between_spawn_time" option.
But in some cases, the count of the 20 Brutus (for example), doesn't increase after kill one of them, causing the Boss fight can't end it and getting trap in that zone the rest of the game


Harry Bo21:

for(i=0;i<level.brutuses;i++)


for(i=0;i<level.brutuses.size;i++)


Pepergogo:

in the start of
function spawn_my_brutus()
add
level endon("stop_brutus_spawn");
so its like this
function spawn_my_brutus()
{
level endon("stop_brutus_spawn");
    brutus_spawners =  struct::get_array("brutus_arena_spawn","targetname");
    for(i=0;i&lt;level.brutuses;i++)
    {
        rand = RandomIntRange( 0, brutus_spawners.size );
        brutus_spawners[rand] thread brutus::arena_spawn_brutus();
        wait(level.brutus_in_between_spawn_time);
    }
}

then whenever you want to stop this function call
level notify("stop_brutus_spawn");
from anywhere. (so after a wait or whenever you want to stop).

also i have no idea how
for(i=0;i&lt;level.brutuses;i++)
goes on infinitely since its a not an infinite loop. if level.brutuses increases everytime a brutus spawns then you got a problem. too lazy to check nates code

I test it but couldn't make it work, the fight is still the same
But still thanks 😌


Pepergogo:

for(i=0;i<level.brutuses;i++)


for(i=0;i<level.brutuses.size;i++)

I test it but the Brutus didn't spawn
But still thanks 😌