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

[Solved] How to disable auto-cast for AI dummy unit?

Status
Not open for further replies.
Level 3
Joined
Nov 11, 2021
Messages
28
How to disable auto-cast for AI dummy unit?
I tried the following and fails: (tested with Player=Neutral Hostile, skill=Bloodlust or InnerFire, both with Locust and without Locust)
1. Put the skill in unit skills, but not in default active skills. However, AI auto casts the skill.
2. Add skill to unit the skill in trigger. However, AI auto casts the skill.

In above two situations, activation-order never occurs and IssueImmediateOrder(deactivation-order) is always ignored.
Deactivation-order can occur only after activation-order is made to occur (e.g. by trigger or default active). But even if deactivation-order occurred, AI still auto casts the skill.

(Disabling auto-cast is necessary in case that dummy fails to cast spell, e.g. due to dead or uncastable target.)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,557
Untargetable units should be filtered out beforehand to avoid this issue. In other words, the Dummy should only ever be created or ordered to cast if it has a valid target in the first place -> living/vulnerable/organic/etc.

If for some reason that doesn't work then you can check the cooldown of the ability after the cast Order to see if it actually casted. If the cooldown time remaining is 0.00 then it didn't cast the spell so you can Remove the Dummy. This may not work as there could be a timing restriction (you may have to check the cooldown on the next frame). You'll also need to add a Cooldown to the ability for this to work, which could cause complications if you wanted this Dummy to cast the ability on multiple targets at once.

This also requires that your Dummy unit is setup properly so that it can cast spells instantly:
Speed Base = 0, Movement Type = None, Art - Cast Point/Backswing = 0.00.
 
Last edited:
Level 3
Joined
Nov 11, 2021
Messages
28
Untargetable units should be filtered out beforehand to avoid this issue. In other words, the Dummy should only ever be created or ordered to cast if it has a valid target in the first place -> living/vulnerable/organic/etc.

If for some reason that doesn't work then you can check the cooldown of the ability after the cast Order to see if it actually casted. If the cooldown time remaining is 0.00 then it didn't cast the spell so you can Remove the Dummy. This may not work as there could be a timing restriction (you may have to check the cooldown on the next frame). You'll also need to add a Cooldown to the ability for this to work, which could cause complications if you wanted this Dummy to cast the ability on multiple targets at once.

This also requires that your Dummy unit is setup properly so that it can cast spells instantly:
Speed Base = 0, Movement Type = None, Art - Cast Point/Backswing = 0.00.
When the unit is setup as you described, and the skill casting time is 0, it seems that the spell is indeed instant:
e.g. IssueOrder() returns false if target is immune, and mana is reduced after IssueOrder().
This make things simple. (multiple targets should be fine by leaving cooldown=0 and prevent AI by mana)
 
Level 3
Joined
Nov 11, 2021
Messages
28
Untargetable units should be filtered out beforehand to avoid this issue. In other words, the Dummy should only ever be created or ordered to cast if it has a valid target in the first place -> living/vulnerable/organic/etc.

If for some reason that doesn't work then you can check the cooldown of the ability after the cast Order to see if it actually casted. If the cooldown time remaining is 0.00 then it didn't cast the spell so you can Remove the Dummy. This may not work as there could be a timing restriction (you may have to check the cooldown on the next frame). You'll also need to add a Cooldown to the ability for this to work, which could cause complications if you wanted this Dummy to cast the ability on multiple targets at once.

This also requires that your Dummy unit is setup properly so that it can cast spells instantly:
Speed Base = 0, Movement Type = None, Art - Cast Point/Backswing = 0.00.
Another related question - is it possible to immediately fires a normal attack missile?
Spells like fire bolt immediately fires, but normal attacks and xxx arrows does not (with cooldown=0, backswing/damage point=0).

(In some cases I do want normal attack and want to ensure it to fire exactly one shot.)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,557
I guess Attacks require some extra steps, because it sounds like you have all of the correct settings. Maybe make the unit a Building since those don't need to turn to face their targets.

A better alternative is to use a Missile system which lets you mimic the behavior of a missile. I attached a map that has a working Missile system and an example of how to use it. There's a lot of other junk in there that you can ignore.

The Missile system can be found here: Missile [GUI] version 1.6.1

Just note that I modified the system slightly in my map so I recommend using my version. I couldn't get BPower's version to work properly.
 

Attachments

  • TANKS System Demo.w3m
    85.5 KB · Views: 9
Last edited:
Level 6
Joined
Feb 22, 2009
Messages
212
Another related question - is it possible to immediately fires a normal attack missile?
Spells like fire bolt immediately fires, but normal attacks and xxx arrows does not (with cooldown=0, backswing/damage point=0).

(In some cases I do want normal attack and want to ensure it to fire exactly one shot.)
I remember that someone told me the best you can have for the backswing and damage point is 0.1

You can set it to 0 but the unit ain’t attacking immediately rendering it useless.

It seems the lowest you can achieve is by attaching a +400% atk spd to your dummy. This will lower the backswing and damage point to 0.1/5 = 0.02s.

I have never tested this hypothesis though.
 
Status
Not open for further replies.
Top