关于备忘录:
这里主要是自己记录一些CE3(Cryengine3)的常用方法,包括代码编写以及API功能,如果有什么问题感谢指出,这是我的邮箱albstein2@gmail.com
在使用CE3时遇到点问题,当从背后靠近敌人时,我们使用近战攻击时敌人会直接死亡,但是我们在之后却无法移动,
断点调试后,发现在这种情况下实际是触发了引擎中自带的暗杀系统,而在这一部分中我们并没有提供相应的暗杀动作在其中,这就会触发这个bug(当然具体的问题我还没有定位到)
下面为有同样问题的开发者们提供一个可行的解决办法,就是直接把调用暗杀的部分去掉(既然没有动画,那我们就不用它了)
下面是我通过调试找到的代码段:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| bool CPlayerInput::OnActionSpecial(EntityId entityId, const ActionId& actionId, int activationMode, float value) { if (CallTopCancelHandler()) { return false; } const SInteractionInfo& interactionInfo = m_pPlayer->GetCurrentInteractionInfo(); if (activationMode == eAAM_OnPress) { if (interactionInfo.interactionType == eInteraction_Stealthkill) { m_pPlayer->AttemptStealthKill(interactionInfo.interactiveEntityId); } else if (interactionInfo.interactionType == eInteraction_LargeObject) { if(!m_pPlayer->GetLargeObjectInteraction().IsBusy()) { m_pPlayer->EnterLargeObjectInteraction(interactionInfo.interactiveEntityId); } } } return false; }
|
代码可以通过搜索的方法简单的定位到,之后我们只需将调用暗杀的哪行注释掉就行了
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| bool CPlayerInput::OnActionSpecial(EntityId entityId, const ActionId& actionId, int activationMode, float value) { if (CallTopCancelHandler()) { return false; } const SInteractionInfo& interactionInfo = m_pPlayer->GetCurrentInteractionInfo(); if (activationMode == eAAM_OnPress) { if (interactionInfo.interactionType == eInteraction_Stealthkill) { } else if (interactionInfo.interactionType == eInteraction_LargeObject) { if(!m_pPlayer->GetLargeObjectInteraction().IsBusy()) { m_pPlayer->EnterLargeObjectInteraction(interactionInfo.interactiveEntityId); } } } return false; }
|
好的,这样当我们从敌人背后悄悄靠近的时候就可以用近战愉快的揍他了