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

does an autocast system via triggers exist?

Status
Not open for further replies.
Level 14
Joined
Mar 11, 2017
Messages
587
Recently I tried turning a summoning non autocast spell, the phoenix, into an autocastable.
Not only I feel that my approach to triggering it with a mixture of gui and jass suffers from many, inevitable weaknesses due to lack of even basic programming knowledge..
I've also become aware that any and every autocast ability I try to choose as a base has some built-in AI-like behavior forced upon the caster, and/or some particular rules applied (for example the arrows that skip any "casting" event and are embedded into normal attacks similar to orbs).

Therefore after a fruitless search I ask: is it thinkable to create an autocast system via programming/triggering, that is able to render some useful spell (i.e. channel) autocast without the burden of the built-in ai or other weirdness that plague the vanilla autocast spells (this at the same time implies that the ai behavior be explicitly coded by the programmer as he/she desires)
If it's impossible, what are the most important limitations that make it so?
If it's possible to make then: has this already been made (and I'm not aware of it)?

____________
Edit: (TL;DR of the thread)
automatic spells are certainly codeable, but it is utterly impossible to offer the player the user-friendly UI that allows to turn automaticity on and off by right- clicking), unless one bases his automatic spell on pre-existing autocast abilities, each of which comes with issues regarding:
- unmodifiable AI-like behavior forced upon the caster (like for example running towards hurt allies and trying to cast the spell automatically if the base-spell is Priest-Heal. Every autocast spell has its own AI-like behavior)
- particular spell mechanics (like the arrows and similar not being cast as nirmal spells, but being treated as attack modifiers)

there is also the fact that a unit will screw its spells up if it has more than one autocast active at a given time. Sources:
Multiple Toggleable (autocast) abilities?
Autocasting doesn't stack

Also, my research was simply not accurate enough. In truth many years ago the very same questions were asked here: Automatic spells
 
Last edited:

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
It's me again. :D
It is certainly possible to trigger an autocast-like spell, that follows a certain behaviour, when it is cast automatically. However it is not possible to have same UI with a right-clickable ability to toggle autocast. I think, thats what you want. If you want that the spell can be toggled with right click, you have to vase it on an autocast ability.
If you are talking about AI as players, then you can simply remove that autocast ability for AI players and replace it with the normal ability and completely trigger its usage.

So in short: Autocast with right-click toggle is only possible using the autocast abilities that exist in the game, which have certain behaviours.

Using following values for essence of blight and the autocast detection system I provided should work (if that is for your phoenix ability):
Maximum units affected = 0
Maximum units charged to caster = 1
Area of effect = -1
Cast Range = -1
Targest allowed = none

In my test the spell was not used automatically with these values.
 
Level 14
Joined
Mar 11, 2017
Messages
587
Thanks jampion again, I am precisely referring to the possibility of emulating the user interface allowing for the right-click toggle of an autocast version of ability buttons that aren't autocast from the start (particularly referring to channel given its usefulness). Glad to see a definite answer, sad however that it's impossible to reproduce by coding.
I believe that autocastability (as a factor inducing micro-relief) is one of the greatest quality-of-life improvements that this game has brought to players (particularly the casual ones like me) if compared to its precursors, it's almost disappointing to see that the potential of expanding this excellent feature is hampered by making simple, yet key events uncatchable by modders. Must be a reason I'm not understanding.

Am I right in suspecting that the main limiting factor is the lack of the possibility of catching ability buttons' right-click events?
Or is it also impossible to make the little rotating autocast sparkle (it's a .mdx) appear around an ability button's frame in the command card?


And by AI I'm not meaning the common usage of the term, whereby a player is emulated, but instead am calling AI-like the pre-coded behaviors that are forced upon casters of autocast spells, a quick example would be running towards wounded allies if the base autocast ability is priest's heal. These "AIs" are essential for the vanilla autocast spells to work fine, but since they are hardcoded they become a bother if you create a different, custom autocast ability based on a vanilla-autocastable.

Specifically for the phoenix, i have implemented your nice decisional code with some little tweaks to adapt it to essence of blight's orders and even though cast range and area if effect are set to "0" instead of "-1", and target-self is allowed instead of "no targets" , the spell as a whole appears to be doing its job as intended. I'll test these recommended values and report on any difference I can recognize in the phoenix arc thread.
The weaknesses I'm worried about are for example lack of correct responses to particular situations like the caster's death and respawn, or its resurrection through Ankh-like abilities (and others which I'm not foreseeing) , and facts like the triggers running too many times in situations when it wouldn't be necessary, excess udg_ variables that aren't really needed, and bad code design generally speaking.
________
Edit: to those that read wondering about limitations of autocast, there is also the fact that a unit will screw its spells up if it has more than one autocast active at a given time. Sources:
Multiple Toggleable (autocast) abilities?
Autocasting doesn't stack

Also I just discovered that many years ago the very same questions were asked here: Automatic spells (tl;dr: automatic spells are certainly codeable, but it is utterly impossible to offer the player the user-friendly UI that allows to turn automaticity on and off by right- clicking) I must comment: a really short-sighted development decision by the game producer to put these limits on autocast. As said, there must be reasons I'm not understanding.
 
Last edited:

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
Am I right in suspecting that the main limiting factor is the lack of the possibility of catching ability buttons' right-click events?
Or is it also impossible to make the little rotating autocast sparkle (it's a .mdx) appear around an ability button's frame in the command card?
Both. Either an ability is autocast or it's not. There is nothing you can change about that. With the system I made you can at least detect right click on an autocast ability.
The weaknesses I'm worried about are for example lack of correct responses to particular situations like the caster's death and respawn, or its resurrection through Ankh-like abilities (and others which I'm not foreseeing) , and facts like the triggers running too many times in situations when it wouldn't be necessary, excess udg_ variables that aren't really needed, and bad code design generally speaking.
I am not sure, what you mean. What you currently have is an autocast ability, that can be toggled and can be used with no target. You can also detect, if autocast is active or not.
If the phoenix dies, you check if autocast is active and if it is, you order the caster to cast the autocast spell. Every cast of the spell should have the same effect as using the normal phoenix ability. One difficulty is to detect, when it should be cast automatically. Most autocast abilities are only cast, if the caster is on attack-move, stop, hold position, patrol and maybe other orders.
You don't want to interrupt important orders the player gave.
I must comment: a really short-sighted development decision by the game producer to put these limits on autocast. As said, there must be reasons I'm not understanding.
I think their thinking was, that since every autocast ability needs a certain behaviour to be useful, so it does not make sense to add custom autocast abilities, because you won't be able to make custom behaviours anyway. Using my method to detect autocast and triggers to code the behaviour it would be possible to make custom autocast abilities, but they probably did not think about it. I agree, I would also love to see more features for custom abilities and I think could have added more options to the channel ability to make it even more useful.
 
Status
Not open for further replies.
Top