Entity show/hide by using its name for 5.3 .

#1
This is about how you can hide entities by using flow graph.
I'm new in "C++" and maybe it is possible to see some wrongs in my code.
Despite this, you can use it by the permission of ALLAH.

I used this to hide local player by writing its name("dude").

Bye, ALLAH bless you.

In CryAction(For 5.3):
CRYENGINE-release\Code\CryEngine\CryAction\FlowSystem\Nodes\FlowEntityNode.cpp

Code: Select all

class CFlowHideEntityByName : public CFlowBaseNode<eNCT_Singleton>
{
public:
   CFlowHideEntityByName(SActivationInfo* pActInfo)
   {
   }

   enum EInPorts
   {
      ein_show = 0,
      ein_hide,
      ein_entityname
   };
   enum EOutPorts
   {
      eop_onshow = 0,
      eop_onhide,
      eop_entityname,
   };

   virtual void GetConfiguration(SFlowNodeConfig& config)
   {
      static const SInputPortConfig in_config[] =
      {
         InputPortConfig_Void("Show",     _HELP("Show entity by writing its name by the permission of ALLAH.")),
         InputPortConfig_Void("Hide",     _HELP("Hide entity by writing its name by the permission of ALLAH.")),
         InputPortConfig<string>("EntityName",     _HELP("Entity name that you want to show/hide.")),
         { 0 }
      };
      static const SOutputPortConfig out_config[] =
      {
         OutputPortConfig_Void("OnShow", _HELP("Triggers on show by the permission of ALLAH.")),
         OutputPortConfig_Void("OnHide", _HELP("Triggers on hide by the permission of ALLAH.")),
         OutputPortConfig<string>("OnEntityName", _HELP("Triggers on entity name by the permission of ALLAH.")),
         { 0 }
      };

      config.sDescription = _HELP("Show/hide a entity by using its name by the permission of ALLAH.");
      config.pInputPorts = in_config;
      config.pOutputPorts = out_config;
      config.SetCategory(EFLN_APPROVED);
   }


   virtual void ProcessEvent(EFlowEvent event, SActivationInfo* pActInfo)
   {
      if (event == eFE_Activate)
      {
         const string& name = GetPortString(pActInfo, ein_entityname);
         IEntity* pEntity = gEnv->pEntitySystem->FindEntityByName(name.c_str());

         if (IsPortActive(pActInfo, ein_hide))
         {
            if (pEntity)
            {
               pEntity->Hide(true);
               ActivateOutput(pActInfo, eop_onhide, false);
            };

            ActivateOutput(pActInfo, eop_entityname, pEntity ? pEntity->GetId() : EntityId(0));
         };
         if (IsPortActive(pActInfo, ein_show))
         {
            if (pEntity)
            {
               pEntity->Hide(false);
               ActivateOutput(pActInfo, eop_onshow, true);
            };

            ActivateOutput(pActInfo, eop_entityname, pEntity ? pEntity->GetId() : EntityId(0));
         }
      }
   }

   virtual void GetMemoryUsage(ICrySizer* s) const
   {
      s->Add(*this);
   }

};

REGISTER_FLOW_NODE("Entity:EntityVisibilty", CFlowHideEntityByName)

Who is online

Users browsing this forum: No registered users and 1 guest