Jump to content
  • UseItemOn doesn't work because of Item Cooldown


    Eldunar
    • Version: All Product: Quester Type: Bug Status: Not Added

    So in this quest I have to use an item on 2 different points. It used the item on the first hotspot just fine... but when it arrived at the second hotspot the item was still on cooldown when the bot used it, so it didn't work. It ran back again to the first hotspot and used the item again succesfully, ran again to the second hotspot and it was on cooldown again, creating an infinite loop. I thought I could solve it by creating 2 entries for the same quest in the quest editor and doing them seperately but what this does is pulse the first entry succesfully, then it goes to the second step uses the item (which is still on cooldown) once and then it doesn't do anything anymore. I can solve it manually by running code in a thread but seems like this shouldn't be happening.

     



    User Feedback

    Recommended Comments

    Mlarssa

    Posted

    Split it up in two entries and add wait command between the two pulses. 

    Pulse no 1

    wait 10000 (10sec)

    Pulse no 2

    Eldunar

    Posted

    Yeah, another possibility. I just think the logic of the useItemOn questclass could be improved, maybe allow setting an item cooldown time. But ofcourse that's up to droidz, im just reporting the issue. 

    Droidz

    Posted

    Hello, to bypass this problem, before to pulse this quest add step type runcode:

            robotManager.Events.FiniteStateMachineEvents.OnRunState += (engine, state, cancelable) =>
            {
                int itemId = 1234;
                int questId = 1234;
    
                if (!wManager.Wow.Helpers.Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause)
                    return;
                if (wManager.Wow.Helpers.Conditions.IsAttackedAndCannotIgnore)
                    return;
    
                if (state.DisplayName == "Quester")
                {
                    if (wManager.Wow.Helpers.Quest.HasQuest(questId) &&
                        wManager.Wow.Helpers.Lua.LuaDoString<bool>("local start, duration, enable = GetItemCooldown("+ itemId + "); return enable;"))
                    {
                        cancelable.Cancel = true;
                    }
                }
            };

    (replace spell and item id)

    Paultimate

    Posted

    On 12/23/2016 at 4:19 AM, Droidz said:

    Hello, to bypass this problem, before to pulse this quest add step type runcode:

    
            robotManager.Events.FiniteStateMachineEvents.OnRunState += (engine, state, cancelable) =>
            {
                int itemId = 1234;
                int questId = 1234;
    
                if (!wManager.Wow.Helpers.Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause)
                    return;
                if (wManager.Wow.Helpers.Conditions.IsAttackedAndCannotIgnore)
                    return;
    
                if (state.DisplayName == "Quester")
                {
                    if (wManager.Wow.Helpers.Quest.HasQuest(questId) &&
                        wManager.Wow.Helpers.Lua.LuaDoString<bool>("local start, duration, enable = GetItemCooldown("+ itemId + "); return enable;"))
                    {
                        cancelable.Cancel = true;
                    }
                }
            };

    (replace spell and item id)

    I tried this, had the bit pickup quest, then RunCode step, then pulse to go do the quest (set 4 towers on fire, 30 sec cooldown between each use if item)

    After it picked up teh quest the log spits out 

    [D] 16:05:44.288 - [Quester] RunCode[29]: robotManager.Events.FiniteStateMachineEvents.OnRunState += (engine, state, cancelable) => (and the rest of the code you posted above)

    and then just sits there doing nothing, i waited a few min and nothing else happened. If i remove the code the bot will go and do the quest (and fail due to the item cooldown)
     

    Droidz

    Posted

    Maybe I do error with enabled https://wowpedia.fandom.com/wiki/API_GetItemCooldown, seems return true when item is ready, try:

            robotManager.Events.FiniteStateMachineEvents.OnRunState += (engine, state, cancelable) =>
            {
                int itemId = 1234;
                int questId = 1234;
    
                if (!wManager.Wow.Helpers.Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause)
                    return;
                if (wManager.Wow.Helpers.Conditions.IsAttackedAndCannotIgnore)
                    return;
    
                if (state.DisplayName == "Quester")
                {
                    if (wManager.Wow.Helpers.Quest.HasQuest(questId) &&
                        !wManager.Wow.Helpers.Lua.LuaDoString<bool>("local start, duration, enable = GetItemCooldown("+ itemId + "); return enable;"))
                    {
                        cancelable.Cancel = true;
                    }
                }
            };

    or

           robotManager.Events.FiniteStateMachineEvents.OnRunState += (engine, state, cancelable) =>
            {
                int itemId = 1234;
                int questId = 1234;
    
                if (!wManager.Wow.Helpers.Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause)
                    return;
                if (wManager.Wow.Helpers.Conditions.IsAttackedAndCannotIgnore)
                    return;
    
                if (state.DisplayName == "Quester")
                {
                    if (wManager.Wow.Helpers.Quest.HasQuest(questId) &&
                        wManager.Wow.Helpers.Lua.LuaDoString<bool>("local start, duration, enable = GetItemCooldown("+ itemId + "); return start ~= nil and start > 0 and duration ~= nil and duration > 0;"))
                    {
                        cancelable.Cancel = true;
                    }
                }
            };

     



    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...