I want to access this specific code inside a plugin code
Character.GetAtScreenXY(xx, yy)==cEgo
I've looked it up and I'm clueless on how to do that
int (*sfGetAtXY)(int,int);
sfGetAtXY = ((int(*)(int,int)) engine->GetScriptFunctionAddress("GetCharacterAt"));
int getID=sfGetAtXY(xx,yy);
Nice to know! Thanks for posting your solution. (lol at this topic being in Beginners'.)
"GetCharacterAt" is a deprecated function that may be removed from future versions of the engine.
"Character::GetAtScreenXY" returns a pointer to character object which you may use to access its properties either
1) directly by casting it to AGSCharacter from plugin api and reading its variables (not recommended because it's honestly unsafe and will be deprecated in ags4 also)
2) by using property getter "Character::get_ID" and passing previously received character pointer there.
There's another thing, GetScriptFunctionAddress is in truth "GetSymbolAddress", meaning you can get not only functions. Thus you may do engine->GetScriptFunctionAddress("player"), because "player" is a builtin global variable, and get player character's pointer, and then compare directly to the one you received from "Character::GetAtScreenXY".
If you already know player's ID somehow you may get player's pointer also by engine->GetCharacter(n).