set g_start_ammo_cells 0
set g_start_ammo_plasma 0
set g_start_ammo_fuel 0
+set g_num_random_start_weapons 0
+set g_random_start_weapons "machinegun mortar electro crylink vortex hagar devastator"
+set g_random_start_shells 15
+set g_random_start_bullets 80
+set g_random_start_rockets 40
+set g_random_start_cells 30
+set g_random_start_plasma 30
set g_warmup_start_health 100 "starting values when being in warmup-stage"
set g_warmup_start_armor 100 "starting values when being in warmup-stage"
set g_warmup_start_ammo_shells 30 "starting values when being in warmup-stage"
set g_start_ammo_cells 0
set g_start_ammo_plasma 0
set g_start_ammo_fuel 0
+set g_num_random_start_weapons 0
+set g_random_start_weapons "machinegun mortar electro crylink vortex hagar devastator"
+set g_random_start_shells 15
+set g_random_start_bullets 80
+set g_random_start_rockets 15
+set g_random_start_cells 25
+set g_random_start_plasma 25
set g_warmup_start_health 250 "starting values when being in warmup-stage"
set g_warmup_start_armor 100 "starting values when being in warmup-stage"
set g_warmup_start_ammo_shells 50 "starting values when being in warmup-stage"
set g_start_ammo_cells 0
set g_start_ammo_plasma 0
set g_start_ammo_fuel 0
+set g_num_random_start_weapons 0
+set g_random_start_weapons "machinegun mortar electro crylink vortex hagar devastator"
+set g_random_start_shells 15
+set g_random_start_bullets 80
+set g_random_start_rockets 40
+set g_random_start_cells 30
+set g_random_start_plasma 30
set g_warmup_start_health 100 "starting values when being in warmup-stage"
set g_warmup_start_armor 100 "starting values when being in warmup-stage"
set g_warmup_start_ammo_shells 30 "starting values when being in warmup-stage"
set g_start_ammo_cells 0
set g_start_ammo_plasma 0
set g_start_ammo_fuel 0
+set g_num_random_start_weapons 0
+set g_random_start_weapons "machinegun mortar electro crylink vortex hagar devastator"
+set g_random_start_shells 15
+set g_random_start_bullets 80
+set g_random_start_rockets 40
+set g_random_start_cells 30
+set g_random_start_plasma 30
set g_warmup_start_health 100 "starting values when being in warmup-stage"
set g_warmup_start_armor 100 "starting values when being in warmup-stage"
set g_warmup_start_ammo_shells 30 "starting values when being in warmup-stage"
set g_start_ammo_cells 0
set g_start_ammo_plasma 0
set g_start_ammo_fuel 0
+set g_num_random_start_weapons 0
+set g_random_start_weapons "machinegun mortar electro crylink vortex hagar devastator"
+set g_random_start_shells 15
+set g_random_start_bullets 80
+set g_random_start_rockets 40
+set g_random_start_cells 30
+set g_random_start_plasma 30
set g_warmup_start_health 100 "starting values when being in warmup-stage"
set g_warmup_start_armor 100 "starting values when being in warmup-stage"
set g_warmup_start_ammo_shells 30 "starting values when being in warmup-stage"
set g_start_ammo_cells 0
set g_start_ammo_plasma 0
set g_start_ammo_fuel 0
+set g_num_random_start_weapons 0
+set g_random_start_weapons "machinegun mortar electro crylink vortex hagar devastator"
+set g_random_start_shells 15
+set g_random_start_bullets 80
+set g_random_start_rockets 40
+set g_random_start_cells 30
+set g_random_start_plasma 30
set g_warmup_start_health 100 "starting values when being in warmup-stage"
set g_warmup_start_armor 100 "starting values when being in warmup-stage"
set g_warmup_start_ammo_shells 30 "starting values when being in warmup-stage"
set g_start_ammo_cells 0
set g_start_ammo_plasma 0
set g_start_ammo_fuel 0
+set g_num_random_start_weapons 0
+set g_random_start_weapons "machinegun mortar electro crylink vortex hagar devastator"
+set g_random_start_shells 15
+set g_random_start_bullets 80
+set g_random_start_rockets 40
+set g_random_start_cells 30
+set g_random_start_plasma 30
set g_warmup_start_health 100 "starting values when being in warmup-stage"
set g_warmup_start_armor 100 "starting values when being in warmup-stage"
set g_warmup_start_ammo_shells 30 "starting values when being in warmup-stage"
player.(ammotype) = min(player.(ammotype) + amount, maxvalue);
}
+void GivePlayerRandomWeapons(entity player, int num_weapons,
+ string weapon_names, float shells, float bullets, float rockets,
+ float cells, float plasma)
+{
+ if (num_weapons == 0)
+ {
+ return;
+ }
+ int num_potential_weapons = tokenize_console(weapon_names);
+ for (int i = 0; i < num_weapons; ++i)
+ {
+ RandomSelection_Init();
+ for (int j = 0; j < num_potential_weapons; ++j)
+ {
+ string weapon = argv(j);
+ FOREACH(Weapons, it != WEP_Null,
+ {
+ // Finding a weapon which player doesn't have.
+ if (!(player.weapons & it.m_wepset) && (it.netname == weapon))
+ {
+ RandomSelection_AddEnt(it, 1, 1);
+ break;
+ }
+ });
+ }
+ if (RandomSelection_chosen_ent == NULL)
+ {
+ return;
+ }
+ player.weapons |= RandomSelection_chosen_ent.m_wepset;
+ switch (RandomSelection_chosen_ent.ammo_field)
+ {
+ case (ammo_shells):
+ {
+ if (player.ammo_shells != 0)
+ {
+ break;
+ }
+ GivePlayerAmmo(player, ammo_shells, shells);
+ break;
+ }
+ case (ammo_nails):
+ {
+ if (player.ammo_nails != 0)
+ {
+ break;
+ }
+ GivePlayerAmmo(player, ammo_nails, bullets);
+ break;
+ }
+ case (ammo_rockets):
+ {
+ if (player.ammo_rockets != 0)
+ {
+ break;
+ }
+ GivePlayerAmmo(player, ammo_rockets, rockets);
+ break;
+ }
+ case (ammo_cells):
+ {
+ if (player.ammo_cells != 0)
+ {
+ break;
+ }
+ GivePlayerAmmo(player, ammo_cells, cells);
+ break;
+ }
+ case (ammo_plasma):
+ {
+ if (player.ammo_plasma != 0)
+ {
+ break;
+ }
+ GivePlayerAmmo(player, ammo_plasma, plasma);
+ break;
+ }
+ }
+ }
+}
+
float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax, float mode)
{
if (!item.(ammotype))
/// \return No return.
void GivePlayerAmmo(entity player, .float ammotype, float amount);
+/// \brief Give several random weapons and ammo to the player.
+/// \param[in,out] player Player to give weapons to.
+/// \param[in] num_weapons Number of weapons to give.
+/// \param[in] weapon_names Names of weapons to give separated by spaces.
+/// \param[in] shells Amount of shells to give with shell-based weapon.
+/// \param[in] bullets Amount of bullets to give with bullet-based weapon.
+/// \param[in] rockets Amount of rockets to give with rocket-based weapon.
+/// \param[in] cells Amount of cells to give with cell-based weapon.
+/// \param[in] cells Amount of plasma to give with plasma-based weapon.
+void GivePlayerRandomWeapons(entity player, int num_weapons,
+ string weapon_names, float shells, float bullets, float rockets,
+ float cells, float plasma);
+
float ITEM_MODE_NONE = 0;
float ITEM_MODE_HEALTH = 1;
float ITEM_MODE_ARMOR = 2;
this.health = start_health;
this.armorvalue = start_armorvalue;
this.weapons = start_weapons;
+ GivePlayerRandomWeapons(this, num_random_start_weapons,
+ cvar_string("g_random_start_weapons"), random_start_shells,
+ random_start_bullets, random_start_rockets, random_start_cells,
+ random_start_plasma);
}
SetSpectatee_status(this, 0);
start_ammo_cells = cvar("g_start_ammo_cells");
start_ammo_plasma = cvar("g_start_ammo_plasma");
start_ammo_fuel = cvar("g_start_ammo_fuel");
+ num_random_start_weapons = cvar("g_num_random_start_weapons");
+ random_start_shells = cvar("g_random_start_shells");
+ random_start_bullets = cvar("g_random_start_bullets");
+ random_start_rockets = cvar("g_random_start_rockets");
+ random_start_cells = cvar("g_random_start_cells");
+ random_start_plasma = cvar("g_random_start_plasma");
}
if (warmup_stage)
start_ammo_cells = max(0, start_ammo_cells);
start_ammo_plasma = max(0, start_ammo_plasma);
start_ammo_fuel = max(0, start_ammo_fuel);
+ random_start_shells = max(0, random_start_shells);
+ random_start_bullets = max(0, random_start_bullets);
+ random_start_rockets = max(0, random_start_rockets);
+ random_start_cells = max(0, random_start_cells);
+ random_start_plasma = max(0, random_start_plasma);
warmup_start_ammo_shells = max(0, warmup_start_ammo_shells);
warmup_start_ammo_nails = max(0, warmup_start_ammo_nails);
float start_ammo_cells;
float start_ammo_plasma;
float start_ammo_fuel;
+int num_random_start_weapons;
+float random_start_shells;
+float random_start_bullets;
+float random_start_rockets;
+float random_start_cells;
+float random_start_plasma;
float start_health;
float start_armorvalue;
WepSet warmup_start_weapons;