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

#1
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);
}
(...)
}
(...)
}
(...)
ManuKor
www.HeathenGame.com
Image

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

#2
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();
Uniflare
CRYENGINE Technical Community Manager
Here to help the community and social channels grow and thrive.

My personal belongings;
Beginner Guides | My GitHub | Splash Plugin

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

#4
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();
}
Uniflare
CRYENGINE Technical Community Manager
Here to help the community and social channels grow and thrive.

My personal belongings;
Beginner Guides | My GitHub | Splash Plugin

Who is online

Users browsing this forum: No registered users and 4 guests

cron