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

[General] How to get AI to use custom spells?

Status
Not open for further replies.
Level 4
Joined
Nov 24, 2012
Messages
68
I have many custom spells in my map but, the AI don't use the spells. Do I need triggers to get them to use it?

Thanks
 
Level 5
Joined
Jan 27, 2014
Messages
164
Yeah, you'll need trigger to get them to use it.
Also you'll need to provide the proper condition of when the unit should use it.

Triggering AI is a pain in the ass sometimes.
But you don't have much other choice.
 
Level 4
Joined
Nov 24, 2012
Messages
68
Yeah, you'll need trigger to get them to use it.
Also you'll need to provide the proper condition of when the unit should use it.

Triggering AI is a pain in the ass sometimes.
But you don't have much other choice.

ok ill do that thanks for the help
+rep
 
Level 19
Joined
Mar 18, 2012
Messages
1,716
The easiest way is to base your abilities of the spell listed by Ekki2.
Note that nearly all of them only fire on damage response. For instance the ai will only order storm bolt when a unit in range is damaged.
Others fire on aquires event like bloodlust.
Of course these AI responses are not really clever and easy to trick.
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
I used Attacking unit as the unit but it would depend on you because on my full trigger if the unit is attacked and Attacked unit equals to my unit then I ordered the Attacking unit to cast various spell through issuing a command like this, it would be best to store Attacking Unit most likely if it is used twice:

  • Unit - Order (Attacked unit) to Orc Tauren Chieftain - War Stomp
An example is this, make your unit cast the spell by finding out your custom spells' Order String - Use/Turn On.

So for example, if your custom spell has a Order String of Shockwave then what you must do is Order your unit to use Shockwave and thus changing it to this:

  • Unit - Order (Attacked unit) to Orc Tauren Chieftain - Shockwave (Attacking Unit)
This is a way in GUI and you must remember that each sets of abilities are divided into target, point targets, or no targets.


Some notes as well, you should base your custom spells' Order String to the same target type of spell you have like for example, you made a custom spell based on War Stomp which is an Instant spell. So you should based it on Order String of an Instant spell as well like War Stomp obviously or if it has been used already then Thunder Clap and more..

This is to avoid confusion and to keep it clean.
 
Level 6
Joined
Apr 23, 2011
Messages
182
Hi !!

Well i guees the best way if you want the AI to use like a pro spells is by timing. I mean create a trigger that loops every 0.03 or more sec and then just put your conditions. The last step will be runing the trigger of the MUI or GUI spell once.

You will need to create more variables but it will work amazing!!

Importat: Create a variable of Cooldown for the ability!!!

Kind Regards!! Long time since i post something :)
 
Level 4
Joined
Nov 24, 2012
Messages
68
Ok I got a better understanding now.
Thanks Erkki2 for the list! +rep
Thanks BPower for the extra knowledge I never knew that. +rep
Thanks Hell Master for the triggers! I be sure to try and test them out. +rep
Thanks lordsent i never knew that u can do that. +rep
 
Status
Not open for further replies.
Top