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

Need help with autocast trigger.

Status
Not open for further replies.
I have a Knight that has an ability based off the Healing effect that the Potion of healing uses and I need a way to issue the unit to use the ability.

  • Autocast LifeRestore Knight
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacked unit)) Equal to Knight
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AutocastEnabled[(Player number of (Owner of (Attacked unit)))] Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Percentage life of (Attacked unit)) Less than 25.00
            • Then - Actions
              • Unit - Order (Attacked unit) to "use heal abilitiy"
            • Else - Actions
              • Do nothing
        • Else - Actions
          • Do nothing
The ability code is : A00n:Alh1 (Healing (Lesser)) if that helps you to create a custom script action.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
He uses the Potion of Healing (lesser) ability. It doesn't have an order ID, which is the problem.

The order ID associated with the ability you're talking about is 852272. You won't be able to do this in GUI, instead, use this custom script where you have the issued order. Copy and paste the following text into a custom script line.

Berbanog said:
call IssueImmediateOrderById( GetTriggerUnit(), 852272 )

Just tested it out, it works.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Yea, but you'll have to use the custom script text thing in GUI. I'll show you:

  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Custom script: call IssueImmediateOrderById( GetTriggerUnit(), 852272 )
And yes, where you had "use heal ability".

  • Autocast LifeRestore Knight
  • Events
    • Unit - A unit Is attacked
  • Conditions
    • (Unit-type of (Attacked unit)) Equal to Knight
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • AutocastEnabled[(Player number of (Owner of (Attacked unit)))] Equal to True
      • Then - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Percentage life of (Attacked unit)) Less than 25.00
          • Then - Actions
            • Custom script: call IssueImmediateOrderById( GetTriggerUnit(), 852272 )
          • Else - Actions
            • Do nothing <-- You don't need this.
        • Else - Actions
          • Do nothing <-- Or this. Just remove them.
Archangel_Tidusx said:
I will +rep you. :D

Oh... my... God... Really?!?

 
Level 10
Joined
Mar 31, 2009
Messages
732
and Teelo, I stated in the first post that the ability came from the Heal (lesser) item ability. The ability code is below the trigger.
I know, was just double checking that you didn't actually copy it off priests heal spell or forest trolls heal or something, since its supposed to be autocast, and those are autocast healing spells.
 
I know, was just double checking that you didn't actually copy it off priests heal spell or forest trolls heal or something, since its supposed to be autocast, and those are autocast healing spells.

Very well.

And two more things berbanog:

The "do nothing" is the correct way to fill in an 'If then else' function. Also I am not good with jass functions, but because the unit I am referring to is actually "attacked unit", shouldnt the custom script be something more like: call IssueImmediateOrderById( GetAttackedUnit(), 852272 ) ?
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Archangel_Tidusx said:
The "do nothing" is the correct way to fill in an 'If then else' function.

This is what the DoNothing function looks like:

JASS:
function DoNothing takes nothing returns nothing
endfunction

// This is what the function looks like in the API;

There is no reason for this.

Archangel_Tidusx said:
shouldnt the custom script be something more like: call IssueImmediateOrderById( GetAttackedUnit(), 852272 ) ?

The function you're referring to is:

JASS:
function GetAttackedUnitBJ takes nothing returns unit
    return GetTriggerUnit()
endfunction

As you can see, it just returns GetTriggerUnit(). Trust me I know whats best :D

 
Status
Not open for further replies.
Top