• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Transfer buff when replacing unit

Status
Not open for further replies.
Level 2
Joined
Feb 20, 2018
Messages
15
I know this question was asked a lot, but I struggle to understand the jazz commands and order strings. Also people said to use the orderstring of the ability it was based on, but I can't do that because the ability is a Rejuvenation Potion (Non-Combat Heal/Mana Regen).
 

Attachments

  • script.PNG
    script.PNG
    89.6 KB · Views: 76
Level 13
Joined
May 10, 2009
Messages
868
Some abilities don't have an order string, but they do have their own order id (integer). If you want to know what's their order id, you need to use the GetIssuedOrderId() native along with all "A unit is issued an order XXX" events. Ex:

  • OrderId
    • 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(GetUnitName(GetTriggerUnit())+": "+I2S(GetIssuedOrderId())+" - "+OrderId2String(GetIssuedOrderId()))
upload_2018-2-20_19-10-30.png


852609 is the order id for the Healing Salve ability. So, if you want to apply that buff again, you need to use an action similar to "Unit - Issued order targeting unit" that uses order id.

The following functions
  • Unit - Order YOUR_UNIT to Attack ANOTHER_UNIT
  • Unit - Order YOUR_UNIT to Move To POINT
  • Unit - Order YOUR_UNIT to Stop
become
JASS:
    // 851983 = attack
    // 851986 = move
    // 851972 = stop
    call IssueTargetOrderById( YOUR_UNIT, 851983, ANOTHER_UNIT)
    call IssuePointOrderByIdLoc( YOUR_UNIT, 851986, POINT)
    call IssueImmediateOrderById( YOUR_UNIT, 851972 )

However, as Chaosy said, there's still the problem related to the spell duration. It would be better if you triggered your own healing spell, and set its duration via triggers when replacing units.

EDIT: Be careful with abilities within items. The GetIssuedOrderId function will return the order id that is used to execute an item in a specific slot. That is, any cast-able item in slot 1 will issue the order id: 852008. It ranges from 852008 to 852013. (slot 1 to 6)
 

Attachments

  • OrderId.w3x
    16.4 KB · Views: 27
Last edited:
Level 13
Joined
May 10, 2009
Messages
868
Doing it for every single spell would certainly be tedious. OP could, at best, use some sort of buff system, or use the Slow Aura (Tornado) ability in order to place a buff on a unit, but their object editor would turn into a mess. Though, if that applies for only one ability (Rejuvenation Potion), then it's fine.

EDIT: Merging posts.

What exactly should go on YOUR-UNIT and ANOTHER_UNIT? The name, the unit id?
You should use the Unit data type; The unit itself.
upload_2018-2-20_15-46-39.png


YOUR_UNIT is the one who will perform whatever order against ANOTHER_UNIT.
  • Events
    • Time - Elapsed game time is 0.00 seconds
  • Conditions
  • Actions
    • Set unitA = Footman 0001 <gen>
    • Set unitB = Peasant 0000 <gen>
    • Custom script: call IssueTargetOrderById(udg_unitA, 851983, udg_unitB)
    • -------- Orders Footman 0001 to attack Peasant 0000 --------
    • -------- Or it could've been --------
    • Custom script: call IssueTargetOrderById(gg_unit_hfoo_0001, 851983, gg_unit_hpea_0000)
    • -------- Which is the same as --------
    • Unit - Order unitA to Attack unitB
    • -------- except that the GUI action above uses "attack" string order --------
NOTE: The "ANOTHER_UNIT" parameter actually takes an widget. Widgets are: Destructibles, Units, Items. So, you can order a unit to attack a tree, any item or another unit.
 
Last edited:
Status
Not open for further replies.
Top