Page 1 of 1

How to access Actor name or properties from "articulatedentity.cpp" ?

Posted: Tue Nov 27, 2018 8:41 pm
by manuk
How to access Actor name or properties from "articulatedentity.cpp" ?

i need to access the actor property "bMy_Property" in the articulatedentity.cpp function "CArticulatedEntity::Action()":

something like:

int CArticulatedEntity::Action(pe_action *_action, int bThreadSafe)
{
(...)
if (_action->type==pe_action_impulse::type_id) {
(???)m_actor(???)
bool my_var;
SmartScriptTable props;
if (m_actor.GetEntity()->GetScriptTable() && m_actor.GetEntity()->GetScriptTable()->GetValue("Properties", props)){
props->GetValue("bMy_Property", my_var);
CryLogAlways("bMy_Property:%i",my_var);
}
(...)
}
(...)
}
(...)

Re: How to access Actor name or properties from "articulatedentity.cpp" ?

Posted: Fri Jan 04, 2019 3:39 pm
by Cry-Flare
For GameSDK, you may want to do something like:

Code: Select all

#include <CryGame/IGameFramework.h>
gEnv->pGameFramework->GetClientEntity()->GetScriptTable();
or

Code: Select all

#include <CryGame/IGameFramework.h>
#include <../../GameSDK/GameDll/Player.h>
CPlayer *pPlayer = static_cast<CPlayer *>(gEnv->pGameFramework->GetClientActor());
pPlayer->GetEntity()->GetScriptTable();

Re: How to access Actor name or properties from "articulatedentity.cpp" ?

Posted: Sat Jan 12, 2019 4:09 pm
by manuk
Thank you for the answer, but the code u sent is for get the player property only.

And i need to get the properties of AIs or any actor.

how to get the "IActor" from his "IPhysicalEntity" ?

Re: How to access Actor name or properties from "articulatedentity.cpp" ?

Posted: Thu Feb 28, 2019 11:31 am
by Cry-Flare
A PhysicalEntity doesn not necessarily have an entity that is an IActor. An IAIActor is also not the same as an IActor.

You will need to do something like;

Code: Select all

#include <ActorSystem.h>
#include <CryPhysics/IPhysics.h>
#include <CryAISystem/IAIObject.h>
#include <CryAISystem/IAIActor.h>

if (pPhysEnt && pPhysEnt->GetiForeignData() == PHYS_FOREIGN_ID_ENTITY)
{
IEntity* pEnt = (IEntity*)pPhysEnt->GetForeignData(PHYS_FOREIGN_ID_ENTITY);
IActor* pActor = gEnv->pGameFramework->GetIActorSystem()->GetActor(pEnt->GetId());
IAIActor* pAIActor = pEnt->GetAI()->CastToIAIActor();
}

Re: How to access Actor name or properties from "articulatedentity.cpp" ?

Posted: Sat Mar 02, 2019 7:33 pm
by manuk
Perfect !!
this is exactly what i needed, thank you very much.