Originally posted by GreatEmerald
View Post


if(xp.WepAffinity.WepClass != None )
//================================================== // MutUCSpeciesStats - species specific stats for players based upon UC1 code // //================================================== class MutUCSpeciesStats extends Mutator; struct StatMods { var() config float AirControl; var() config float GroundSpeed; var() config float WaterSpeed; var() config float JumpZ; var() config float HealthMax; var() config float AccelRate; var() config float WalkingPct; var() config float CrouchedPct; var() config float DodgeSpeedFactor; var() config float DodgeSpeedZ; }; // attenuate stat mods, for easy tweaking of the value of these traits. var() config StatMods statAtten; // species array of stat mods var() config StatMods stats[7]; // sjs - called game events, todo: hook this up to stuff function EventNotify(Pawn Other,Pawn Instigator,Name EventName, float value) { if( xPawn(Instigator) == None || xPawn(Other) == None ) { Super.EventNotify(Other, Instigator, EventName, value); return; } if( EventName == 'Damage' && Other!=Instigator && value > 0.0) { if( xPawn(Instigator).Species == SPECIES_Night ) // vampiric { if( Instigator.Health < Instigator.HealthMax*2.0 ) Instigator.Health = Clamp(int(Instigator.Health+value*0.5), Instigator.Health, Instigator.HealthMax*2.0); } } Super.EventNotify(Other, Instigator, EventName, value); } function RestoreSpecies(xPawn xp) { local int PrevHealth; PrevHealth = xp.Health; ModifySpecies(xp); xp.Health = PrevHealth; } // need to modify the actual class defaults due to plenty of code that uses defaults to restore values after temporary modification function ModifySpecies(xPawn xp) { local int speciesIndex; speciesIndex = xp.Species; //mutlog("Modifying species index:"$speciesIndex); xp.AirControl = class'xPawn'.default.AirControl * stats[speciesIndex].AirControl * statAtten.AirControl; xp.GroundSpeed = class'xPawn'.default.GroundSpeed * stats[speciesIndex].GroundSpeed * statAtten.GroundSpeed; xp.WaterSpeed = class'xPawn'.default.WaterSpeed * stats[speciesIndex].WaterSpeed * statAtten.WaterSpeed; xp.JumpZ = class'xPawn'.default.JumpZ * stats[speciesIndex].JumpZ * statAtten.JumpZ; xp.HealthMax = class'xPawn'.default.HealthMax * stats[speciesIndex].HealthMax * statAtten.HealthMax; xp.Health = xp.HealthMax; xp.AccelRate = class'xPawn'.default.AccelRate * stats[speciesIndex].AccelRate * statAtten.AccelRate; xp.WalkingPct = class'xPawn'.default.WalkingPct * stats[speciesIndex].WalkingPct * statAtten.WalkingPct; xp.CrouchedPct = class'xPawn'.default.CrouchedPct * stats[speciesIndex].CrouchedPct * statAtten.CrouchedPct; xp.DodgeSpeedFactor = class'xPawn'.default.DodgeSpeedFactor * stats[speciesIndex].DodgeSpeedFactor * statAtten.DodgeSpeedFactor; xp.DodgeSpeedZ = class'xPawn'.default.DodgeSpeedZ * stats[speciesIndex].DodgeSpeedZ * statAtten.DodgeSpeedZ; xp.bUsingSpeciesStats = true; } function mutlog(string s, optional name LogName) { // log(s, LogName); } function ModifyAffinityWeapon(xPawn xp, Weapon newWeapon) { local int i; local Ammunition ammo; switch(xp.WepAffinity.Type) { case WepAff_Damage: for(i=0; i<ArrayCount(newWeapon.FireMode); i++) { if( newWeapon.FireMode[i] != None ) { //mutlog("WepAff_Damage modifying:"$newWeapon.FireMode[i]); newWeapon.FireMode[i].DamageAtten = xp.WepAffinity.Value; } } break; case WepAff_Ammo: for(i=0; i<ArrayCount(newWeapon.FireMode); i++) { if ( newWeapon.FireMode[i] != None && newWeapon.FireMode[i].AmmoClass != None ) { if( i>0 && newWeapon.FireMode[i].AmmoClass == newWeapon.FireMode[i-1].AmmoClass ) continue; Ammo = Ammunition(xp.FindInventoryType(newWeapon.FireMode[i].AmmoClass)); if ( Ammo != None ) { //mutlog("WepAff_Ammo modifying:"$Ammo); Ammo.MaxAmmo *= xp.WepAffinity.Value; Ammo.InitialAmount *= xp.WepAffinity.Value; Ammo.AmmoAmount = Ammo.InitialAmount; } } } break; case WepAff_FireRate: newWeapon.FireRateAtten = xp.WepAffinity.Value; break; case WepAff_Accuracy: for(i=0; i<ArrayCount(newWeapon.FireMode); i++) { if( newWeapon.FireMode[i] != None ) { //mutlog("WepAff_FireRate modifying:"$newWeapon.FireMode[i]); //newWeapon.FireMode[i].FireRate *= xp.WepAffinity.Value; } } break; default: mutlog("Unhandled weapon affinity type!",'Error'); break; } if( newWeapon.InventoryGroup == 2 ) // assault { // hack so assault rifle affin always has a bit of damage attenutation // because ammo and firerate kindof suck with it for(i=0; i<ArrayCount(newWeapon.FireMode); i++) { if( newWeapon.FireMode[i] != None ) { //mutlog("WepAff_Damage modifying:"$newWeapon.FireMode[i]); newWeapon.FireMode[i].DamageAtten = FMax(newWeapon.FireMode[i].DamageAtten, 1.6); } } } } function ModifyPlayer(Pawn Other) { local xPawn xp; local String WeaponClassName; local class<Weapon> WeaponClass; local Weapon newWeapon; xp = xPawn(Other); if(xp == None) return; mutlog("MutSpeciesStats="$xp.class); ModifySpecies(xp); // weapon affinity if(xp.WepAffinity.WepClass != None ) { newWeapon = Weapon(Other.FindInventoryType(xp.WepAffinity.WepC lass)) ; if( newWeapon == None ) { WeaponClassName = Level.Game.BaseMutator.GetInventoryClassOverride(S tring(xp.WepAffinity.WepClass)); mutlog( "xp.WepAffinity.WepClass:" @ xp.WepAffinity.WepClass ); mutlog( "WeaponClassName:" @ WeaponClassName ); if( WeaponClassName != "" ) WeaponClass = class<Weapon>( DynamicLoadObject(WeaponClassName,class'Class') ); if( WeaponClass != None ) newWeapon = Spawn(WeaponClass,,,Other.Location); if( newWeapon != None ) newWeapon.GiveTo(Other); } if( (newWeapon != None) && (newWeapon.class == xp.WepAffinity.WepClass) ) { newWeapon.BringUp(); newWeapon.bCanThrow = false; // don't allow default weapon to be thrown out ModifyAffinityWeapon(xp,newWeapon); } } // handle per-species setup if( xp.Species == SPECIES_Egypt ) { xp.AdrenalineAtten = 1.5; } Super.ModifyPlayer(Other); } /* 0=SPECIES_Alien, 1=SPECIES_Bot, 2=SPECIES_Egypt, 3=SPECIES_Jugg, 4=SPECIES_Merc, 5=SPECIES_Night, 6=SPECIES_None */
if(xp.WepAffinity.WepClass != None )
Comment