Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

IssueImmediateOrderById not working? (Lua)

Discussion in 'World Editor Help Zone' started by Uncle, Oct 19, 2020.

  1. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    2,393
    Resources:
    0
    Resources:
    0
    Code (Lua):

    function Dummy_Instant_AoE(p, abil)
        abil = FourCC(abil)
        local u = p.Dummy
        if p.DummyAbility ~= nil then
            UnitRemoveAbility(u, p.DummyAbility)
        end
        SetUnitPosition(u, GetUnitX(p.Hero), GetUnitY(p.Hero))
        p.DummyAbility = abil
        UnitAddAbility(u, abil)
        IssueImmediateOrderById(u, abil)
        print("works")
    end
     
    I call this function to move a Dummy unit to the position of my Hero and then order it to cast an AoE ability (Thunder Clap in this case).

    The print message appears so it's not like I'm crashing the thread. Also, I can manually cast the ability on my Dummy so it's not something simple like that.

    Which leaves this as the only possible issue: IssueImmediateOrderById(u, abil)

    abil is set to: "A001"
    I'm 100% positive this is the correct id.

    And if I don't set abil = FourCC(abil) then it crashes when I reference abil so that's not the issue either.

    Any ideas?
     
    Last edited: Oct 19, 2020
  2. biridius

    biridius

    Joined:
    Apr 3, 2018
    Messages:
    197
    Resources:
    4
    Maps:
    4
    Resources:
    4
    Try using OrderId("thunderclap") instead of 'A001' when issuing the order.
    The order ids are different from ability ids, and can be shared across multiple similar abilities.

    All abilities created from thunder clap will have OrderId("thunderclap") = 852096, regardless of what their ability id is
     
  3. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    2,393
    Resources:
    0
    Resources:
    0
    Yeah, I'm using that as the alternative for now, I was just hoping I could skip a step.

    It's just that from what I gathered from other threads it should be possible to order a unit to use an ability referencing it's ability id. But maybe the info was outdated/incorrect.
     
  4. biridius

    biridius

    Joined:
    Apr 3, 2018
    Messages:
    197
    Resources:
    4
    Maps:
    4
    Resources:
    4
    I'm not aware of any such natives being on 1.26, so if there is such a way it has to be some new jass function that gets orderid from abilityid, so you'd have to look into the list of all new functions from later updates to find it.

    I don't see any such function in the new native list from WarCraft III: The Frozen Throne - Patch 1.29.0 - Liquipedia Warcraft Wiki , they all seem to operate with tooltips and icon positions only.

    You could make a database on arrays/hashtable and manually put all orders for all your abilities in there and then retrieve them when using your dummycaster function
     
    Last edited: Oct 19, 2020