Modme Forums

Different starting weapon on each player!

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


ModmeBot:

Thread By: KeksMafiosi

I'm working on my map, and i want to give each character a different starting weapon (Nikolai has Mauser, Dempsey has M1911, etc.)

I have no idea how to create a script by myself, so help would be much appreciated.


ModmeBot:

Reply By: Kingslayer Kyle

KeksMafiosi

I'm working on my map, and i want to give each character a different starting weapon (Nikolai has Mauser, Dempsey has M1911, etc.)

I have no idea how to create a script by myself, so help would be much appreciated.

*Fixed, tested myself and it works.. sorry for the horrible coding.. when I scripted this for you I'd just got back off a week on holiday. Lol

//Kingslayer Kyle

//Add the code below underneath zm_usermap::main(); in function main() in your mapname.gsc

callback::on_spawned( &on_player_spawned );

//Add the code underneath to the bottom of your mapname.gsc

//Where it says "weapon name here", change this to the name of your weapons.

function on_player_spawned()
{
	self thread giveStartWeapons();
}

function giveStartWeapons()
{
	wait 5;
	self thread player1();
	self thread player2();
	self thread player3();
	self thread player4();
}

function player1() //Dempsey
{
	players = GetPlayers();
	player_1 = players[0];
	if ( self.playername == ""+player_1.playername+"" )
	{
	self func_giveWeapon("pistol_standard");
	}
}

function player2() //Nikolai
{
	players = GetPlayers();
	player_2 = players[1];
	if ( self.playername == ""+player_2.playername+"" )
	{
	self func_giveWeapon("pistol_revolver38");
	}
}

function player3() //Richtofen
{
	players = GetPlayers();
	player_3 = players[2];
	if ( self.playername == ""+player_3.playername+"" )
	{
	self func_giveWeapon("pistol_burst");
	}
}

function player4() //Takeo
{
	players = GetPlayers();
	player_4 = players[3];
	if ( self.playername == ""+player_4.playername+"" )
	{
	self func_giveWeapon("pistol_fullauto");
	}
}

function func_giveWeapon(weapon)
{
    self TakeWeapon(self GetCurrentWeapon());
    weapon = getWeapon(weapon);
    self GiveWeapon(weapon);
    self GiveMaxAmmo(weapon);
    self SwitchToWeapon(weapon);
}


ModmeBot:

Reply By: itznvy

^1

^1^

^1ERR(6E) scripts/zm/zm_dieschwarzenstraben_remade.gsc (127,0) : Compiler Internal Error : Uninitialized local variable 'player_1'

In the script you gave, this is what i got.


ModmeBot:

Reply By: Dan9977

itznvy

^1

^1^

^1ERR(6E) scripts/zm/zm_dieschwarzenstraben_remade.gsc (127,0) : Compiler Internal Error : Uninitialized local variable 'player_1'

In the script you gave, this is what i got.

change player_1 to level.player_1 and do the same for the other players


ModmeBot:

Reply By: KeksMafiosi

Just tried it, doesn't work


ModmeBot:

Reply By: Kingslayer Kyle

KeksMafiosi

Just tried it, doesn't work

Just edited my original post at the top, It works I've tested it myself


ModmeBot:

Reply By: itznvy

Kingslayer
KeksMafiosi

Just tried it, doesn't work

Just edited my original post at the top, It works I've tested it myself

Any Way to make it where you dont have the MR6 as a secondary weapon?


ModmeBot:

Reply By: tbone-5

itznvy
Kingslayer
KeksMafiosi

Just tried it, doesn't work

Just edited my original post at the top, It works I've tested it myself

Any Way to make it where you dont have the MR6 as a secondary weapon?

I'm not a good scripter, but maybe something like this. after wait is where you give the weapons to player

self TakeAllWeapons();
        string = "knife";
        wait(0.5);