The effect should allow players to "stack" an addition of 10 seconds PERMANENTLY every time we collect this object, that it's been called LungsCapacity... I tried checking for some good VirtualFunctions to override and let the effect work (DoEffect, InitEffect and toying with playerpawn.aircapacity somehow), but still the effect doesn't happen as intended.
I am gonna into details of what I have atm and what did I try, without any luck:
The MAPINFO of the project has AirCapacity set to 30 on its DefaultMap, also the AirControl is set to 0.00390625
By checking this forum, I noticed something that might have help for my purpose, but with no avail unfortunately, cause it doesn't stack.
This is the actual code, which mind you it doesn't work yet:
Player
Code: Select all
Class DExh_Player : DoomPlayer
{
//Define here all the weapons you plan to put
//Player.WeaponSlot 1, "DExh_Machete", "DExh_Fist";
Default
{
Speed 1.1;
Radius 16;
Height 46;
Player.StartItem "DExh_Underwater";
Player.StartItem "Machete";
Player.StartItem "PistolFix";
Player.StartItem "MagnumRounds", 20;
Player.MaxHealth 100;
+OLDRADIUSDMG
}
override void CheckAirSupply()
{
{
let player = self.player;
if (waterlevel < 3 || (bInvulnerable) || (player.cheats & (CF_GODMODE | CF_NOCLIP2)) || (player.cheats & CF_GODMODE2))
{
ResetAirSupply();
}
else if (player.air_finished <= Level.maptime && !(Level.maptime & 31))
{
DamageMobj(NULL, NULL, 2 + ((Level.maptime - player.air_finished) / TICRATE), 'Drowning');
}
}
}
}Code: Select all
Class PowerAir : PowerIronFeet
{
Default
{
Powerup.Duration -1;
Inventory.MaxAmount 1;
+INVENTORY.HUBPOWER
+INVENTORY.ALWAYSPICKUP
+INVENTORY.AUTOACTIVATE
//Inventory.Icon "I_MASK";
}
override void AbsorbDamage (int damage, Name damageType, out int newdamage, Actor inflictor, Actor source, int flags)
{
if (damageType == 'Drowning') //checks only Drowning, original also check Fire - ozy81
{
newdamage = 0;
}
}
override void DoEffect ()
{
Super.DoEffect ();
if (!(Level.maptime & 0x3f))
{
//need to figure out this better, atm does nothing
}
}
}Code: Select all
Class Gills : Inventory
{
override void doeffect()
{
if (owner is "playerpawn")
{
//playerpawn(owner).aircapacity = playerpawn(owner).aircapacity + 0.5;
playerpawn(owner).aircapacity + 1.3;
}
}
}
Class LungCapacity : CustomInventory
{
Default
{
//$Category Powerups
//$Title Lung Capacity (+10)
Radius 16;
Height 16;
Scale 1.3;
Inventory.Pickupsound "";
Inventory.PickupMessage "";
FloatBobStrength 0.2;
+COUNTITEM
+FLOATBOB
+INVENTORY.ALWAYSPICKUP
+NOGRAVITY
//Armor.SaveAmount 1
//Armor.MaxSaveAmount 0 //200
}
States
{
Spawn:
LUNG ABCDCBA 8 BRIGHT;
Loop;
Pickup:
TNT1 A 0 { A_GiveInventory("Gills", 1); A_GiveInventory("PowerAir", 1); }
Stop;
}
}
