virtual void ProcessEvent( EFlowEvent event, SActivationInfo* pActInfo ) { switch (event) { case eFE_Activate: if (IsPortActive(pActInfo, INP_TRIGGER)) { IEntity* pEntity = pActInfo->pEntity; if (pEntity) { int damage = GetPortInt(pActInfo, INP_DAMAGE); if (damage == 0) { int damageRelative = GetPortInt( pActInfo, INP_RELATIVEDAMAGE ); if (IScriptTable* pScriptTable = pEntity->GetScriptTable()) { IScriptSystem* pSS = pScriptTable->GetScriptSystem(); if (pScriptTable->GetValueType("GetMaxHealth") == svtFunction && pSS->BeginCall(pScriptTable, "GetMaxHealth")) { pSS->PushFuncParam(pScriptTable); ScriptAnyValue result; if (pSS->EndCallAny( result )) { int maxHealth = 0; if (result.CopyTo( maxHealth )) { damage = (damageRelative * maxHealth) / 100; } } } } } SendFlowHitToEntity( pEntity->GetId(), pEntity->GetId(), damage, GetPortVec3(pActInfo, INP_POSITION)); } } break; } }