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

[Spell] Stop AI from casting spell

Status
Not open for further replies.
Level 13
Joined
Mar 19, 2010
Messages
870
Hi,

in my map i have lots of heroes with triggered abilities. Now im working on an AI System. I don't know why but the AI cast some of the abilities of an hero automaticly. I did'nt write any line of codes which say "cast spell on an enemy". How can i prevent/disable that behavior. I want to say "now cast spell 1"...

Reg.
 
You can't; the rules after which the AI casts spells are hardcoded and specific to the ability your spell is based on. For example, the AI will only cast any spells based on flame strike if three or more enemies are within a certain radius of each other.

"Channel", however, will never be cast automaticly, so this should be your go-to choice for any spells.
 
Level 12
Joined
Jan 2, 2016
Messages
973
You could make a trigger:
A unit BEGINS casting an ability
Unit's owner equal to the AI
Order Unit to stop
Run trigger (the triger you are using for its behaviour)

When you want the AI to cast a spell - before casting it, disable this trigger, and re-enable it after 0,1 seconds (or something).

It's kind of a sloppy way of doing things, but I think it should work.
 
Level 13
Joined
Mar 19, 2010
Messages
870
But as i understand this thread here, "channel" spells will not cast spells. That is my experience i made too because i have a spell, based on channel with a id "stomp" but when i say "call IssueImmediateOrder(.hero, "stomp") nothing happens!

Anyway, what about DotA. I can't believe that icefrog just let the AI cast spells whenever the hero want, or?
 
But as i understand this thread here, "channel" spells will not cast spells. That is my experience i made too because i have a spell, based on channel with a id "stomp" but when i say "call IssueImmediateOrder(.hero, "stomp") nothing happens!
There are two fields for the order ID on channel. You must change both for it to work. Also, there is no "stomp" order string. You probably mean "warstomp".

Also, if you use IssueImmediateOrder, then of course channel must be configured to be an instant self cast ability (not just via allowed targets, but also under the data field "type".

Anyway, what about DotA. I can't believe that icefrog just let the AI cast spells whenever the hero want, or?
Why not? The default AI is probably better than anything you can trigger if you exploit the default targeting by smart selecting base abilities.

Check this thread for reference.
 
Level 13
Joined
Mar 19, 2010
Messages
870
"Channel", however, will never be cast automaticly, so this should be your go-to choice for any spells.

I tested one of my "channel" spells and the actions run but no cooldown started and the hero didn't lose any mana.
Atm i'm confused how can i tell the computer to use its hero ability when i want and not when the computer want to do it. :(
 
I tested one of my "channel" spells and the actions run but no cooldown started and the hero didn't lose any mana.
Did you use the "a unit begins casting" event or the "unit starts the effect of an ability" event?

Atm i'm confused how can i tell the computer to use its hero ability when i want and not when the computer want to do it. :(
I already gave you an answer to that.
 

EdgeOfChaos

E

EdgeOfChaos

Why not use it instead, to make enemies use desired abilities? Like, if you want the AI to spam something, base it on chain lightning. etc. Default AI is really very well made and can be customized by using triggered skills.
 
Level 13
Joined
Mar 19, 2010
Messages
870
Why not use it instead, to make enemies use desired abilities? Like, if you want the AI to spam something, base it on chain lightning. etc. Default AI is really very well made and can be customized by using triggered skills.

Sry, i don't know what you mean. Can u explain or give an example please?!?
 
Level 13
Joined
Mar 19, 2010
Messages
870
@all Guys who have the same Problem described in the subject. Here comes the solution:

If YOU want to decide when a computer should cast your ability its required that your ability is based on "channel" with a unique id!!!

If you want to let the wc3 engine decide when a computer should use your ability, its required that you ability is based from one of a "base ability". Which one works can be found here.

For me its exactly what i want. Now i just have to change all my abilities to "channel" and i can continue on my Hero AI. Its now possible for me to tell the computer when cast its hero ability.

If you have any question, just drop me a line of PM.

Have a nice day.
 
Status
Not open for further replies.
Top