Code: Select all
// This script is for "universal" item dropping - enemies need not be replaced, this script will
// drop either a proportional amount of Cola Bubbles to enemies' HP, or (randomly) missiles, based
// on whether a Missile Launcher has been collected by the enemy's killer.
// As of 12/18/2017, though, it does NOT check for missile launchers because I kind of don't know
// how to make that happen. So things just drop missiles whenever they want. Whatever.
Script "ColaItemDropper" KILL
{
// So first, an explanation of the "HP Multiplier."
// In order to determine how many Cola Bubbles get dropped by a given monster,
// I'm taking their spawn health and dividing it by a Magic Number, i.e. ColaBubbleHPMult.
// This produces what I'm going to call the "HP factor." The int ThisMaxHealth,
// then, takes the calling actor's spawn health and dividing it by the magic number.
// So, for example, an Imp has a spawn health of 60, which gets divided by magic number 30,
// resulting in an HP factor of 2.
int ColaBubbleHPMult = 30;
int ThisMaxHealth = ( GetMaxInventory(0, "Health") / ColaBubbleHPMult );
// From there, I run a few checks divided into what I'm calling "tiers."
// Small monsters - usually zombiemen - who wind up with an HP factor of 1 or below,
// skip all the other ensuing checks and only drop one cola bubble.
// They will never drop missiles, because that's bad for game balance.
if ( ThisMaxHealth <= 1 )
{
DropItem(0, "ColaBubblePickup");
}
// The second tier is "medium monsters". If the enemy's HP factor is over 1,
// but below or equal to 15, that's when we start doing some randomness.
else if ( ThisMaxHealth > 1 && ThisMaxHealth <= 15 )
{
if ( random(0, 255) > 127 ) // Apparently this is "more random" than random(0, 1). Who knew?
{
DropItem(0, "DroppedMissileLauncherAmmo"); // Approx. half the time, a medium monster will drop a missile instead of cola bubbles.
}
// If we're not dropping the missile, drop a bubble for as long as ThisMaxHealth has value.
// Essentially, the monster's HP factor is exactly the number of cola bubbles they'll drop.
// This for loop only occurs if the monster did NOT drop a missile instead.
// I could have done it backwards, but I have a suspicion this is slightly easier
// on the ACS VM.
else for ( int i1 = ThisMaxHealth; i1 >= 1; i1-- )
{
DropItem(0, "ColaBubblePickup");
delay(1);
}
}
// Bigger monsters, of HP factors over 15 but below 25 (everything up to an Arch-Vile)
// do an alternate version of the check that drops more missiles but less cola bubbles.
else if ( ThisMaxHealth > 15 && ThisMaxHealth < 25 )
{
if ( random(0, 255) > 127 )
{
DropItem(0, "DroppedMissileLauncherAmmo");
DropItem(0, "DroppedMissileLauncherAmmo");
DropItem(0, "DroppedMissileLauncherAmmo");
}
// If we're not dropping the missiles, drop a bubble approx. half the time,
// for as long as ThisMaxHealth has value. Because otherwise, Hell Knights and
// Cacodemons drop way too many bubbles for how threatening they are,
// and basically become instant level ups for the lower-tier weapons.
else for ( int i2 = ThisMaxHealth; i2 >= 1; i2-- ) // Yes, changing the name of the int because ACC complains otherwise.
{
DropItem(0, "ColaBubblePickup", 1, 127); // Taking advantage of DropItem's chance arg here.
delay(1);
}
}
// The biggest monsters - Barons and bosses - drop way more ammo, but still less cola bubbles.
else if ( ThisMaxHealth >= 25 )
{
DropItem(0, "DroppedMissileLauncherAmmo");
DropItem(0, "DroppedMissileLauncherAmmo");
DropItem(0, "DroppedMissileLauncherAmmo");
DropItem(0, "DroppedMissileLauncherAmmo");
DropItem(0, "DroppedMissileLauncherAmmo");
for ( int i3 = ThisMaxHealth; i3 >= 1; i3-- )
{
DropItem(0, "ColaBubblePickup", 1, 96); // Throttled down to about a third the drop chance.
delay(1);
}
}
}