I keep getting a bad expression at the 'MeleeDamage *= ' line because I don't know how to properly grab my custom variable (that comes from a different class file).
Here's the other class from where the first class is grabbing MCharged.
User experience: I only took an intro to C# course. I did well but that was many years ago. Please explain what's wrong to me as if I were 5.
EDIT: For those wondering what I want the weapon to do, I am hoping that holding down the middle mouse will charge up the primary damage. When the primary fire does a hit, all the stored charge is dumped onto whatever is hit.
Code:
class ChargeSwordFire extends KFMeleeFire;
var() array<name> FireAnims;
function ChargeDamageCalc()
{
if ( !ChargeSword(Weapon).bNoHit )
{
[COLOR="Red"]MeleeDamage *= (1 + MCharged );[/COLOR]
MCharged = 0.0;
}
}
simulated event ModeDoFire()
{
local int AnimToPlay;
if(FireAnims.length > 0)
{
AnimToPlay = rand(FireAnims.length);
FireAnim = FireAnims[AnimToPlay];
}
Super.ModeDoFire();
}
defaultproperties
{
FireAnims(0)="fire"
FireAnims(1)="fire2"
FireAnims(2)="fire3"
FireAnims(3)="fire4"
FireAnims(4)="fire5"
FireAnims(5)="fire6"
MeleeDamage=210
ProxySize=0.150000
weaponRange=110.000000
DamagedelayMin=0.63
DamagedelayMax=0.63
hitDamageClass=Class'KFMod.DamTypeClaymoreSword'
FireRate=1.05
BotRefireRate=1.00000
MeleeHitSoundRefs(0)="KF_ClaymoreSnd.Claymore_Impact_Flesh"
HitEffectClass=class'AxeHitEffect'
//bWaitForRelease=True // Turned off in Balance Round 1 to allow Auto Fire again
WideDamageMinHitAngle=0.65
}
Here's the other class from where the first class is grabbing MCharged.
Code:
class ChargeSwordFireB extends WeaponFire;
var travel float MCharged;
var float MaxMCharged;
function ChargeUp()
{
local float StartTime;
local float EndTime;
if( bIsFiring && ( MCharged < MaxMCharged ) )
{
StartTime = Level.Timeseconds;
}
if ( !bIsFiring || ( MCharged >= MaxMCharged ))
{
EndTime = Level.Timeseconds;
}
MCharged += ( EndTime - StartTime );
// return MCharged;
}
function DrawMuzzleFlash(Canvas Canvas)
{
}
function FlashMuzzleFlash()
{
}
function StartMuzzleSmoke()
{
}
event ModeDoFire()
{
}
event ModeHoldFire()
{
}
simulated function bool AllowFire()
{
return false;
}
function ServerPlayFiring()
{
}
function PlayPreFire()
{
}
function PlayFiring()
{
}
function PlayFireEnd()
{
}
function float MaxRange()
{
return 0;
}
defaultproperties
{
MCharged=0.0
MaxMCharged=10.0
}
User experience: I only took an intro to C# course. I did well but that was many years ago. Please explain what's wrong to me as if I were 5.
EDIT: For those wondering what I want the weapon to do, I am hoping that holding down the middle mouse will charge up the primary damage. When the primary fire does a hit, all the stored charge is dumped onto whatever is hit.
Last edited: