What's new
  • Visit Rebornbuddy
  • Visit Resources
  • Visit API Documentation
  • Visit Downloads
  • Visit Portal
  • Visit Panda Profiles
  • Visit LLamamMagic

How to walk through doors?

Status
Not open for further replies.

tictoc

Member
Joined
Sep 21, 2012
Messages
380
Reaction score
5
Hi,

i can move in front of a door, but now i need to check if it is open.
If it is open i want to walk through.
If it is closed i want to open it, walk through it and close it again.

Found this in the questing sources:
Code:
               MoveToAndWait(19968.09, 7681.23, 183.59);
                var door = host.getNearestDoodad(11163);
                if (door != null && host.dist(door) < 5)
                {
                    host.UseDoodadSkill(16828, door, true);
                    Thread.Sleep(3000);
                }
                MoveToAndWait(19963.30, 7681.01, 183.59);
                MoveToAndWait(19959.86, 7683.67, 183.59);
                MoveToAndWait(19962.16, 7678.50, 183.59);
                MoveToAndWait(19958.60, 7681.58, 183.59);
                MoveToAndWait(19964.02, 7681.16, 183.59);

                door = host.getNearestDoodad(11163);
                if (door != null && host.dist(door) < 5)
                {
                    host.UseDoodadSkill(16828, door, true);
                    Thread.Sleep(3000);
                }
                MoveToAndWait(19969.76, 7680.93, 183.59);

But i cannot get it to work in the Plugin Editor. How to code that?


PS: I have already asked in the Archebuddy Support Forum, but probably it fits better here. As i cannot move/remove the other Thread, maybe somebody else can.
 
Why? Errors during compilation or what?

I tried to adapt this a bit (no host.XXX) and it compiles, but the door of the house is kept closed:

Code:
           MoveTo(...,...,...);
           Thread.Sleep(2000);
           
           var door = getNearestDoodad(11163);   
           if (door != null && me.dist(door) < 5)
                {
                    Log("Door found!");
                    UseDoodadSkill(16828, door, true);
                    Thread.Sleep(3000);
                }
           MoveTo(...,...,...);

I do not get the log "Door found!". So probably either the door is not detected or the distance check does not work.

BTW, is there a list with explanations available for the id-numbers used here? (11163/16828)
 
BTW, is there a list with explanations available for the id-numbers used here? (11163/16828)
Your door can have another ids. this ids - phaseId of doodad (door).
 
I tried to adapt this a bit (no host.XXX) and it compiles, but the door of the house is kept closed:

Code:
           MoveTo(...,...,...);
           Thread.Sleep(2000);
           
           var door = getNearestDoodad(11163);   
           if (door != null && me.dist(door) < 5)
                {
                    Log("Door found!");
                    UseDoodadSkill(16828, door, true);
                    Thread.Sleep(3000);
                }
           MoveTo(...,...,...);

I do not get the log "Door found!". So probably either the door is not detected or the distance check does not work.

BTW, is there a list with explanations available for the id-numbers used here? (11163/16828)


There is an easier way to do this, IMO. may not be the best way but it works.
However from what i can see there is not a way to check the state of the door directly. If there is a way to check the doors state I would like an example.

If you are pathing to the door then the following may work
var door1 = getNearestDoodad ("Door");
ComeTo (door1,1,1);
UseDoodadSkill ("Open or close.", door1, false, 2);


Also consider using the GPS and mapping out waypoints then naming them, you can move to the named locations, also easier IMO than hardcoding way points.
 
Last edited:
var door1 = getNearestDoodad ("Door");
ComeTo (door1,1,1);
UseDoodadSkill ("Open or close.", door1, false, 2);

This works fine, thanks a lot!

Now we do only need to find an example how to check the state of the door.

Or do you also have some code how to do this check "in-directly"?
 
If you are using Gps then GpsPoint.dist may be a good way to validate location, to see if you made it to the point you set opposite the door.
I haven't implemented it though.
 
Now we do only need to find an example how to check the state of the door.

@Out: Could you please confirm that there is currently no way to check that or please explain how it can be done?
 
@Out: Could you please confirm that there is currently no way to check that or please explain how it can be done?
Example from questing dont clean this?
Closed door = phaseId = XXX
Opened door = another phaseId = YYY
 
Closed door = phaseId = XXX
Opened door = another phaseId = YYY

Got it working, thanks. I got the phaseId with testing the open and the closed door via:
Code:
var door = getNearestDoodad("Door");    
Log(string.Format("Name: {0} - ID: {1}", door.name, door.phaseId));

Will this Id's be stable for a players house, even with server restarts?
 
Will this Id's be stable for a players house, even with server restarts?
phaseId - its like mob ID. Always same for same object
 
I have found 4 different phaseId's for a door from a players house:

  • Id for door is open
  • Id for door is opening (in transition)
  • Id for door is closed
  • Id for door is closing (in transition)

If somebody wants to check this, then go to the door, play around with it and run

Code:
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using ArcheBuddy.Bot.Classes;

namespace DefaultNameSpace{
   public class DefaultClass : Core
   {
       public static string GetPluginAuthor()
       {
           return "tictoc";
       }

       public static string GetPluginVersion()
       {
           return "1.0.0.0";
       }

       public static string GetPluginDescription()
       {
           return "CheckDoor - Show phaseId's of doors";
       }      
       
        //Call on plugin start
       public void PluginRun()
       {  
           Log("+++ Plugin Start +++");   
           while (true)
           {
                var door = getNearestDoodad("Door");              
                Log(string.Format("Current phaseId of nearest door: {0}", door.phaseId));   
                Thread.Sleep(400);
           }
       }
       //Call on plugin stop
       public void PluginStop()
       {
       }
   }
}

And you can test this in your plugin with a routine like:

Code:
       // Check if door is already open (true = open, false = closed) 
       // Needs the phaseId of the open door in doorPhaseId
       public bool CheckDoor(uint doorPhaseId)
       {  
           // Find the nearest door           
           var door = getNearestDoodad("Door");              

           // Check if door was found and the door is open 
           if (door != null && door.phaseId == doorPhaseId)
           {   
              return true;  
           }
           return false;
       }
 
Status
Not open for further replies.
Back
Top