does the castle doctrine apply if you are not in your own house?
"Castle Doctrine" technically does not. The specific laws will vary by state, but "castle doctrine" does not apply outside your home. Typically in someone else's home you're in general self-defense and/or stand your ground rules.
what if you are a guest at someone elses house?
Laws vary by state, but generally if you're in someone else's house, even as a guest, you're in general self-defense / stand your ground territory, not protected by specific "castle doctrine"
Also if you have a small safe box type dealie can you store your firearm at a house where there are no ltc holders if you are present (sleeping) or what if you are not present?
You're getting into the terms of posession. If you are present, and you are an LTC holder, then if it's stored in a locked box and only you have access to the box, you are clearly in posession. If you leave, even if the people at the house do not have access to the lock-box, you're in a very gray area and likely opening up the homeowners to the potential for procecution if caught.
If you're staying over night, bring the lock box with you, if you leave, DON'T leave the firearm in the house, even in a locked box, if no one there can legally posess that firearm.