Modme Forums

scripting for a zm_mod

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


ModmeBot:

Thread By: m1cke
What .gsc i need to add to change starting weapon on my mod

i've tried so mutch like the _clientids.gsc adding a script for the change weapon in another .gsc and

scripts\shared\callbacks_shared;



#using scripts\shared\flag_shared;



function giveweapon()
{

    startingWeapon = "mauser";
    weapon = getWeapon(startingWeapon);
    level.start_weapon = (weapon);
}


#using scripts\zm\giveweapon;
#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 );
}

function init()
{
// this is now handled in code ( not lan )
// see s_nextScriptClientId 
level.clientid = 0;
    level thread giveweapon::giveplayerweapon();


}

function on_player_connect()
{
level thread lots_o_points();
self.clientid = matchRecordNewPlayer( self );
if ( !isdefined( self.clientid ) || self.clientid == -1 )
{
self.clientid = level.clientid;
level.clientid++;// Is this safe? What if a server runs for a long time and many people join/leave
}

}


ModmeBot:

Reply By: Koan
Here is a guide in our Wiki explaining how to change your starting weapon. http://phabricator.aviacreations.com/w/black_ops_3/basics/change_start_weapon/



Also, for future reference, please make sure you put all code in code tags, I've done it for you this time. Thanks.


ModmeBot:

Reply By: m1cke
you can se my function giveweapon i use the code on the wiki and i call it from init but it dosen't work


ModmeBot:

Reply By: DTZxPorter

m1ckeyou can se my function giveweapon i use the code on the wiki and i call it from init but it dosen't work


You should be calling it from where It says in the wiki, not some script you make.


ModmeBot:

Reply By: m1cke

DTZxPorter
m1ckeyou can se my function giveweapon i use the code on the wiki and i call it from init but it dosen't work


You should be calling it from where It says in the wiki, not some script you make.


okay porter so i call it from main?


ModmeBot:

Reply By: m1cke

function main( )
{
	globallogic::init();

	GlobalLogic_SetupDefault_ZombieCallbacks();
	
	menu_init();
	
	//util::registerRoundLimit( minValue, maxValue )
	util::registerRoundLimit( 1, 1 );
	
	//util::registerTimeLimit( minValue, maxValue )
	util::registerTimeLimit( 0, 0 );
	
	//util::registerScoreLimit( minValue, maxValue )
	util::registerScoreLimit( 0, 0 );
	
	//util::registerRoundWinLimit( minValue, maxValue )
	util::registerRoundWinLimit( 0, 0 );
	
	//util::registerNumLives( minValue, maxValue )
	util::registerNumLives( 1, 1 );



    startingWeapon = "mauser";
    weapon = getWeapon(startingWeapon);
    level.start_weapon = (weapon);

	weapons::registerGrenadeLauncherDudDvar( level.gameType, 10, 0, 1440 );
	weapons::registerThrownGrenadeDudDvar( level.gameType, 0, 0, 1440 );
	weapons::registerKillstreakDelay( level.gameType, 0, 0, 1440 );

	globallogic::registerFriendlyFireDelay( level.gameType, 15, 0, 1440 );


	level.player_starting_points = 75000;
	level.takeLivesOnDeath = true;
	level.teamBased = true;
	level.disablePrematchMessages = true;	//NEW
	level.disableMomentum = true;			//NEW
	
	level.overrideTeamScore = false;
	level.overridePlayerScore = false;
	level.displayHalftimeText = false;
	level.displayRoundEndText = false;
	
	level.allowAnnouncer = false;
	//level.allowZmbAnnouncer = true;
	
	level.endGameOnScoreLimit = false;
	level.endGameOnTimeLimit = false;
	level.resetPlayerScoreEveryRound = true;
	
	level.doPrematch = false;
	level.noPersistence = true;
	level.cumulativeRoundScores = true;
	
	level.forceAutoAssign = true;
	level.dontShowEndReason = true;
	level.forceAllAllies = true;			//NEW
	
	//DISABLE TEAM SWAP
	level.allow_teamchange = false;
	SetDvar( "scr_disable_team_selection", 1 );
	//makeDvarServerInfo( "scr_disable_team_selection", 1 );
	
	SetDvar( "scr_disable_weapondrop", 1 );
	
	level.onStartGameType = &onStartGameType;
//	level.onSpawnPlayer = &onSpawnPlayer;
	level.onSpawnPlayer = &globallogic::blank;
	level.onSpawnPlayerUnified = &onSpawnPlayerUnified;
	level.onRoundEndGame = &onRoundEndGame;
	//level.giveCustomLoadout = &giveCustomLoadout;
	level.playerMaySpawn = &maySpawn;

	zm_utility::set_game_var("ZM_roundLimit", 1);
	zm_utility::set_game_var("ZM_scoreLimit", 1);

	zm_utility::set_game_var("_team1_num", 0);
	zm_utility::set_game_var("_team2_num", 0);
	
	map_name = level.script;

	//level.gamemode_match = spawnstruct();	

	mode = GetDvarString( "ui_gametype" );
	
	if((!isdefined(mode) || mode == "") && isdefined(level.default_game_mode))
	{
		mode = level.default_game_mode;
	}
	
	zm_utility::set_gamemode_var_once("mode", mode);
	
	zm_utility::set_game_var_once("side_selection", 1);
	
	location = level.default_start_location;
	zm_utility::set_gamemode_var_once("location", location);
	

	//* level.gamemode_match.num_rounds = GetDvarInt("zm_num_rounds");
	//level.gamemode_match.rounds = [];
	zm_utility::set_gamemode_var_once("randomize_mode", GetDvarInt("zm_rand_mode"));
	zm_utility::set_gamemode_var_once("randomize_location", GetDvarInt("zm_rand_loc"));
	zm_utility::set_gamemode_var_once("team_1_score", 0);
	zm_utility::set_gamemode_var_once("team_2_score", 0);
	zm_utility::set_gamemode_var_once("current_round", 0);
	zm_utility::set_gamemode_var_once("rules_read", false);
	zm_utility::set_game_var_once("switchedsides", false);
	
	gametype = GetDvarString("ui_gametype");
	
	game["dialog"]["gametype"] = gametype + "_start";
	game["dialog"]["gametype_hardcore"] = gametype + "_start";
	game["dialog"]["offense_obj"] = "generic_boost";
	game["dialog"]["defense_obj"] = "generic_boost";
	
	zm_utility::set_gamemode_var("pre_init_zombie_spawn_func", undefined);
	zm_utility::set_gamemode_var("post_init_zombie_spawn_func", undefined);
	zm_utility::set_gamemode_var("match_end_notify", undefined);
	zm_utility::set_gamemode_var("match_end_func", undefined);
	
	// Sets the scoreboard columns and determines with data is sent across the network
	setscoreboardcolumns( "score", "kills", "downs", "revives", "headshots" ); 
	callback::on_connect( &onPlayerConnect_check_for_hotjoin);
	// level thread module_hud_connecting();
	tempboxfix::init(  );
}

Im using zm_gametype main for the change starting weapon and change starting points for my gun mod


ModmeBot:

Reply By: Koan

m1cke(code)



Im using zm_gametype main for the change starting weapon and change starting points for my gun mod




No, that's wrong. Follow the tutorial properly.



In your mapname.gsc (for example zm_giant.gsc), find the line "zm_usermap::main();", then add the code provided underneath it.



You're calling it from some other main function. Nowhere in the tutorial does it ask you to do this.


ModmeBot:

Reply By: m1cke

Koan
m1cke(code)



Im using zm_gametype main for the change starting weapon and change starting points for my gun mod




No, that's wrong. Follow the tutorial properly.



In your mapname.gsc (for example zm_giant.gsc), find the line "zm_usermap::main();", then add the code provided underneath it.



You're calling it from some other main function. Nowhere in the tutorial does it ask you to do this.


I don't have a mapname.gsc becuse im making a mod so what .gsc should i use