#include "inc_x_nwncx"
#include "inc_position"

void main()
{
    object oPC = GetEnteringObject();
    //object oArea = GetArea(oPC);
    vector vPos = GetPosition(oPC);
   //float fFacing=GetFacing(oPC);
    float fAdjustment = 0.0;
    SendMessageToPC(oPC,"OnExit Triggered");//Debug purposes. Remove once working.
    vPos.z += fAdjustment;

    object oVarHoldFound; //This section collects variables from the varhold.
    int v=1;
    int nReceptionReady;

while ((oVarHoldFound = GetNearestObject(OBJECT_TYPE_PLACEABLE, OBJECT_SELF, v)) != OBJECT_INVALID)
    {
        string sVarHoldFoundName = GetName(oVarHoldFound);
        if (sVarHoldFoundName=="Varhold")
        {
            nReceptionReady = GetLocalInt(oVarHoldFound,"ReceptionReady");
            SendMessageToPC(oPC,"Variable holder found.");//Debug purposes. Remove once working.
        }
        v++;
   }

string sReceptionReady = IntToString(nReceptionReady);
SendMessageToPC(oPC,"ReceptionReady value: "+sReceptionReady);  //Debug purposes. Remove once working.

    //location lNew=Location(oArea, vPos, fFacing);
    if(nReceptionReady>0)
    {
        SetExtraZ(oPC, fAdjustment);
        SendMessageToPC(oPC,"Elevation reduction attempt made."); //Debug purposes. Remove once working.
    }
    //AssignCommand(oPC, JumpToLocation(lNew));
}
