SDK Question Checking if focus is on my spacecraft.

asbjos

tuanibrO
Addon Developer
Joined
Jun 22, 2011
Messages
698
Reaction score
269
Points
78
Location
This place called "home".
Hi. I've made a space probe with failure simulation. If the dynamic pressure exeeds a given value, the HUD dissapears and the user gets an error message. The problem is when I launch the probe with a launcher using Payload Manager or am focused on another spacecraft while I deorbit my probe.

The probe gets destroyed, but the effect (HUD dissapearing and error message) occurs for all vessels.

How do I get the error to only show up when I'm focused on my probe?
 
In a callback function, something like :

Code:
if (GetHandle)
{
do_the_stuff;
}
 
Better "if(oapiGetFocusVessel() == this->GetHandle())"

But that only makes sense if you really only want to do something for a focussed probe.
 
Thank you, it works!

But Urwumpe, I guess that you mean oapiGetFocusObject(). oapiGetFocusVessel doesn't exist in the API_Reference.pdf.
 
this is what I use in all my AAPO vessels...

Code:
if (oapiGetFocusInterface () == this)
{
   //...do stuff
}
 
Back
Top