- How can I make a "background reload" like in Beautiful Doom but whitout any ammo ? (for exemple in my code with "Int NailgunCharge")Dr_Cosmobyte wrote:Weapons mod idea:
All your weapons have infinite ammo (which gives room for more situational weapons and more items on ammo pickups),
BUT
The more you you use them, the worse they get, until they deal the minimal damage possible, and you must wait them for recharge in the background if you want to use them full power again (although you can still use them if you ever need to, no restrictions involved). Ammo pickups could help them recharge faster, OR some weapons could recharge faster than others.
Don't know what crossed my mind so i could have this idea. Hope someone makes a good use of it.
- How could I reload faster a weapon with "fake ammo pickups" (with the utilisation of Inventory and/or Int)
Spoiler: Exemple with a Nailgun[spoiler="background reload" code of Beautiful Doom. All Credits to Agent_Ash aka Jekyll Grim Payne]
Code: Select all
// I removed some parts of the original code for keeping the important parts of my request. - Ac!d
Class BDoomWeapon : Weapon abstract
{
protected int NonselTimer; //counts how long the weapon was deselected, used for automatic background reload
protected int AutoReloadTime; //the value that NonselTimer is compared to
property AutoReloadTime : AutoReloadTime;
Default
{
BDoomWeapon.AutoReloadTime 60;
BDoomWeapon.maxOffsetTics 1; //required default values for A_CameraSway. Otherwise it'll crash due to division by zero
BDoomWeapon.offsetTics -1;
}
override void DoEffect()
{
if (!owner || !owner.player)
return;
let plr = owner.player;
Super.DoEffect();
if (!ammo1 || !ammo2 || (ammo1 == ammo2))
return;
if (plr.readyweapon == self || ammo1.amount == ammo1.maxamount || ammo2.amount < 1) {
NonselTimer = 0;
return;
}
if (NonselTimer < AutoReloadTime)
NonselTimer++;
else
{
while (ammo2.amount > 0 && ammo1.amount < ammo1.maxamount)
{
owner.TakeInventory(ammo2.GetClass(),1);
owner.GiveInventory(ammo1.GetClass(),1);
}
if (plr == players[consoleplayer])
Console.Printf("%s reloaded",GetTag());
owner.A_StartSound(reloadsound,slot:CHAN_AUTO,flags:CHAN_NOPAUSE,volume:0.5,attenuation:20);
}
}
}
