• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

"Issue Order With no Target" and the scroll of healing

Status
Not open for further replies.
Level 7
Joined
Mar 12, 2016
Messages
49
Hello.
I have an ability that is based on the Scroll Of Healing. How to make a unit use this ability through the trigger? I can't find the right order in the list.

EDIT: Ok, I solve my problem by myself.
 
Last edited:
Level 13
Joined
May 10, 2009
Messages
868
Just in case anyone in the future runs into the same problem and doesn't know what to do. Generally, item abilities have no order string, just like in the screenshot below

upload_2018-7-9_13-50-51.png


On the other hand, all abilities have an order id, but they are not visible in the object editor. Then, all you have to do is give the item ability directly to a unit or hero, and add the following code to your map.

  • Order Ids
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • Custom script: call BJDebugMsg("|cffffcc00"+GetUnitName(GetTriggerUnit())+"|r - |cffffcc00order id:|r "+I2S(GetIssuedOrderId())+" - |cffffcc00order string:|r "+OrderId2String(GetIssuedOrderId()))
JASS:
call BJDebugMsg("|cffffcc00"+GetUnitName(GetTriggerUnit())+"|r - |cffffcc00order id:|r "+I2S(GetIssuedOrderId())+" - |cffffcc00order string:|r "+OrderId2String(GetIssuedOrderId()))
This will basically display almost any given order:
upload_2018-7-9_13-59-39.png

Do note that when I issued the order to cast "Item Area Healing", it's clear that such "order string" doesn't exist, but we now know its order id, which is 852273.

Well, you have the order id, but a function which works with it is needed, and GUI unfortunately doesn't have one. Another custom script is then required for functions which take order ids. Here's some of them:
JASS:
call IssueTargetOrderById(whichUnit, id, targetWidget)      // Targets units, items, and destructibles
call IssuePointOrderByIdLoc(whichUnit, id, whichPoint)      // Targets a point
call IssueImmediateOrderById(whichUnit, id)                 // Instant (No Target)
If you're not familiar with custom scripts, then create a simple unit variable with the following name: tmpUnit. In this case, our ability has no target. Then, we should use the "IssueImmediateOrderById" function, but before doing so, you must assign a specific unit to that tmpUnit variable, and use it in that function - It should look like this:
  • Set tmpUnit = (Triggering unit)
  • Custom script: call IssueImmediateOrderById(udg_tmpUnit, 852273)
Cool, now the unit will try to cast that specific ability.

What if you want to order a unit to do something at a specific point? It's just like how we did for the unit in the previous demonstration - you just have to create an additional variable, a tmpPoint. If you have one already for temporary points, then there's no need for another one. Here's how my actions look like:

  • Set tmpUnit = (Triggering unit)
  • Set tmpPoint = (Position of Castle 0002 <gen>)
  • Custom script: call IssuePointOrderByIdLoc(udg_tmpUnit, 851983, udg_tmpPoint)
  • Custom script: call RemoveLocation(udg_tmpPoint)
In that case, 851983 is the "attack" order, and since it's a target point function, the unit will basically attack-move to another unit's position.

NOTES:
- At first, I told you to add the ability directly to the unit / hero. Why? Because if you order a unit to use an item, the order displayed will be related to actions taken on a specific item slot, not the ability itself.

- There's another "IssuePointOrder" function which works with coordinates, but since most GUI functions only work with points/locations, I decided to not show it back there; IssuePointOrderById(whichUnit, orderId, x, y)


This was supposed to be a small comment, but I ended up exaggerating a little bit. The good thing is that you'll find most order ids from now on. I hope this was of good use to you.
 
Last edited:
Status
Not open for further replies.
Top