Answered How can I target the level using a Script within a Mod?

Atchfam77

Veteran
Messages
3
Reaction score
2
Points
778
I'm wanting to make a mod where whenever it is in use, the pack a punch camo for that level is swapped to Dark Matter (index 17). I also want to make the player's points 50,000 on startup and change the perk cap to 9. All of these are below as follows:

level.player_starting_points = 50000;
level.pack_a_punch_camo_index = 17;
level.perk_purchase_limit = 9;

I found these strings from mapping tutorials and figured because both maps and mods use GSC that I could just copy them over (I'm new to modding, very new*). These from those tutorials are meant to target the level, which is what I think is causing my mod to not execute. Any help is appreciated very much.
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
4,998
Reaction score
2,918
Points
1,053
I'm wanting to make a mod where whenever it is in use, the pack a punch camo for that level is swapped to Dark Matter (index 17). I also want to make the player's points 50,000 on startup and change the perk cap to 9. All of these are below as follows:

level.player_starting_points = 50000;
level.pack_a_punch_camo_index = 17;
level.perk_purchase_limit = 9;

I found these strings from mapping tutorials and figured because both maps and mods use GSC that I could just copy them over (I'm new to modding, very new*). These from those tutorials are meant to target the level, which is what I think is causing my mod to not execute. Any help is appreciated very much.
Hello,
welcome in the Black Ops 3 Modding community! :smile:

This is pretty easy to realize. First of all follow this startup tutorial here: Tutorial - Black Ops 3 Zombie GSC Modding - How to start coding a mod? Startup Mod +Download | CabConModding

After that you should get a file with that code:
Code:
/*

▒█▀▀█ █▀▀█ █▀▀▄ ▒█▀▀█ █▀▀█ █▀▀▄ ▒█▀▄▀█ █▀▀█ █▀▀▄ █▀▀▄ ░▀░ █▀▀▄ █▀▀▀
▒█░░░ █▄▄█ █▀▀▄ ▒█░░░ █░░█ █░░█ ▒█▒█▒█ █░░█ █░░█ █░░█ ▀█▀ █░░█ █░▀█
▒█▄▄█ ▀░░▀ ▀▀▀░ ▒█▄▄█ ▀▀▀▀ ▀░░▀ ▒█░░▒█ ▀▀▀▀ ▀▀▀░ ▀▀▀░ ▀▀▀ ▀░░▀ ▀▀▀▀
Check out cabconmodding.com!

*/

#using scripts\codescripts\struct;

#using scripts\shared\callbacks_shared;
#using scripts\shared\system_shared;

#insert scripts\shared\shared.gsh;

#namespace clientids;

REGISTER_SYSTEM( "clientids", &__init__, undefined )
    
function __init__()
{
    callback::on_start_gametype( &init );
    callback::on_connect( &on_player_connect );
    callback::on_spawned( &on_player_spawned );
}   

function init()
{
    level.clientid = 0;
}

function on_player_connect()
{
    self.clientid = matchRecordNewPlayer( self );
    if ( !isdefined( self.clientid ) || self.clientid == -1 )
    {
        self.clientid = level.clientid;
        level.clientid++;
    }

}

function on_player_spawned()
{
    iPrintln("^1cabconmodding.com");
}

Now you can simple add your code to init():
Code:
function init()
{
    level.clientid = 0;
    level.player_starting_points = 50000;
    level.pack_a_punch_camo_index = 17;
    level.perk_purchase_limit = 9;
}

It should look like this:
Code:
/*

▒█▀▀█ █▀▀█ █▀▀▄ ▒█▀▀█ █▀▀█ █▀▀▄ ▒█▀▄▀█ █▀▀█ █▀▀▄ █▀▀▄ ░▀░ █▀▀▄ █▀▀▀
▒█░░░ █▄▄█ █▀▀▄ ▒█░░░ █░░█ █░░█ ▒█▒█▒█ █░░█ █░░█ █░░█ ▀█▀ █░░█ █░▀█
▒█▄▄█ ▀░░▀ ▀▀▀░ ▒█▄▄█ ▀▀▀▀ ▀░░▀ ▒█░░▒█ ▀▀▀▀ ▀▀▀░ ▀▀▀░ ▀▀▀ ▀░░▀ ▀▀▀▀
Check out cabconmodding.com!

*/

#using scripts\codescripts\struct;

#using scripts\shared\callbacks_shared;
#using scripts\shared\system_shared;

#insert scripts\shared\shared.gsh;

#namespace clientids;

REGISTER_SYSTEM( "clientids", &__init__, undefined )
    
function __init__()
{
    callback::on_start_gametype( &init );
    callback::on_connect( &on_player_connect );
    callback::on_spawned( &on_player_spawned );
}   

function init()
{
    level.clientid = 0;
    level.player_starting_points = 50000;
    level.pack_a_punch_camo_index = 17;
    level.perk_purchase_limit = 9;
}

function on_player_connect()
{
    self.clientid = matchRecordNewPlayer( self );
    if ( !isdefined( self.clientid ) || self.clientid == -1 )
    {
        self.clientid = level.clientid;
        level.clientid++;
    }

}

function on_player_spawned()
{
    iPrintln("^1cabconmodding.com");
}

After that you need to compile the mod (also described in the startup tutorial). You can use the mod now. :smile:

I hope this helped you a little bit.

Best regards,
CabCon.
 
Top