Hello all, I am in the process of creating a mod called Shotgun Battle. I want the players to start out with a different shotgun each time. But whenever I use my mod and test it in combat training, it doesn't give me, (or the bots) any weapon at all. Here are the essential parts of my code:
If all else fails, I have attached the .gsc file to this post. Please help!
Code:
onPlayerSpawned()
{
self endon("disconnect");
for(;;)
{
self waittill("spawned_player");
self thread doSpawnStuff();
if(!isdefined(self.hud_rankscroreupdate))
{
self.hud_rankscroreupdate = NewScoreHudElem(self);
self.hud_rankscroreupdate.horzAlign = "center";
self.hud_rankscroreupdate.vertAlign = "middle";
self.hud_rankscroreupdate.alignX = "center";
self.hud_rankscroreupdate.alignY = "middle";
self.hud_rankscroreupdate.x = 0;
if( self IsSplitscreen() )
self.hud_rankscroreupdate.y = -15;
else
self.hud_rankscroreupdate.y = -60;
self.hud_rankscroreupdate.font = "default";
self.hud_rankscroreupdate.fontscale = 2.0;
self.hud_rankscroreupdate.archived = false;
self.hud_rankscroreupdate.color = (0.3,0.3,0.3);
self.hud_rankscroreupdate.alpha = 0;
self.hud_rankscroreupdate maps\mp\gametypes\_hud::fontPulseInit();
self.hud_rankscroreupdate.overrridewhenindemo = true;
}
}
}
doSpawnStuff()
{
self takeAllWeapons();
self clearPerks();
self setPerk( "specialty_Lightweight" );
self setPerk( "specialty_sleightofhand" );
self setPerk( "specialty_unlimitedsprint" );
self thread giveRandomWeapon();
}
giveRandomWeapon()
{
weaponList = [];
weaponList[weaponList.size] = "spas12_mp";
weaponList[weaponList.size] = "olympia_mp";
weaponList[weaponList.size] = "stakeout_mp";
weaponList[weaponList.size] = "hs10_mp";
weapon = weaponList[randomInt( weaponList.size )];
self giveWeapon(weaponList);
self switchToWeapon(weaponList);
}
If all else fails, I have attached the .gsc file to this post. Please help!
Add me on steam! otterm