public void TransitionToArea(CLRScriptBase script, ExitDirection exit)
        {
            string doorTag = "DOOR_NORTH";
            switch(exit)
            {
                case ExitDirection.North:
                    doorTag = "DOOR_NORTH";
                    break;
                case ExitDirection.East:
                    doorTag = "DOOR_EAST";
                    break;
                case ExitDirection.South:
                    doorTag = "DOOR_SOUTH";
                    break;
                case ExitDirection.West:
                    doorTag = "DOOR_WEST";
                    break;
                case ExitDirection.Up:
                    doorTag = "DOOR_UP";
                    break;
                case ExitDirection.Down:
                    doorTag = "DOOR_DOWN";
                    break;
            }
            if(script.GetIsObjectValid(script.GetLocalObject(AreaId, doorTag)) == CLRScriptBase.TRUE)
            {
                uint door = script.GetLocalObject(AreaId, doorTag);
                script.JumpToObject(door, CLRScriptBase.TRUE);
                return;
            }

            foreach(uint obj in script.GetObjectsInArea(AreaId))
            {
                if(script.GetTag(obj) == doorTag)
                {
                    script.SetLocalObject(AreaId, doorTag, obj);
                    script.JumpToObject(obj, CLRScriptBase.TRUE);
                    return;
                }
            }
            script.SendMessageToPC(script.OBJECT_SELF, "I can't find a door to jump you to.");
        }
        public static void _AddObjectToSpawnPoint(uint oWP, uint oObject, CLRScriptBase s)
        {
            int i;

            // Add this creature to the list of creatures spawned from this waypoint and
            // area.

            i = s.GetLocalInt(oWP, _SPAWNED_OBJECT_ARRAY_LENGTH);
            SetLocalArrayObject(oWP, _SPAWNED_OBJECT_ARRAY, i, oObject, s);
            s.SetLocalInt(oWP, _SPAWNED_OBJECT_ARRAY_LENGTH, i + 1);

            // Add a pointer back to the waypoint, for death reporting.
            s.SetLocalObject(oObject, _SPAWN_PARENT_WP, oWP);
        }
 public static void SetLocalArrayObject(uint oObject, string sVarName, int nIndex, uint oValue, CLRScriptBase s)
 {
     s.SetLocalObject(oObject, sVarName + s.IntToString(nIndex), oValue);
 }
        public static void Dismount(CLRScriptBase script, uint Character, uint Cloak, NWLocation Location)
        {
            string resRef = "";
            if (script.GetLocalInt(Cloak, ACR_IS_WARHORSE) == 1)
            {
                resRef = "abr_cr_an_horse_pal_";
                int nPalLevel = script.GetLevelByClass(CLRScriptBase.CLASS_TYPE_PALADIN, Character);
                if (nPalLevel >= 15) resRef += "15";
                else if (nPalLevel >= 11) resRef += "11";
                else if (nPalLevel >= 8) resRef += "8";
                else if (nPalLevel >= 5) resRef += "5";
                else resRef = "abr_cr_an_horse03";
            }
            else
            {
                switch (script.GetTag(Cloak))
                {
                    case "acr_ooc_horse01":
                        resRef = "abr_cr_an_horse01";
                        break;
                    case "acr_ooc_horse02":
                        resRef = "abr_cr_an_horse02";
                        break;
                    case "acr_ooc_horse03":
                        resRef = "abr_cr_an_horse03";
                        break;
                    default:
                        // Looks like we're not actually dismounting a horse.
                        return;
                }
            }
            
            uint Horse = script.CreateObject(CLRScriptBase.OBJECT_TYPE_CREATURE, resRef, Location, CLRScriptBase.FALSE, "");
            script.SetLocalInt(Horse, ACR_HORSE_OWNER, script.GetLocalInt(Character, ACR_CID));
            script.SetLocalInt(Horse, ACR_HORSE_ID, script.GetLocalInt(Cloak, ACR_HORSE_ID));
            int damage = script.GetCurrentHitPoints(Horse) - script.GetLocalInt(Cloak, ACR_HORSE_HP);
            if(damage > 0)
            {
                script.ApplyEffectToObject(CLRScriptBase.DURATION_TYPE_INSTANT, script.EffectDamage(damage, CLRScriptBase.DAMAGE_TYPE_MAGICAL, CLRScriptBase.DAMAGE_POWER_PLUS_TWENTY, CLRScriptBase.TRUE), Horse, 0.0f);
            }
            if (script.GetLocalInt(Cloak, ACR_IS_WARHORSE) == 1)
            {
                script.AddHenchman(Character, Horse);
                script.SetLocalInt(Horse, ACR_IS_WARHORSE, 1);
                script.SetLocalObject(Character, ACR_PAL_WARHORSE, Horse);
            }

            uint Item = GetOwnershipItemById(script, Character, script.GetLocalInt(Cloak, ACR_HORSE_ID));
            script.SetLocalObject(Item , ACR_HORSE_OBJECT, Horse);
            script.SetLocalObject(Horse, ACR_HORSE_OBJECT, Character);

            script.SetLocalString(Item, ACR_HORSE_PERS_LOC_AREA, script.GetTag(script.GetArea(Horse)));
            script.SetLocalFloat(Item, ACR_HORSE_PERS_LOC_X, script.GetPosition(Horse).x);
            script.SetLocalFloat(Item, ACR_HORSE_PERS_LOC_Y, script.GetPosition(Horse).y);
            script.SetLocalFloat(Item, ACR_HORSE_PERS_LOC_Z, script.GetPosition(Horse).z);

            script.SetPlotFlag(Cloak, CLRScriptBase.FALSE);
            script.DestroyObject(Cloak, 0.0f, CLRScriptBase.FALSE);
            isWarhorse.Remove(Character);
        }