• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

how to detect Autocast is active or inactive on unit?

Level 12
Joined
Sep 27, 2016
Messages
172
Hi everyone...

I have a problem... I'm currently creating a spell pack for Ragnarok Online...

I'd like to ask, how do I detect whether my hero has an active autocast spell like "Poison Arrows" or "Searing Arrows"?

For example: when I attack a monster, if my Poison Arrows are active, my basic attack will inflict "Poison" on the attacked unit.

Unlike other autocast abilities like Immolation or "Morph," abilities like Poison Arrows, Searing Arrows are very difficult to detect whether they are active or not.

P.S.: there some thread, how to detect when i turn off/turn on an autocast ability.. i dont need that..
 
Last edited:
You can't detect when a unit "automatically" casts an Autocast ability like Searing Arrows, so it's a difficult problem to solve.

But I attached a map with an attempt at fixing this issue, it'll need some tweaking to get working consistently. I also didn't bother cleaning up any memory leaks.
 

Attachments

Last edited:
How about this?

  • Searing Arrows Detection
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(flamingarrows))
        • Then - Actions
          • Game - Display to (Player group((Owner of (Triggering unit)))) for 2.00 seconds the text: Flaming Arrows akti...
          • Set Tisha_FlamingArrows = True
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(unflamingarrows))
            • Then - Actions
              • Game - Display to (Player group((Owner of (Triggering unit)))) for 2.00 seconds the text: Flaming Arrows kapa...
              • Set Tisha_FlamingArrows = False
            • Else - Actions
 
You can't detect when a unit "automatically" casts an Autocast ability like Searing Arrows, so it's a difficult problem to solve.
so sad,, that's exactly what i need..

But I attached a map with an attempt at fixing this issue, it'll need some tweaking to get working consistently. I also didn't bother cleaning up any memory leaks.
this helps, but still not what's i expects.. i'm worried, when my hero dies or transforms, the autocast ability is automatically turned off without changing the boolean variable..

But the timer trigger gave me an idea... thanks... I'm trying to detect an ability's autocast status by checking its "attack index." If I attack with an attack index of 1, it means the ability is autocast. I think any autocast ability like searing arrow or poison arrow has the effect of changing the attack index.
  • Searing Arrows Detection
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(flamingarrows))
        • Then - Actions
          • Game - Display to (Player group((Owner of (Triggering unit)))) for 2.00 seconds the text: Flaming Arrows akti...
          • Set Tisha_FlamingArrows = True
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(unflamingarrows))
            • Then - Actions
              • Game - Display to (Player group((Owner of (Triggering unit)))) for 2.00 seconds the text: Flaming Arrows kapa...
              • Set Tisha_FlamingArrows = False
            • Else - Actions

there is a possibility that when you die or transform, the ability is deactivated but the boolean is still in true state.
 
Last edited:
I don't think there's a possibility for that. But you'd only need to detect when that happens and Reset the Boolean.

The Unit Indexer has an Event for when a unit's Custom Value is recycled (2.00) OR when it's assigned a new custom value (1.00):
  • Events
    • Game - UnitIndexEvent becomes Equal to 1.00
    • Game - UnitIndexEvent becomes Equal to 2.00
  • Conditions
  • Actions
    • Set VariableSet Searing_Was_Used[UDex] = False
Maybe add triggers for when the Transform/Death events occur as well. But I think the UnitIndexEvent trigger should cover everything.
 
I don't think there's a possibility for that. But you'd only need to detect when that happens and Reset the Boolean.

Really? I'm just paranoid... but it happened to Defend, tho.. I thought it would be the same..
The Unit Indexer has an Event for when a unit's Custom Value is recycled (2.00) OR when it's assigned a new custom value (1.00):
  • events.gif
    Events
    • join.gif
      game.gif
      Game - UnitIndexEvent becomes Equal to 1.00
    • joinbottom.gif
      game.gif
      Game - UnitIndexEvent becomes Equal to 2.00
  • cond.gif
    Conditions
  • actions.gif
    Actions
    • joinbottom.gif
      set.gif
      Set VariableSet Searing_Was_Used[UDex] = False
Maybe add triggers for when the Transform/Death events occur as well. But I think the UnitIndexEvent trigger should cover everything.

yes.. i did this.. maybe this is one of the best solutions..

but still found many inconsistent execution from blizzard's system itself.. i mean, the custom script/gui is good, but how blizzard execute the custom script/gui is really bad..
 
Honestly you don't even need those triggers, Searing_Was_Used will get reset no matter what.

The real issue has to do with MUI/MPI. These triggers currently only work for one single Unit with the Searing Arrows ability. You'll need to give each Unit with this Ability it's own unique Timer to fix the problem, which is a pain to do in GUI. I recommend a third party system for simplifying the creation of Timers or designing this whole thing in Jass/Lua.

Note that the Unit Indexer being used here is a 3rd party system made by Bribe (not Blizzard). It assigns a unique Custom Value to each Unit on the map. When a unit dies it's Custom Value is put into a "recycle later" list, which will eventually get reused for newly created Units. The issue here is that new Units can inherit old unit's data, like Searing_Was_Used. But this is (1) Not always a problem, which I think is the case here and (2) Easily fixed with the solution in my last post.

Some issues to think about when it comes to Custom Value -> If a unit's Custom Value changes in the middle of it being used then you could experience issues. Maybe Morphing (Transform) will cause this to happen? But I don't think so. Replacing the Unit will definitely cause problems because it'll become an entirely new Unit and get a new Custom Value. This also means that you shouldn't be modifying Custom Value yourself, but that's fine because the Unit Indexer is designed for this very purpose and offers a better solution.
 
Last edited:
Back
Top