Time for action – Modifying the projectile
For this experiment we're going to intercept the projectile that's being spawned from our rocket launcher and modify it before sending it on its way. We'll do this in our AwesomeWeapon_RocketLauncher
class.
Open
AwesomeWeapon_RocketLauncher
and add theProjectileFire
function:simulated function Projectile ProjectileFire() { local Projectile MyProj; MyProj = super.ProjectileFire(); `log(MyProj); return MyProj; }
ProjectileFire
is originally declared inWeapon.uc
. Additionally, if we take a look at theFireAmmunition
function, we can see the effect that the default property of our rocket launcher here has:WeaponFireTypes(0)=EWFT_Projectile WeaponFireTypes(1)=EWFT_Projectile
In the
FireAmmunition
function we can see that it uses aSwitch
statement to callProjectileFire
when we're usingEWFT_Projectile
for ourWeaponFireTypes
. Another piece to the puzzle!In our
ProjectileFire
function, we're using aProjectile
as a local variable...