[Developed]InstantHealing Mut - 即刻回血插件 - Killing Floor 2
待拓展功能:第一针效率100%,第二针+10%,第三针+20%;对于HMT401来说三针总共效率增加130%
--
原理:
扩展Mutator,利用
function ModifyPlayer(Pawn Other)
/* called by GameInfo.RestartPlayer() change the players jumpz, etc. here */ function ModifyPlayer(Pawn Other) { if ( NextMutator != None ) NextMutator.ModifyPlayer(Other); }
对每个 调用RestartPlayer() 进行自定义
其中对于回血的代码,Pharrahnox有描述
/** Instantly heals every player by HealthRegenAmount. This will not exceed the players' max health. */ function RegenerateHealth() { local KFPlayerController KFPC; local Pawn Player; //For all player controllers foreach WorldInfo.AllControllers(class'KFPlayerController', KFPC) { //If they have possessed a pawn (a player) if(KFPC.Pawn != None) { Player = KFPC.Pawn; Player.Health = Min(Player.Health + HealthRegenAmount, Player.HealthMax); } } }
--
以下是目前实现
//============================================================================= // Healing Extend Mutator : Instant Healing // This is the first mutator containing in HealingExtend Mut // // This mutator provides you the possibility to recover Health // for a customized health regen rate // // Code And Concept By ArHShRn // http://steamcommunity.com/id/ArHShRn/ //============================================================================= class InstantHealing extends Mutator config(HealingExtend); var config float fCurrentRegenRate; var config bool bInitedConfig; function InitMutator(string Options, out string ErrorMessage) { if(!bInitedConfig) { InitBasicMutatorValues(); SaveConfig(); } super.InitMutator( Options, ErrorMessage ); } function InitBasicMutatorValues() { fCurrentRegenRate=40.0; bInitedConfig=True; } function PostBeginPlay() { SaveConfig(); //SetTimer(5, true, 'LogStatus'); super.PostBeginPlay(); } simulated function LogStatus() { `Log("[ArHShRn.Mutators] InstantHealing Mut is working fine!"); } function ModifyPlayer(Pawn Other) { local KFPawn_Human KFPH; KFPH=KFPawn_Human(Other); KFPH.HealthRegenRate=(1/fCurrentRegenRate); super.ModifyPlayer(Other); } defaultproperties { }
Specific & Simplified