launchers_weapons_rewards 1.0.1

- Add WeaponIsValid to only start the reward loop if the spawn weapon is a launcher
- Update README
This commit is contained in:
Resxt 2022-03-09 11:40:22 +01:00
parent 6110607465
commit 899431bed2
2 changed files with 36 additions and 15 deletions

View File

@ -5,6 +5,7 @@ Scripts that give the players different weapons or perks depending on their curr
## launchers_weapons_rewards.gsc ## launchers_weapons_rewards.gsc
Gives the player a new weapon every time he reaches a new tier. Gives the player a new weapon every time he reaches a new tier.
`WeaponIsValid()` ensures that the rewards are only given if the player's spawn weapon is a launcher.
If the player reaches the last tier the loop restarts allowing players to get tiers several time per life if they ever get enough kills. If the player reaches the last tier the loop restarts allowing players to get tiers several time per life if they ever get enough kills.
For example with this script if you get 50 kills in a row you would get the AC130 105mm two times. For example with this script if you get 50 kills in a row you would get the AC130 105mm two times.
This is how the script is configured This is how the script is configured

View File

@ -34,8 +34,6 @@ OnPlayerSpawned()
{ {
self waittill("spawned_player"); self waittill("spawned_player");
print(self.name);
if (isDefined(self.pers["isBot"])) if (isDefined(self.pers["isBot"]))
{ {
if (self.pers["isBot"]) if (self.pers["isBot"])
@ -48,15 +46,6 @@ OnPlayerSpawned()
} }
} }
ReplaceWeapon(new_weapon)
{
self TakeAllWeapons();
self GiveWeapon(new_weapon);
self GiveWeapon("semtex_mp"); // Found in dsr files
self GiveWeapon("flare_mp"); // Tactical insertion - found in common_mp.ff
self SetSpawnWeapon(new_weapon); // This gives the weapon without playing the animation
}
WeaponReward() WeaponReward()
{ {
self endon ("disconnect"); self endon ("disconnect");
@ -64,11 +53,14 @@ WeaponReward()
spawn_weapon = self GetCurrentWeapon(); spawn_weapon = self GetCurrentWeapon();
while(true) if (WeaponIsValid(spawn_weapon))
{ {
weapon_rewards = [[5, "m320_mp"], [10, "rpg_mp"], [15, "ac130_40mm_mp"], [25, "ac130_105mm_mp"], [35, spawn_weapon]]; // [kills_required, weapon_reward] while(true)
CheckWeaponReward(weapon_rewards); {
wait 0.01; weapon_rewards = [[5, "m320_mp"], [10, "rpg_mp"], [15, "ac130_40mm_mp"], [25, "ac130_105mm_mp"], [35, spawn_weapon]]; // [kills_required, weapon_reward]
CheckWeaponReward(weapon_rewards);
wait 0.01;
}
} }
} }
@ -95,6 +87,34 @@ CheckWeaponReward(weapon_rewards)
} }
} }
ReplaceWeapon(new_weapon)
{
self TakeAllWeapons();
self GiveWeapon(new_weapon);
self GiveWeapon("semtex_mp"); // Found in dsr files
self GiveWeapon("flare_mp"); // Tactical insertion - found in common_mp.ff
self SetSpawnWeapon(new_weapon); // This gives the weapon without playing the animation
}
WeaponIsValid(weapon)
{
switch (weapon)
{
case "iw5_smaw_mp":
return true;
case "rpg_mp":
return true;
case "m320_mp":
return true;
case "xm25_mp":
return true;
case "javelin_mp":
return true;
default:
return false;
}
}
// Allow the AC-130 kills to be counted in player.pers["cur_kill_streak"] // Allow the AC-130 kills to be counted in player.pers["cur_kill_streak"]
WhitelistKillstreaksInKillsCount( weapon ) WhitelistKillstreaksInKillsCount( weapon )
{ {