- Newest
- Most votes
- Most comments
I expose this function to Lua and it is working. I got this from the StarterGame
static void LoadNextLevel(AZStd::string level)
{
CCryAction* pCryAction = static_cast<CCryAction*>(gEnv->pGame->GetIGameFramework());
pCryAction->ScheduleEndLevel(level.c_str(), true);
}
It seems that the way to get the CryAction inside the gem is through the gEnv. I do not know if it is correct, but it is working ;-)
I dont think you are able to link CryAction into LyShine. I think the reason for this, since i've got something similar with CryMovie, is that it's building everything in separate modules that are dynamically loaded so there is no ".lib" file to link against to allow access to another module's code.
I understand your point, but I see other gems using cryaction (I guess). How is that possible? That is what I need. Any ideas?
Hi @REDACTEDUSER
It looks like you are trying to reproduce what the CFlowNode_EndLevel FlowGraph node does. It uses a method (ScheduleEndLevel) that is not exposed via an abstract interface. The FlowGraph system can access it because the flow node code is part of CryAction. It sounds like you have a workaround to make it work though (using a cast).
Another alternative would be to do what the console command to load a level does. It uses the LoadGame method on CryAction that is exposed through IGameFramework. So you can call it like this:
if (gEnv->pGame->GetIGameFramework())
{
gEnv->pGame->GetIGameFramework()->LoadGame("levelname");
}
Alternatively, there is also a static function you can use to avoid the cast in your example:
CCryAction::GetCryAction()->ScheduleEndLevel(level.c_str(),true);
Rob
This post is closed: Adding new answers, comments, and votes is disabled.
Relevant content
- Accepted Answerasked 7 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 3 years ago