• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

How to cause AI cast custom spells?

Status
Not open for further replies.

Deleted member 242951

D

Deleted member 242951

Well.....

I think u what I am gonna ask from the topic
But still....

How do I make units cast custom spells using triggers?
 
Level 25
Joined
Sep 26, 2009
Messages
2,405
You have to know which spell you based the custom spell off. For example a custom AoE spell based off Blizzard.
In triggers, you "Issue order". It's an action in the unit menu. There are many types of issue order actions - for example issue order targeting a point has all spells that target point (= not unit) - e.g. Flamestrike. Then there is issue order targeting a unit - e.g. Fireball. Last is issue order with no target - E.g. Starfall.

Now you order your unit to cast the spell you based your custom spell off. So if your spell is based off Flamestrike, you order the unit to cast Flamestrike. Flamestrke is a point-target ability, so you won't find it anywhere else. That means you cannot order a unit to cast Flamestrike on specific unit. Same as you cannot order Fireball spell to be cast on a location, etc.
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,184
There is a order id field for each spell in the object editor. You simply order the unit to cast a spell using that order id with triggers.

The tricky part is to detect WHEN to cast it. Trust me, it's really advanced and no one will be able to help without writing a bible and a half. There is a (very) simple tutorial that shows to to create an AI with trigger in the tutorial section. Sadly the tutorial is very specific and clearly not good enough for any project unless you want a 3 year old to be able to beat the AI.
 
Level 11
Joined
Jan 23, 2015
Messages
788
Just make sure the unit/hero's abilities are not based on same abilities, cause if you try to cast ability A based on a same ability as ability B, it may cast ability B instead of ability A.. there will always be conflict between those two, so make sure you use different base abilities for your spells :)
 
Level 18
Joined
May 11, 2012
Messages
2,103
By ordering them to cast spell ID that's in your custom spell's orderID.
Note that if you want quality AI and smart spell casting, you'll have to trigger all the logic, and situations. If you want them to just cast the spell anytime, use trigger which checks when they're attacked or use periodic trigger, check any nearby enemy units and order your AI to cast spell on an attacking unit or picked unit.
 

Deleted member 242951

D

Deleted member 242951

Oh!! Thanks 2 all of u for making me clear... Thanks . :D
 
Status
Not open for further replies.
Top