码迷,mamicode.com
首页 > 其他好文 > 详细

[Developed]InstantHealing Mut - 即刻回血插件 - Killing Floor 2

时间:2017-07-09 11:01:23      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:player   cpp   pre   default   control   other   extends   mod   super   

目前待解决问题:不能与两个以上Mut并用 (如RestricPW)

 

待拓展功能:第一针效率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);
        }
    }
}

--

以下是目前实现

class InstantHealing extends Mutator;

function ModifyPlayer(Pawn Other)
{
	local KFPawn_Human KFPH;
	KFPH=KFPawn_Human(Other);
	KFPH.HealthRegenRate=KFPH.HealthToRegen;
	super.ModifyPlayer(Other);	
}

defaultproperties
{
}

  

[Developed]InstantHealing Mut - 即刻回血插件 - Killing Floor 2

标签:player   cpp   pre   default   control   other   extends   mod   super   

原文地址:http://www.cnblogs.com/ArHShRn/p/7140193.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!