Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --called once when the script loads
- function OnInit()
- Bombernauts.SetPowerupSpawnRate(99999, 99999); --disable item spawning
- end
- --called when the game resets and when a player joins
- function OnLoadout(player)
- player.SetBombAmmo(0); --disable bomb throwing
- end
- --called 60 times a second
- function OnUpdate()
- for player in Bombernauts.GetPlayers() do
- if player.BombAmmo == 0 then
- player.SetBombAmmo(-100); --set bomb ammo to -100 so this condition doesn't retrigger next frame
- Util.Timer("GrantPowers", 4.0, player); --call GrantPowers in 4 seconds
- end
- end
- end
- function GrantPowers(player)
- player.SetBombAmmo(1); --grant a bomb ammo to go along with this stack
- --choose 3 *unique* powerups, no conflicting elementals
- power1 = Bombernauts.RandomBombPowerup();
- power2 = Bombernauts.RandomBombPowerup();
- power3 = Bombernauts.RandomBombPowerup();
- while powersEqual(power1, power2) do
- power2 = Bombernauts.RandomBombPowerup();
- end
- while powersEqual(power1, power3) or powersEqual(power2, power3) do
- power3 = Bombernauts.RandomBombPowerup();
- end
- player.GrantPowerup(power1);
- player.GrantPowerup(power2);
- player.GrantPowerup(power3);
- end
- function powersEqual(p1, p2)
- --convert "Elemental_Ice", "Elemental_Fire", etc all to just "Elemental" for comparison
- if string.find(p1, "Elemental") then
- p1 = "Elemental";
- end
- if string.find(p2, "Elemental") then
- p2 = "Elemental";
- end
- return p1 == p2;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement