Help with a coding function

BlackOpsModder

Well-Known Member
Messages
57
Points
228
Code:
dog_round_tracker()
{  
    level.dog_round_count = 1;
   
    // PI_CHANGE_BEGIN - JMA - making dog rounds random between round 5 thru 7
    // NOTE:  RandomIntRange returns a random integer r, where min <= r < max
    level.next_dog_round = randomintrange( 5, 8 );  
    // PI_CHANGE_END
   
    old_spawn_func = level.round_spawn_func;
    old_wait_func  = level.round_wait_func;

    while ( 1 )
    {
        level waittill ( "between_round_over" );

        /#
            if( GetDvarInt( #"force_dogs" ) > 0 )
            {
                level.next_dog_round = level.round_number;
            }
        #/

        if ( level.round_number == level.next_dog_round )
        {
            level.music_round_override = true;
            old_spawn_func = level.round_spawn_func;
            old_wait_func  = level.round_wait_func;
            dog_round_start();
            level.round_spawn_func = ::dog_round_spawning;

            level.next_dog_round = level.round_number + randomintrange( 4, 6 );
            /#
                get_players()[0] iprintln( "Next dog round: " + level.next_dog_round );
            #/
        }
        else if ( flag( "dog_round" ) )
        {
            dog_round_stop();
            level.round_spawn_func = old_spawn_func;
            level.round_wait_func  = old_wait_func;
            level.music_round_override = false;
            level.dog_round_count += 1;
        }          
    }  
}
At the level.next_dog_round = level.round_number + randomintrange( 4, 6 );
This function means i get a 4 or a 5 rounder of dogs at a random, If I change this code for example ( 4, 5 ) that would always give me a 4 rounder.
I wanna know a method to change this with percentages, for example I want in 70% a 4 rounder and in 30% a 5 rounder, can you teach me how to do it?
I tried to put 5 && 10 && 14 && 19 && 23 ... etc put that method to pre set the dogs in game doesnt work!
Im pretty sure you know how to do it, can you give me some help?
 
Last edited:

BlackOpsModder

Well-Known Member
Messages
57
Points
228
CabCon helped me through pm he game me this code!

Code:
C++:
if(randomintrange( 0, 11 ) <= 7)
        level.next_dog_round = 4;
    else
        level.next_dog_round = 5;
But idk much how to work with it or where exactly to paste it, can anyone give me some help?
Maybe you CabCon :smile:
 

P!X

Moderator
Staff member
Head Staff Team
Messages
335
Points
453
Code:
dog_round_tracker()
{ 
    level.dog_round_count = 1;
  
    // PI_CHANGE_BEGIN - JMA - making dog rounds random between round 5 thru 7
    // NOTE:  RandomIntRange returns a random integer r, where min <= r < max
    level.next_dog_round = randomintrange( 5, 8 ); 
    // PI_CHANGE_END
  
    old_spawn_func = level.round_spawn_func;
    old_wait_func  = level.round_wait_func;

    while ( 1 )
    {
        level waittill ( "between_round_over" );

        /#
            if( GetDvarInt( #"force_dogs" ) > 0 )
            {
                level.next_dog_round = level.round_number;
            }
        #/

        if ( level.round_number == level.next_dog_round )
        {
            level.music_round_override = true;
            old_spawn_func = level.round_spawn_func;
            old_wait_func  = level.round_wait_func;
            dog_round_start();
            level.round_spawn_func = ::dog_round_spawning;

            level.next_dog_round = level.round_number + randomintrange( 4, 6 );
            /#
                get_players()[0] iprintln( "Next dog round: " + level.next_dog_round );
            #/
        }
        else if ( flag( "dog_round" ) )
        {
            dog_round_stop();
            level.round_spawn_func = old_spawn_func;
            level.round_wait_func  = old_wait_func;
            level.music_round_override = false;
            level.dog_round_count += 1;
        }         
    } 
}
At the level.next_dog_round = level.round_number + randomintrange( 4, 6 );
This function means i get a 4 or a 5 rounder of dogs at a random, If I change this code for example ( 4, 5 ) that would always give me a 4 rounder.
I wanna know a method to change this with percentages, for example I want in 70% a 4 rounder and in 30% a 5 rounder, can you teach me how to do it?
I tried to put 5 && 10 && 14 && 19 && 23 ... etc put that method to pre set the dogs in game doesnt work!
Im pretty sure you know how to do it, can you give me some help?
im not really sure what you are trying to do mostly cause i dont know what you mean with "rounder"
 

BlackOpsModder

Well-Known Member
Messages
57
Points
228
im not really sure what you are trying to do mostly cause i dont know what you mean with "rounder"
With rounder I mean getting the next dog round in a space of 4 or 5 rounds (I want to change the randomness)
If I had dogs on 7 I could get it on round 11 or 12, I want to change the randomness than or
preset the dogs I want in the full game, If I want for example:

7 && 11 && 15 && 19 && 23 && 27 && 32 && 36 && 41 && 45 && 49 && 54 && 58 && 63 && 67 && 71 && 76 && 80 && 84 && 89 && 94 && 98 && 102 && 107 && 112 && 116 && 120 && 124 && 129 && 133 && 137 && 141 && 146 && 151 && 155 && 160 && 164 && 168 && 172 && 177 && 182 && 186 && 190 && 195 && 200 && 204 && 209 && 213 && 218 && 223 && 227 && 232 && 236 && 240;
 

P!X

Moderator
Staff member
Head Staff Team
Messages
335
Points
453
hmmm ok
i just added cabcons code for you
Code:
dog_round_tracker()
{ 
    level.dog_round_count = 1;
  
    // PI_CHANGE_BEGIN - JMA - making dog rounds random between round 5 thru 7
    // NOTE:  RandomIntRange returns a random integer r, where min <= r < max
    level.next_dog_round = randomintrange( 5, 8 ); 
    // PI_CHANGE_END
  
    old_spawn_func = level.round_spawn_func;
    old_wait_func  = level.round_wait_func;

    while ( 1 )
    {
        level waittill ( "between_round_over" );

        /#
            if( GetDvarInt( #"force_dogs" ) > 0 )
            {
                level.next_dog_round = level.round_number;
            }
        #/

        if ( level.round_number == level.next_dog_round )
        {
            level.music_round_override = true;
            old_spawn_func = level.round_spawn_func;
            old_wait_func  = level.round_wait_func;
            dog_round_start();
            level.round_spawn_func = ::dog_round_spawning;

            if(randomintrange( 0, 11 ) <= 7)
            {
                level.next_dog_round =  level.round_number + 4;
            }
            else
            {
                level.next_dog_round = level.round_number + 5;
            }
            /#
                get_players()[0] iprintln( "Next dog round: " + level.next_dog_round );
            #/
        }
        else if ( flag( "dog_round" ) )
        {
            dog_round_stop();
            level.round_spawn_func = old_spawn_func;
            level.round_wait_func  = old_wait_func;
            level.music_round_override = false;
            level.dog_round_count += 1;
        }         
    } 
}
 

BlackOpsModder

Well-Known Member
Messages
57
Points
228
hmmm ok
i just added cabcons code for you
Code:
dog_round_tracker()
{
    level.dog_round_count = 1;
 
    // PI_CHANGE_BEGIN - JMA - making dog rounds random between round 5 thru 7
    // NOTE:  RandomIntRange returns a random integer r, where min <= r < max
    level.next_dog_round = randomintrange( 5, 8 );
    // PI_CHANGE_END
 
    old_spawn_func = level.round_spawn_func;
    old_wait_func  = level.round_wait_func;

    while ( 1 )
    {
        level waittill ( "between_round_over" );

        /#
            if( GetDvarInt( #"force_dogs" ) > 0 )
            {
                level.next_dog_round = level.round_number;
            }
        #/

        if ( level.round_number == level.next_dog_round )
        {
            level.music_round_override = true;
            old_spawn_func = level.round_spawn_func;
            old_wait_func  = level.round_wait_func;
            dog_round_start();
            level.round_spawn_func = ::dog_round_spawning;

            if(randomintrange( 0, 11 ) <= 7)
            {
                level.next_dog_round =  level.round_number + 4;
            }
            else
            {
                level.next_dog_round = level.round_number + 5;
            }
            /#
                get_players()[0] iprintln( "Next dog round: " + level.next_dog_round );
            #/
        }
        else if ( flag( "dog_round" ) )
        {
            dog_round_stop();
            level.round_spawn_func = old_spawn_func;
            level.round_wait_func  = old_wait_func;
            level.music_round_override = false;
            level.dog_round_count += 1;
        }        
    }
}
Thank you, Im gonna give it a try!
 
  • Like
Reactions: P!X

BlackOpsModder

Well-Known Member
Messages
57
Points
228
It worked!!

GSC is C++?

what language I should learn to learn how to code this game?

By the way do you know a method to pre set the dog rounds I want in the game?

Like
7 && 11 && 15 && 19 && 23 && 27 && 32 && 36 && 41 && 45 && 49 && 54 && 58 && 63 && 67 && 71 && 76 && 80 && 84 && 89 && 94 && 98 && 102 && 107 && 112 && 116 && 120 && 124 && 129 && 133 && 137 && 141 && 146 && 151 && 155 && 160 && 164 && 168 && 172 && 177 && 182 && 186 && 190 && 195 && 200 && 204 && 209 && 213 && 218 && 223 && 227 && 232 && 236 && 240;
 

P!X

Moderator
Staff member
Head Staff Team
Messages
335
Points
453
It worked!!

GSC is C++?

what language I should learn to learn how to code this game?

By the way do you know a method to pre set the dog rounds I want in the game?

Like
7 && 11 && 15 && 19 && 23 && 27 && 32 && 36 && 41 && 45 && 49 && 54 && 58 && 63 && 67 && 71 && 76 && 80 && 84 && 89 && 94 && 98 && 102 && 107 && 112 && 116 && 120 && 124 && 129 && 133 && 137 && 141 && 146 && 151 && 155 && 160 && 164 && 168 && 172 && 177 && 182 && 186 && 190 && 195 && 200 && 204 && 209 && 213 && 218 && 223 && 227 && 232 && 236 && 240;
GSC is a scripting language
it definitely helps if you know C/C++/C# or any other C based language

idk sry i never really worked with the zombie mode
 

BlackOpsModder

Well-Known Member
Messages
57
Points
228
GSC is a scripting language
it definitely helps if you know C/C++/C# or any other C based language

idk sry i never really worked with the zombie mode
I will learn the basics of C++ to try to help me code black ops
 

BlackOpsModder

Well-Known Member
Messages
57
Points
228
why if i set the dogs like that doesnt work?
Code:
dog_round_tracker()
{   
    level.dog_round_count = 1;
    
    // PI_CHANGE_BEGIN - JMA - making dog rounds random between round 5 thru 7
    // NOTE:  RandomIntRange returns a random integer r, where min <= r < max
    level.next_dog_round = randomintrange( 7, 8 );   
    // PI_CHANGE_END
    
    old_spawn_func = level.round_spawn_func;
    old_wait_func  = level.round_wait_func;

    while ( 1 )
    {
        level waittill ( "between_round_over" );

        /#
            if( GetDvarInt( #"force_dogs" ) > 0 )
            {
                level.next_dog_round = level.round_number;
            }
        #/

        if ( level.round_number == level.next_dog_round )
        {
            level.music_round_override = true;
            old_spawn_func = level.round_spawn_func;
            old_wait_func  = level.round_wait_func;
            dog_round_start();
            level.round_spawn_func = ::dog_round_spawning;

            level.next_dog_round = 11 15 19 24 29 34 39 44 49
            /#
                get_players()[0] iprintln( "Next dog round: " + level.next_dog_round );
            #/
        }
        else if ( flag( "dog_round" ) )
        {
            dog_round_stop();
            level.round_spawn_func = old_spawn_func;
            level.round_wait_func  = old_wait_func;
            level.music_round_override = false;
            level.dog_round_count += 1;
        }           
    }   
}
 

P!X

Moderator
Staff member
Head Staff Team
Messages
335
Points
453
cause that
Code:
level.next_dog_round = 11 15 19 24 29 34 39 44 49
gives you bad syntax error
 

Top