Jump to content

Recommended Posts

Hello,

        bool added = false;
        robotManager.FiniteStateMachine.State myState = null; // ...
        robotManager.Events.FiniteStateMachineEvents.OnAddState += delegate (robotManager.FiniteStateMachine.Engine engine, robotManager.FiniteStateMachine.State state, System.ComponentModel.CancelEventArgs cancelable)
        {
            if (added)
                return;
            if (state.DisplayName == "Quester")
            {
                added = true;
                state.NextStates.Add(myState);
                //engine.AddState(myState);
                //state.BeforeStates.Add(myState);
            }
        };

 

Link to comment
https://wrobot.eu/forums/topic/8959-botstates/#findComment-41691
Share on other sites

Can you add any working example?
My code either produces errors or the state does nothing.

Can you also add functions to the bot?

Me.SubZoneId == 111

ItemsManager.UseItem() - by WoWItem, not entry

Item.UseContainerItem

WoWGameObject.InteractDistance
WoWGameObject.IsGoodInteractDistance

Me.GetAllAuras().Any(a => (a.Spell.Mechanic == WoWSpellMechanic.Stunned || a.Spell.Mechanic == WoWSpellMechanic.Fleeing || a.Spell.Mechanic == 
WoWSpellMechanic.Asleep || a.Spell.Mechanic == WoWSpellMechanic.Charmed) && a.IsActive && a.TimeLeft.TotalSeconds >= 2))

and fix this

wManager.Wow.Helpers.Bag.PickupContainerItem - just does not work.

wManager.Wow.Bot.Tasks.GoToTask.ToPositionAndIntecractWith(WoWGameObject) - goes to the object and does not interact, with npc works fine.

 

Link to comment
https://wrobot.eu/forums/topic/8959-botstates/#findComment-41748
Share on other sites

You can try 

        bool added = false;
        robotManager.FiniteStateMachine.State myState = null; // ...
        robotManager.Events.FiniteStateMachineEvents.OnBeforeCheckIfNeedToRunState += delegate (robotManager.FiniteStateMachine.Engine engine, robotManager.FiniteStateMachine.State state, System.ComponentModel.CancelEventArgs cancelable)
        {
            if (added)
                return;
            if (state.DisplayName == "Quester")
            {
                added = true;
                state.NextStates.Add(myState);
                //engine.AddState(myState);
                //state.BeforeStates.Add(myState);
            }
        };

(replace "null" line 2 by your state instance)

Link to comment
https://wrobot.eu/forums/topic/8959-botstates/#findComment-41884
Share on other sites

I already tried it.

My state, after adding, the text should be spammed. But there is nothing

public class TestState : robotManager.FiniteStateMachine.State
{
    public override string DisplayName
    {
        get { return "TestState"; }
    }

    public override int Priority
    {
        get { return priority; }
        set { priority = value; }
    }
    private int priority;

    public override bool NeedToRun
    {
        get
        {
            if (!Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause || Conditions.IsAttackedAndCannotIgnore)
               return false;

               return true;
        }
    }

    public override List<robotManager.FiniteStateMachine.State> NextStates
    {
        get { return new List<robotManager.FiniteStateMachine.State>(); }
    }

    public override List<robotManager.FiniteStateMachine.State> BeforeStates
    {
        get { return new List<robotManager.FiniteStateMachine.State>(); }
    }
      
    public override void Run()
    {

        Logging.Write("TestState", Logging.LogType.Normal, System.Drawing.Color.BlueViolet); 
        
    }
}

 

Link to comment
https://wrobot.eu/forums/topic/8959-botstates/#findComment-41888
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...