The name of the gun is "CompanionZombieManGun" and there will be many more gun types that inherit from BaseGun, so how can I do this dynamically?
Code: Select all
class BaseGun : Weapon
{
int AmmoUsage;
property AmmoUsage : AmmoUsage;
Default
{
Weapon.AmmoUse1 0;
BaseGun.AmmoUsage 0;
}
States
{
Fire:
TNT1 A 0 A_FireProjectile("myProjectile");
}
}
class CompanionZombieManGun: BaseGun
{
Default
{
Weapon.AmmoUse1 1;
BaseGun.AmmoUsage 2;
}
}
class myProjectile : Actor
{
TNT1 A 0
{
Death:
console.printf(target.player.readyweapon.AmmoUse1..""); // no error when compiling this line
console.printf(target.player.readyweapon.AmmoUsage..""); // complains about AmmoUsage Unknown identifier
}
}