• 🏆 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!

[Spell] No Order String - how to use IssueImmediateOrderById?

Status
Not open for further replies.
Level 12
Joined
May 16, 2020
Messages
660
Hi guys,

I'm using the spell "Rain of Chaos" within a trigger. This ability doesn't have an Order String by default.

Apparently such abilities have a problem with issuing an order via trigger, because regardless of what Order String you add, the unit is going to ignore it.
[Trigger] - Changing "Order String - Use/Turn on" that is "None" by default

However, according to this thread it should be possible to force a unit to use the spell with IssueImmediateOrderById

I found the order ID of the spell by using Custom script: call BJDebugMsg(I2S(GetIssuedOrderId()))

The Order ID is 852237. I then tried to integrate this into the spell, but it doesn't work. The trigger still doesn't cause the last created unit to use the ability...

  • Mortal Strike Active
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mortal Strike
    • Actions
      • Unit - Create 1 Universal Dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing (Position of (Triggering unit))
      • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Mortal Strike (Summon) to (Last created unit)
      • Custom script: call IssueImmediateOrderById ( GetLastCreatedUnit() , 852237)
      • Unit - Kill (Triggering unit)

Can anyone help me please?
 
Level 12
Joined
May 16, 2020
Messages
660
Since rain of chaos requires a target you must use IssuePointOrderById and specify the target x and y coordinate.
Or use IssuePointOrderByIdLoc and specify a location.

Thanks - for the location command: What is the correct "name" for "triggering unit"? Sorry I don't really know JASS, I'm just trying out different things until it works...

I tried:

call IssuePointOrderByIdLoc(bj_lastCreatedUnit,852237, xxxxxx)

How do I specify the "location of triggering unit"?
 
Last edited:
Level 9
Joined
Mar 26, 2017
Messages
376
As the dummy unit is created on the same location as the triggering unit, you can try this:
Code:
call IssuePointOrderById(bj_lastCreatedUnit, 852237, GetUnitX(bj_lastCreatedUnit), GetUnitY(bj_lastCreatedUnit))

Otherwise triggering unit can be found with: GetTriggerUnit()
 
Level 12
Joined
May 16, 2020
Messages
660
The order string of Rain of chaos is : "rainofchaos"
  • Custom script: call IssuePointOrderLocBJ( GetLastCreatedUnit(), "rainofchaos", GetRectCenter(GetPlayableMapRect()) )

According to another thread it's an inherent bug that abilities without Order String bug out. But let me try it out if it works with this.

How would I need to adjust your code to order the "last created unit" to cast "rainofchaos" on "the last created unit"?
 
Level 21
Joined
May 29, 2013
Messages
1,567
How would I need to adjust your code to order the "last created unit" to cast "rainofchaos" on "the last created unit"?
Like this:
  • Custom script: call IssuePointOrderLocBJ( GetLastCreatedUnit(), "rainofchaos", GetUnitLoc(GetLastCreatedUnit()) )
By the way, the GUI version doesn't work because it mistakenly orders the unit to cast Rain of Fire instead of Rain of Chaos.
  • Unit - Order (Last created unit) to Special Archimonde - Rain Of Chaos (Position of (Last created unit))
When the action above is converted to custom text (Edit > Convert to Custom Text), you end up with this:
  • Custom script: call IssuePointOrderLocBJ( GetLastCreatedUnit(), "rainoffire", GetUnitLoc(GetLastCreatedUnit()) )
 
Last edited:
Level 12
Joined
May 16, 2020
Messages
660
Like this:
  • Custom script: call IssuePointOrderLocBJ( GetLastCreatedUnit(), "rainofchaos", GetUnitLoc(GetLastCreatedUnit()) )
By the way, the GUI version doesn't work because it mistakenly orders the unit to cast Rain of Fire instead of Rain of Chaos.
  • Unit - Order (Last created unit) to Special Archimonde - Rain Of Chaos (Position of (Last created unit))
When the action above is converted to custom text (Edit > Convert to Custom Text), you end up with this:
  • Custom script: call IssuePointOrderLocBJ( GetLastCreatedUnit(), "rainoffire", GetUnitLoc(GetLastCreatedUnit()) )


Works as well - thanks! Btw: Wouldn't the "GetUnitLoc" Leak now?

Maybe I can set a variable "u" and then say:

  • Custom script: call IssuePointOrderLocBJ( GetLastCreatedUnit(), "rainofchaos", GetUnitLoc(u()) )
 
Last edited:
Level 9
Joined
Mar 26, 2017
Messages
376
Yes GetUnitLoc leaks.
Be mindful that in your code, the part 'Position of (Triggering unit)' will be converted to a GetUnitLoc call.

This leak can be catched;
  • Set TempPoint = (Position of (Triggering unit))
Then after the location is no longer needed put:
  • Custom script: call RemoveLocation(udg_TempPoint)
 
Level 12
Joined
May 16, 2020
Messages
660
Thanks you two, :) Seems to all work now:

  • Mortal Strike Active
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mortal Strike
    • Actions
      • Set VariableSet MortalStrike_Caster = (Triggering unit)
      • Set VariableSet MortalStrike_Point = (Position of MortalStrike_Caster)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MortalStrike_SkeletonCharges Less than 1
        • Then - Actions
          • Unit - Order MortalStrike_Caster to Stop.
        • Else - Actions
          • Unit - Create 1 Universal Dummy for (Owner of MortalStrike_Caster) at MortalStrike_Point facing Default building facing degrees
          • Unit - Add a (0.50 x (Real(MortalStrike_SkeletonCharges))) second Generic expiration timer to (Last created unit)
          • Unit - Add Mortal Strike (Summon) to (Last created unit)
          • Unit - Set level of Mortal Strike (Summon) for (Last created unit) to MortalStrike_SkeletonCharges
          • Custom script: call IssuePointOrderLocBJ( GetLastCreatedUnit(), "rainofchaos", udg_MortalStrike_Point )
          • Unit - Remove Skeleton Charges: 1 buff from MortalStrike_Caster
          • Unit - Remove Skeleton Charges: 2 buff from MortalStrike_Caster
          • Unit - Remove Skeleton Charges: 3 buff from MortalStrike_Caster
          • Unit - Remove Skeleton Charges: 4 buff from MortalStrike_Caster
          • Unit - Remove Skeleton Charges: 5 buff from MortalStrike_Caster
          • Unit - Remove Skeleton Charges: 6 buff from MortalStrike_Caster
          • Unit - Remove Skeleton Charges: 7 buff from MortalStrike_Caster
          • Unit - Remove Skeleton Charges: 8 buff from MortalStrike_Caster
          • Set VariableSet MortalStrike_KillCounter = 0
          • Set VariableSet MortalStrike_SkeletonCharges = 0
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • MortalStrike_Boolean Equal to False
            • Then - Actions
              • Set VariableSet MortalStrike_Boolean = True
              • Wait 0.01 seconds
              • Unit - For MortalStrike_Caster, Ability Mortal Strike , Disable ability: True, Hide UI: False
            • Else - Actions
      • Custom script: call RemoveLocation (udg_MortalStrike_Point)
(FYI: I'm basically trying to create the Mortal Strike ability from Wraith King. It's pretty cool that with diabling an ability and making the DISBTN ability icon look like a passive version of the active icon, you can pretty much create the ilusion of having an active / passive ability within the same ability)
 
Status
Not open for further replies.
Top