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

Automatic spells

Status
Not open for further replies.
Level 1
Joined
May 20, 2010
Messages
5
Hello,

I have a question, or several regarding automatic abilities, i.e. abilities that you can activate by right-clicking the ability.

It is not difficult to create triggers and stuff to make a unit use its ability when you want. But first of all is there a trigger detect event that detects a right click by a player? (In JASS or Gui). And then the big problem is icon art. I've created my icon with an autocast border. But what exactly is it that creates the shiny, rotating yellow border when you rightclick an autocast ability? What is the role of the BTNAbilitynameOff icon? It appears to be exactly the same as the BTNAbilityNameOn icon. Does it only depend on the ability you base it on? This would mean that it is only possible to create an autocast ability that is based on existing autocast abilities in the blizzard wc3, meaning several problems:
1) It is impossible to create autocast area of effect spells such as Earthquake, etc because when you would click on the ability manually (i.e. no dummy casting the spell) you can't see the aoe art (race specific, do you know what I'm talking about?).
2) Every existing autocast ability comes with its own triggers (integrated into the game right?) or something like that that determine when it is cast, and that can sometimes be very inefficient (I mean from a game point of view, not the best use of your faerie fire or curse for example).

Thus is there not a way to make the icon art work on any base ability, through the activate and unactivate orders and use orders? Is there a way to make channel into an autocast ability through "base ID"?

I only care about the art really as the effect of any ability can easily be manipulated at will through dummy units, etc.

I hope at least some of what I'm trying to say will come across... I'm really also asking for clarification of what these fields "activate/unactivate/Off/use" (I'm not sure of the exact words as my editor is in French) and "base ID" in Channel do exactly. I've looked in the tutorials section but wasn't able to find anything about autocast icons/abilities (I dont mean the autocast off icon which is easy to do with W3IR but the shiny rotating autocast on border thing).

Thanks for having read through all of that (if you have ^^).
 
Ok, first of all.

Auto-cast abilities. If you want to make an autocast ability, you will base it off the default abilities, e.g. Fairie Fire, Inner Fire, Searing Arrows, etc. So, this means that you can't turn any ability into an autocast. This 'rule' applies for Channel too. Channel can either be of Point target/of Unit target or No target. Examples for each of them are:
Point Target: Shockwave
Unit Target: Cripple
No Target (Instant): Battle Roar

The shiny thing that appears on the borders is a default model. You can change it if you want, by finding its path via Warcraft III Viewer (http://www.hiveworkshop.com/forums/tools.php?id=rgy4bk).

Each autocast ability, as you said yourself, is triggered upon a different event. For example, Searing or Frost Arrows are eternally on, no matter what (unless the unit has no mana, but this happens on every autocast). Inner Fire is triggered once a nearby ally takes damage. Heal is applied once an ally unit comes within range of the unit that bears the Heal ability AND is injured.
Up to the effect you want to achieve, you need to base it off the specific ability. You can also manipulate the effect accordingly, by changing the Targets Allowed field from the ability itself.
Let's say you want an Earthquake casted on you, once you take damage. You will need the Heal ability with 0 values (meaning no heal) and Targets Allowed to Self.

Of course the example mentioned above requires extra triggering.
This is when the detection part comes in.
Each ability has its own Order Id. Order Id is what actually "enables" and/or "disables" the effect of the ability.

There are three main Order Id fields:
• Text - Order String - Activate/Deactivate
• Text - Order String - Use/Turn on
• Text - Order String - Turn off


• Activate/Deactivate is for abilities that you are able of activating and deactivating. Examples? Mana Shield, Big Bad Voodoo, Immolation; once you press the ability, it comes into effect and then you can deactivate it (to stop draining mana). Certain autocast abilities, like Heal and Inner Fire also belong to this category, because they proc, under special conditions and not eternally, like Frost Arrows.

• Use/Turn on are for the most abilities. Of course, I am speaking of the active ones, but some abilities, like Bash, that have a chance to proc, also have an Order Id (Use/Turn on).
The "Use" keyword is for normal abilities, examples are Chain Lightning, Blizzard, etc.
The "Turn on" keyword is for Autocast abilities, e.g. Frost Arrows, Orb of Annihilation etc.
Note: Use/Turn on is applied for both casting and right-clicking an autocast ability of type Frost Arrows (that apply an effect no matter what).

• Turn off is now obvious. It's the keyword to turn off a previously turned on autocast ability.

So, up to the ability you want to muddle with, you will bear these explanations in your mind.

Let's make a test. We want to see what the Order Id of Rain of Fire is. Which one of the categories above are we going to check into?
Text - Order String - Use/Turn on


So, now you know what each one of those make, let's move on to the detection part.
Let's say we want to detect when a unit that has the Heal ability is issued to auto-cast it (=right click it).
The first thing you have to do is getting to the Heal ability and of course search the Text - Order String - Activate and Deactivate. Memorize those strings and move on to the Trigger Editor.

  • Trigger1
  • Events
    • Unit - A unit is issued an order with no target
  • Conditions
  • Actions
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (Issued order) Equal to (order(healon))
      • Then - Actions
        • //Congratulations, you have just detected the turn on of the autocast!
      • Else - Actions
        • If (All conditions are true) then do (Actions) else do (Actions)
          • If - Conditions
            • (Issued order) Equal to (order(healoff))
          • Then - Actions
            • //Congratulations, you have just detected the turn off of the autocast!
          • Else - Actions
As you can see, it is pretty simple.
The event "Unit - A unit is issued an order with no target" is used, because right clicking IS an order, but has no target of course (when you right click, you don't target a unit!).

Let's say you want a unit that attacks another unit, which, if it has an autocast ability, the owner of theirs will receive 20 gold. I will make a trigger, but it is not recommended for use (I will only present it to you just for the sake of the example). It is not recommended because Unit - A unit is attacked event is triggered before the attacked unit takes the damage = can be abused really easily (you would need a Damage Detection System for best results).
  • Trigger1
  • Events
    • Unit - A unit is issued an order with no target
  • Conditions
  • Actions
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (Issued order) Equal to (order(healon))
      • Then - Actions
        • Unit Group - Add (Triggering unit) to Group
      • Else - Actions
        • If (All conditions are true) then do (Actions) else do (Actions)
          • If - Conditions
            • (Issued order) Equal to (order(healoff))
          • Then - Actions
            • Unit Group - Remove (Triggering unit) from Group
          • Else - Actions
  • Trigger2
  • Events
    • Unit - A unit is attacked
  • Conditions
    • ((Attacking unit) is in Group) Equal to True //{Boolean Comparison: Unit - Unit is in Unit Group}
  • Actions
    • Player - Add 20 to (Owner of (Attacking unit)) Current gold
That easy. The "Group" is a Unit Group variable. We add the unit to a unit group to easily know whether it still has the autocast on. Once the unit is issued to turn off the autocast heal, it will be removed from the Group, so, Trigger2 will not result a gold income, since the unit no longer is in the Group. Of course, other factors also take place, such as mana. If the unit has no mana, the effect of the spell won't be applied, so the gold shouldn't also be distributed. This one requires a bit more advanced triggering, but I am not aware of your triggering level/background.
 
Level 11
Joined
Feb 11, 2010
Messages
199
But first of all is there a trigger detect event that detects a right click by a player? (In JASS or Gui)
Yes. In both. Event "A Unit is issued an order with no target" Condition "Issued order equal to" (yourautocaststring).

Does it only depend on the ability you base it on?
Base your ability on an ability that has an autocaston and autocastoff order string.

See? Very easy. :thumbs_up:

For even more information on how to do this, see here: http://www.hiveworkshop.com/forums/...orials-279/making-any-spell-autocasting-6255/

Edit: Curse you Pharaoh for stealing the first post while I was typing! :p
 
Level 1
Joined
May 20, 2010
Messages
5
Thx for the replies. But wait this doesn't solve my problem. All autocast spells in the game only target units right. This means when you left-click it (whether autocast be activated or not) the target unit animation appears where the mouse is, and not an area of effect animation (big race dependent circle) like for blizzard, flame strike, or earthquake. Do you understand what I'm trying to say?

Moreover, if you have to base it off existing autocast spells with their own triggers (like curse, faerie fire, slow for things attacking enemies such as an autocast frost nova) then the spell will be triggered by your own triggers AND the already pre-existing triggers. For example let's say I use curse (for which I don't know the exact conditions for it to trigger) as a base ability and use your trigger for detecting the autocast order (right-click). Then I write a trigger which says that when, I don't know, at least five ennemy units clustered within a circle of max radius 50 (to maximize use of the autocast frost nova) are in range, it casts the curse (which then triggers a dummy caster to cast frost nova). Now the problem is that the curse and therefore frost nova will be triggered by my manual trigger and by the pre-existing blizzard trigger, right?

Also, about searing arrow, frost arrow, etc. I saw that some people used these as the base for their autocast abilities. But don't they trigger automatically each time you attack? Which would suck, imagine you have a cooldown to your autocast ability (think of frost nova) and it gets triggered at the wrong time and then you can't cast it anymore.

Finally, it is only important not to have two abilities with the same order id one ONE unit? Having two different buffs coming from abilities with the same order id on a same unit (i.e. slow (original) and my frost nova based on slow have been casted on the same unit and that unit now has both the slow and frots attack buffs) won't cause problems?
 
Level 19
Joined
Oct 15, 2008
Messages
3,231
Oh, so in simpler terms, you want Auto-Cast Abilities, when manually being casted have a huge coloured ring icon instead of a crosshair icon right?
 
• Yes, I know what you mean; you are speaking of the racial AoE target circle. No, it can't be done, because there is no such autocast spell that can target an area.

• Right, but if you have no values set in the autocast ability, e.g. 0% chance by Curse, the trigger will detect whenever your ability is cast and make the effect you want.
  • Trigger
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Curse
  • Actions
    • //Your actions here
This trigger is for both manual and automatic spell casting, where automatic equals auto-cast.

• If your ability has a cooldown, you will need to use a timer. And, once the timer expires, a boolean will be set, that will cause the effect. Basically, you will make a condition if a value x = true. If it is true, it means that there is no cooldown. So, once the spell goes into effect, you set the x value to false, so that the effect won't be triggered, until the ability is off cooldown time.

Yes, it's very important and no, it won't cause problems. Some buffs by default override each other, something you can fix in Gameplay Constants (if any changes can be made for those specific abilities).
 
Level 1
Joined
May 20, 2010
Messages
5
Oh that's a shame. No nice blizzard autocast. I'll have to do something like if the player right clicks it then a chat message comes up telling him he's put it into autocast. Although I'm not sure the event register order would work for abilities that aren't based on abilities that have a turn on, turn off order. Probably not.

I'm really sorry Pharaoh, but I still don't understand how that would work. Imagine I wanted well my frost nova casted only when there are at least 5 ennemies bunched up (i'm not exactly sure how I'd test that but...). Now if I base it off curse, even if the chance is set to 0, it could very well be that the cooldown is set to 0 while only 1 ennemy comes along. According to the interna trigger of curse, that ennemy will be cursed (sure to no effect) and thus the trigger detecting the casting of the ability as well. What I could do actually is to have several conditions: the use of the dummy ability curse and the fact that there are 5 ennemies bunched up (although the firing of the dummy curse would still put the spell off cooldown. Yes I could make the cooldown for the dummy ability very short and make the real cooldown as you said through a boolean but that wouldn't be too nice graphically, imagine the player frantically trying to get his nova off because the spell looks to be off cooldown and nothing happens...).

Anyway I guess automatic spells are a bit of a problem.

Isn't there a way to create the graphical effect of the autocast border on (shiny gold turning thing) onto an icon I mean in game just as you can create the art of any ability upon any unit?
 
Status
Not open for further replies.
Top