New Modme platform coming soon!
Allow players to pick a starting pistol every game
Viewed 586 time(s)
Topic created on 1500237780
Original post
Modme User
2 wins

I had trouble deciding which starting pistol I wanted to use in my map, so I instead created a script to allow the player to decide for themselves!

This script currently only allows for 2 options. It gives the player 10 seconds, then takes away whichever gun they aren't holding.




Open your mapname.gsc located in (Call of Duty Black Ops III\usermaps\map_name\scripts\zm)


At the top, somewhere within main, add this line and replace the text in quotes with the name of the second weapon you want as an option:


level thread choose_pistol("t7_pistol_m1911");


Then, at the bottom, add this function:


function choose_pistol(secondWep)
	level flag::wait_till( "initial_blackscreen_passed" );
	players = GetPlayers();
	secondary = GetWeapon(secondWep);

	foreach(player in players)
		player GiveWeapon(secondary);
	IPrintLnBold("Choose your starting pistol. The other will disappear in 10 seconds.");
	foreach(player in players)
		choice = player GetCurrentWeapon();
		ammo_clip = player GetWeaponAmmoClip(choice);
		ammo_fuel = player GetWeaponAmmoFuel(choice);
		ammo_stock = player GetWeaponAmmoStock(choice);
		player TakeAllWeapons();
		player GiveWeapon(choice);
		player giveWeapon( level.weaponBaseMelee );
		player SetWeaponAmmoClip(choice,ammo_clip);
		player SetWeaponAmmoFuel(choice,ammo_fuel);
		player SetWeaponAmmoStock(choice,ammo_stock);
		level thread zm::award_grenades_for_survivors(); 
	IPrintLnBold("Starting pistol locked in.");




When you load into your map it will give you your "second" weapon alongside your normal starting pistol and after 10 seconds will take away the one you aren't holding.



Disclaimer: I am by no means an experienced scripter and it's very possible there's a better way to make this script so if anyone has suggestions for how it can be made better I'm open to hearing them. I would think there's probably a better way to do the last part of the script in particular, but I tried many different things and wasn't able to figure out a "better" way.

Reply #1 on 1500238292
Modme User
32 wins

This is awesome, great tutorial!

---{ Wild's BO3 Releases }---
Wild's Advanced ZM Template! -
Wild's Black Ops 2 Shader Pack! -
Wild's Round Sounds! -
Wild's Shootable Perk-a-Holic! -

---{ Wild's BO3 Tutorials }---
Fix Custom Weapons Not Going In The Box! -

---{ View my portfolio here! (WIP) }---
Reply #2 on 1500258282
Modme User
1 wins

oh my god thank you!!! i was literally thinking about this because i want to have all of the pistols from WAW - IW 



Reply #3 on 1500262951
Modme User
2 wins

Glad to help :)