2017-10-20 02:00:49 +00:00
|
|
|
Class Ext_T_ZEDHelper extends Info
|
|
|
|
transient
|
|
|
|
DependsOn(Ext_TraitZED_Summon)
|
|
|
|
config(ServerExt);
|
|
|
|
|
|
|
|
var config array<FZEDTypes> ZedTypes; // Dummy hack, not really config but merely just for being able to set class on defaults.
|
|
|
|
|
|
|
|
var() float FriendlyScalar;
|
|
|
|
var Pawn PawnOwner;
|
|
|
|
var byte CurLevel,RespawnHelperTime,NoLiveCounter;
|
|
|
|
var KFPawn_Monster LiveHelper;
|
|
|
|
var class<KFPawn_Monster> PrevMonster;
|
|
|
|
var float PrevMonsterHP;
|
|
|
|
|
|
|
|
var float HPScale,DamageScale;
|
|
|
|
var int OldKillsValue;
|
|
|
|
var bool bNeedsKillZed,bIsExtra;
|
|
|
|
|
|
|
|
function PostBeginPlay()
|
|
|
|
{
|
|
|
|
PawnOwner = Pawn(Owner);
|
|
|
|
bNeedsKillZed = true;
|
2020-11-28 20:04:55 +00:00
|
|
|
if(PawnOwner==None)
|
2017-10-20 02:00:49 +00:00
|
|
|
Destroy();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
OldKillsValue = PawnOwner.PlayerReplicationInfo.Kills;
|
|
|
|
SetTimer(1+(FRand()*0.1),true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function Timer()
|
|
|
|
{
|
2020-11-28 20:04:55 +00:00
|
|
|
if(PawnOwner==None || PawnOwner.Health<=0 || PawnOwner.PlayerReplicationInfo==None)
|
2017-10-20 02:00:49 +00:00
|
|
|
Destroy();
|
2020-11-28 20:04:55 +00:00
|
|
|
else if(bNeedsKillZed)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:04:55 +00:00
|
|
|
if(RespawnHelperTime>1)
|
2017-10-20 02:00:49 +00:00
|
|
|
--RespawnHelperTime;
|
2020-11-28 20:04:55 +00:00
|
|
|
if(OldKillsValue==PawnOwner.PlayerReplicationInfo.Kills)
|
2017-10-20 02:00:49 +00:00
|
|
|
return;
|
|
|
|
bNeedsKillZed = false;
|
|
|
|
}
|
2020-11-28 20:04:55 +00:00
|
|
|
else if(RespawnHelperTime>0)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:04:55 +00:00
|
|
|
if(--RespawnHelperTime==0)
|
2017-10-20 02:00:49 +00:00
|
|
|
SpawnHelper();
|
|
|
|
}
|
2020-11-28 20:04:55 +00:00
|
|
|
else if(LiveHelper==None || LiveHelper.Health<=0)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
OldKillsValue = PawnOwner.PlayerReplicationInfo.Kills;
|
|
|
|
bNeedsKillZed = true;
|
|
|
|
RespawnHelperTime = 60;
|
|
|
|
}
|
2020-11-28 20:04:55 +00:00
|
|
|
else if(!HasLiveZeds())
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:04:55 +00:00
|
|
|
if(NoLiveCounter==0)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
PrevMonster = LiveHelper.Class;
|
|
|
|
PrevMonsterHP = (float(LiveHelper.Health) / LiveHelper.HealthMax);
|
|
|
|
LiveHelper.Died(None,class'KFDT_Healing',vect(0,0,0));
|
|
|
|
RespawnHelperTime = 5;
|
|
|
|
}
|
|
|
|
else --NoLiveCounter;
|
|
|
|
}
|
|
|
|
else NoLiveCounter = 5;
|
|
|
|
}
|
|
|
|
function Destroyed()
|
|
|
|
{
|
2020-11-28 20:04:55 +00:00
|
|
|
if(LiveHelper!=None && LiveHelper.Health>0)
|
2017-10-20 02:00:49 +00:00
|
|
|
LiveHelper.Died(None,class'DmgType_Suicided',vect(0,0,0));
|
|
|
|
}
|
|
|
|
final function bool HasLiveZeds()
|
|
|
|
{
|
|
|
|
local KFPawn_Monster M;
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
if(KFGameReplicationInfo(WorldInfo.GRI).WaveNum>=KFGameReplicationInfo(WorldInfo.GRI).WaveMax) // No pets on possible bonus waves.
|
2017-10-20 02:00:49 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
foreach WorldInfo.AllPawns(Class'KFPawn_Monster',M)
|
2020-11-28 20:04:55 +00:00
|
|
|
if(M.Health>0 && M.GetTeamNum()!=0)
|
2017-10-20 02:00:49 +00:00
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
final function SpawnHelper()
|
|
|
|
{
|
|
|
|
local class<KFPawn_Monster> MC;
|
|
|
|
local byte i;
|
|
|
|
local vector V;
|
|
|
|
local rotator R;
|
|
|
|
local Controller C;
|
|
|
|
local Ext_T_MonsterPRI PRI;
|
|
|
|
local AkBaseSoundObject TempSound;
|
|
|
|
local bool bFinalWave;
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
if(PawnOwner.PlayerReplicationInfo==None || !HasLiveZeds())
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
RespawnHelperTime = 3;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
NoLiveCounter = 5;
|
|
|
|
bFinalWave = KFGameReplicationInfo(WorldInfo.GRI).IsFinalWave();
|
2020-11-28 20:04:55 +00:00
|
|
|
if(bFinalWave && Class<KFPawn_MonsterBoss>(PrevMonster)!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
PrevMonster = None;
|
|
|
|
MC = (PrevMonster!=None ? PrevMonster : PickRandomMonster(CurLevel,bFinalWave));
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
if(MC!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
R.Yaw = Rand(65536);
|
2020-11-28 20:04:55 +00:00
|
|
|
if(MC.Default.SoundGroupArch!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
// Make no entrance roam (for FP's and Scrakes).
|
|
|
|
TempSound = MC.Default.SoundGroupArch.EntranceSound;
|
|
|
|
MC.Default.SoundGroupArch.EntranceSound = None;
|
|
|
|
}
|
2020-11-28 20:04:55 +00:00
|
|
|
for(i=0; i<40; ++i)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
V = PawnOwner.Location;
|
|
|
|
V.X += (FRand()*300.f-150.f);
|
|
|
|
V.Y += (FRand()*300.f-150.f);
|
2020-11-28 20:04:55 +00:00
|
|
|
if(!PawnOwner.FastTrace(V,PawnOwner.Location))
|
2017-10-20 02:00:49 +00:00
|
|
|
continue;
|
|
|
|
LiveHelper = Spawn(MC,,,V,R);
|
2020-11-28 20:04:55 +00:00
|
|
|
if(LiveHelper!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
break;
|
|
|
|
}
|
2020-11-28 20:04:55 +00:00
|
|
|
if(MC.Default.SoundGroupArch!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
MC.Default.SoundGroupArch.EntranceSound = TempSound;
|
|
|
|
}
|
2020-11-28 20:04:55 +00:00
|
|
|
if(LiveHelper==None)
|
2017-10-20 02:00:49 +00:00
|
|
|
RespawnHelperTime = 2;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Downscale.
|
|
|
|
LiveHelper.SetDrawScale(LiveHelper.DrawScale*FriendlyScalar);
|
|
|
|
LiveHelper.SetCollisionSize(LiveHelper.GetCollisionRadius()*FriendlyScalar,LiveHelper.GetCollisionHeight()*FriendlyScalar);
|
|
|
|
|
|
|
|
// Setup AI
|
|
|
|
C = Spawn(LiveHelper.ControllerClass);
|
2020-11-28 20:04:55 +00:00
|
|
|
if(KFAIController(C)!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
KFAIController(C).bCanTeleportCloser = false;
|
|
|
|
KFAIController(C).DefaultCommandClass = class'Ext_AICommandBasePet';
|
|
|
|
KFAIController(C).StuckCheckInterval = 100000.f; // ~27 hours
|
|
|
|
KFAIController(C).LastStuckCheckTime = WorldInfo.TimeSeconds;
|
|
|
|
}
|
|
|
|
LiveHelper.SpecialMoveHandler.SpecialMoveClasses[SM_Taunt] = class'Ext_AINoTaunt';
|
|
|
|
C.Possess(LiveHelper,false);
|
|
|
|
|
|
|
|
// Set HP.
|
|
|
|
LiveHelper.HealthMax = Clamp(LiveHelper.Default.Health,180,900)*HPScale;
|
|
|
|
LiveHelper.Health = LiveHelper.HealthMax;
|
|
|
|
LiveHelper.DamageScaling = DamageScale;
|
|
|
|
LiveHelper.SetWeakGrabCoolDown(28800.f); // Never get grabbed (for 80 hours).
|
|
|
|
LiveHelper.bWeakZedGrab = true;
|
|
|
|
LiveHelper.bCanGrabAttack = false;
|
|
|
|
|
|
|
|
// Scale by previous zed HP.
|
2020-11-28 20:04:55 +00:00
|
|
|
if(PrevMonster!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
LiveHelper.Health *= PrevMonsterHP;
|
|
|
|
PrevMonster = None;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Setup PRI.
|
2020-11-28 20:04:55 +00:00
|
|
|
if(C.PlayerReplicationInfo!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
C.PlayerReplicationInfo.Destroy();
|
|
|
|
PRI = Spawn(class'Ext_T_MonsterPRI',LiveHelper);
|
|
|
|
LiveHelper.PlayerReplicationInfo = PRI;
|
|
|
|
C.PlayerReplicationInfo = PRI;
|
|
|
|
PRI.PawnOwner = LiveHelper;
|
|
|
|
PRI.HealthMax = LiveHelper.HealthMax;
|
|
|
|
PRI.MonsterName = Class'KFExtendedHUD'.Static.GetNameOf(MC);
|
|
|
|
PRI.OwnerPRI = PawnOwner.PlayerReplicationInfo;
|
|
|
|
PRI.MonsterType = MC;
|
|
|
|
PRI.PlayerName = PawnOwner.PlayerReplicationInfo.PlayerName$"'s "$PRI.MonsterName;
|
|
|
|
PRI.OwnerController = PawnOwner.Controller;
|
2020-11-28 20:04:55 +00:00
|
|
|
if(PawnOwner.PlayerReplicationInfo.Team!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
PawnOwner.PlayerReplicationInfo.Team.AddToTeam(C);
|
|
|
|
PRI.Timer();
|
2020-11-28 20:04:55 +00:00
|
|
|
if(WorldInfo.NetMode!=NM_DedicatedServer)
|
2017-10-20 02:00:49 +00:00
|
|
|
PRI.NotifyOwner();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
final function SetDamageScale(float Sc)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
DamageScale = Default.DamageScale*Sc;
|
2020-11-28 20:04:55 +00:00
|
|
|
if(LiveHelper!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
LiveHelper.DamageScaling = DamageScale;
|
|
|
|
}
|
2020-11-28 20:04:55 +00:00
|
|
|
final function SetHealthScale(float Sc)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
HPScale = Default.HPScale*Sc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static final function LoadMonsterList()
|
|
|
|
{
|
|
|
|
local int i,j;
|
|
|
|
local array<string> SA;
|
|
|
|
local class<KFPawn_Monster> C;
|
|
|
|
|
|
|
|
Default.ZedTypes.Length = class'Ext_TraitZED_Summon'.Default.ZedTypes.Length;
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
for(i=0; i<Default.ZedTypes.Length; ++i)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
SA.Length = 0;
|
|
|
|
ParseStringIntoArray(class'Ext_TraitZED_Summon'.Default.ZedTypes[i],SA,",",true);
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
for(j=0; j<SA.Length; ++j)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
C = class<KFPawn_Monster>(DynamicLoadObject(SA[j],Class'Class'));
|
2020-11-28 20:04:55 +00:00
|
|
|
if(C==None)
|
2017-10-20 02:00:49 +00:00
|
|
|
continue;
|
|
|
|
Default.ZedTypes[i].Zeds[Default.ZedTypes[i].Zeds.Length] = C;
|
|
|
|
}
|
2020-11-28 20:04:55 +00:00
|
|
|
if(Default.ZedTypes[i].Zeds.Length==0)
|
2017-10-20 02:00:49 +00:00
|
|
|
Default.ZedTypes[i].Zeds[Default.ZedTypes[i].Zeds.Length] = Class'KFPawn_ZedClot_Alpha';
|
|
|
|
}
|
|
|
|
}
|
2020-11-28 20:04:55 +00:00
|
|
|
static final function class<KFPawn_Monster> PickRandomMonster(byte Level, bool bNotBoss)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
local byte i;
|
|
|
|
local class<KFPawn_Monster> Res;
|
|
|
|
|
|
|
|
Level = Min(Default.ZedTypes.Length-1,Level);
|
2020-11-28 20:04:55 +00:00
|
|
|
for(i=0; i<5; ++i)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
Res = Default.ZedTypes[Level].Zeds[Rand(Default.ZedTypes[Level].Zeds.Length)];
|
2020-11-28 20:04:55 +00:00
|
|
|
if(!bNotBoss || class<KFPawn_MonsterBoss>(Res)==None)
|
2017-10-20 02:00:49 +00:00
|
|
|
break;
|
|
|
|
}
|
2020-11-28 20:04:55 +00:00
|
|
|
if(bNotBoss && class<KFPawn_MonsterBoss>(Res)!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
Res = Class'KFPawn_ZedFleshpound';
|
|
|
|
return Res;
|
|
|
|
}
|
|
|
|
|
|
|
|
defaultproperties
|
|
|
|
{
|
|
|
|
RespawnHelperTime=1
|
|
|
|
HPScale=0.5
|
|
|
|
DamageScale=2
|
|
|
|
FriendlyScalar=0.65
|
2017-10-22 21:24:58 +00:00
|
|
|
}
|