Skip to content
View in the app

A better way to browse. Learn more.

WRobot

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to Interact with NPCs in Spirit Form?

Featured Replies

Hello everyone,

I am developing an automation script related to "World of Warcraft" in C# and have encountered some difficulties. When a character dies and enters spirit form, I need to write code to automatically control the character to click the "Release Spirit" button and talk to a specific NPC after releasing the spirit.

At present, I am not clear on how to implement this function with C# code. Specifically, I need to achieve the following steps:

  1. Detect whether the character is dead and in spirit form.
  2. Automatically click the "Release Spirit" button.
  3. Move close to the NPC.
  4. Engage in dialogue with the NPC.

I have tried some basic API calls and event listening, but I have not been successful. I don't know if anyone has experience in this area or can provide some guidance and code examples?

If someone can help me, I would be very grateful. Any suggestions, guidance, or code examples would be greatly helpful to me.

Thank you!

This is my code:(ToPositionAndIncractWithNpc unsuccessful)

robotManager.Events.FiniteStateMachineEvents.OnRunState += (engine, state, cancelable) =>
        {
            if (state is wManager.Wow.Bot.States.Resurrect && ObjectManager.Me.IsDead)
            {
                if (ObjectManager.Me.Position.DistanceTo2D(new Vector3(-14284.96f, 288.4472f, 32.33204f)) < 2) {
                    var path = new Vector3(-14283.13f, 293.2209f, 31.98451f);
                    MovementManager.Go(PathFinder.FindPath(path),false);
                    MovementManager.StopMove();
                   
                    var position = new Vector3(-14283.13f, 293.2209f, 31.98451f);
                    int npcEntryId = 1000128;
                    wManager.Wow.Bot.Tasks.GoToTask.ToPositionAndIntecractWithNpc(position, npcEntryId);
                    System.Threading.Thread.Sleep(500);
                    Usefuls.SelectGossipOption(3);
                    System.Threading.Thread.Sleep(3000);
                }
                cancelable.Cancel = true;
            }
        };

Hello,

By default, GoToTask methods don't work when the character is dead.

No tested but code should look like:

robotManager.Events.FiniteStateMachineEvents.OnRunState += (engine, state, cancelable) =>
{
    if (state is wManager.Wow.Bot.States.Resurrect && ObjectManager.Me.IsDead)
    {
        if (ObjectManager.Me.Position.DistanceTo2D(new Vector3(-14284.96f, 288.4472f, 32.33204f)) < 2) {
            var destination = new Vector3(-14283.13f, 293.2209f, 31.98451f);
            int npcEntryId = 1000128;
            var goToSuccess = wManager.Wow.Bot.Tasks.GoToTask.ToPosition(
                destination, 
                3.5f, 
                false,
                c => Conditions.InGameAndConnectedAndProductStartedNotInPause);
            
            if (goToSuccess)
            {
                var npcs = ObjectManager.GetWoWUnitByEntry(npcEntryId);
                var npcUnit = npcs.Where(n => n.IsValid).OrderBy(n => n.GetDistance).FirstOrDefault();
                if (npcUnit != null)
                {
                    Interact.InteractGameObject(npcUnit.GetBaseAddress);
                    System.Threading.Thread.Sleep(500);
                    Usefuls.SelectGossipOption(3);
                    System.Threading.Thread.Sleep(3000);
                    cancelable.Cancel = true;
                }
            }
        }
    }
};

 

  • Author
1 hour ago, Droidz said:

Hello,

By default, GoToTask methods don't work when the character is dead.

No tested but code should look like:

robotManager.Events.FiniteStateMachineEvents.OnRunState += (engine, state, cancelable) =>
{
    if (state is wManager.Wow.Bot.States.Resurrect && ObjectManager.Me.IsDead)
    {
        if (ObjectManager.Me.Position.DistanceTo2D(new Vector3(-14284.96f, 288.4472f, 32.33204f)) < 2) {
            var destination = new Vector3(-14283.13f, 293.2209f, 31.98451f);
            int npcEntryId = 1000128;
            var goToSuccess = wManager.Wow.Bot.Tasks.GoToTask.ToPosition(
                destination, 
                3.5f, 
                false,
                c => Conditions.InGameAndConnectedAndProductStartedNotInPause);
            
            if (goToSuccess)
            {
                var npcs = ObjectManager.GetWoWUnitByEntry(npcEntryId);
                var npcUnit = npcs.Where(n => n.IsValid).OrderBy(n => n.GetDistance).FirstOrDefault();
                if (npcUnit != null)
                {
                    Interact.InteractGameObject(npcUnit.GetBaseAddress);
                    System.Threading.Thread.Sleep(500);
                    Usefuls.SelectGossipOption(3);
                    System.Threading.Thread.Sleep(3000);
                    cancelable.Cancel = true;
                }
            }
        }
    }
};

 

I really appreciate your help, and I will give the code snippet you provided a try.

  • Author
1 hour ago, Droidz said:

Hello,

By default, GoToTask methods don't work when the character is dead.

No tested but code should look like:

robotManager.Events.FiniteStateMachineEvents.OnRunState += (engine, state, cancelable) =>
{
    if (state is wManager.Wow.Bot.States.Resurrect && ObjectManager.Me.IsDead)
    {
        if (ObjectManager.Me.Position.DistanceTo2D(new Vector3(-14284.96f, 288.4472f, 32.33204f)) < 2) {
            var destination = new Vector3(-14283.13f, 293.2209f, 31.98451f);
            int npcEntryId = 1000128;
            var goToSuccess = wManager.Wow.Bot.Tasks.GoToTask.ToPosition(
                destination, 
                3.5f, 
                false,
                c => Conditions.InGameAndConnectedAndProductStartedNotInPause);
            
            if (goToSuccess)
            {
                var npcs = ObjectManager.GetWoWUnitByEntry(npcEntryId);
                var npcUnit = npcs.Where(n => n.IsValid).OrderBy(n => n.GetDistance).FirstOrDefault();
                if (npcUnit != null)
                {
                    Interact.InteractGameObject(npcUnit.GetBaseAddress);
                    System.Threading.Thread.Sleep(500);
                    Usefuls.SelectGossipOption(3);
                    System.Threading.Thread.Sleep(3000);
                    cancelable.Cancel = true;
                }
            }
        }
    }
};

 

It's working now, thank you again.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.