• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

how to make computer units cast spells

Status
Not open for further replies.
Quoting myself makes me confused sometimes by whatever. Btw you should use search engine, there were tons of such issues already.

You have to trigger it.
What's the spell you have based your custom one on?
If its normal ladder skill you can refer to it via actions. Lets say it's custom chain lightning.
  • Unit - Order Yourunit to Orc - Far Seer: Chain Lightning YourTarget
There are 3 types of actions Unit - Issued an order:
- no target
- target object (one for unit, one for destructible, one for item)
- target location

Find the one you need in Unit section in Actions and from filter select the 'base' ability.


If your spell isn't ladder one (egzample channel) you can always use:
JASS:
// For location
native IssuePointOrder              takes unit whichUnit, string order, real x, real y returns boolean
// Target
native IssueTargetOrder             takes unit whichUnit, string order, widget targetWidget returns boolean
// No target
native IssueImmediateOrder          takes unit whichUnit, string order returns boolean
Ofcourse you can write it with custom scripts in GUI - don't worry.
There is also alternative: you can always replace those functions with 'ById' ones - so instead of 'string' (order egzample: "thunderbolt") you can write the Id (integer number) of given order.
JASS:
native IssueTargetOrderById         takes unit whichUnit, integer order, widget targetWidget returns boolean
As you see, instead of 'string' function requires integer variable. If you gonna follow that method this will be usefull for you.
 
Level 6
Joined
May 9, 2011
Messages
228
spIn>>i dont get your point can you make it understandable
mckill>>i use the map and import the ai script but nothing happen

can you make a trigger for it
thnx
 
Last edited:
spIn>>i dont get your point can you make it understandable
It's simple. You have to order CPU to cast your custom spells via triggers. mckill2009 said that CPU cast ladder based spell without triggers - although half true because if your ladder spell has no effect (whole effect is triggered) you are still forced to trigger that reaction yourself.

The second part of my replay (the one after 'If your spell isn't ladder one (egzample channel) you can always use:') teaches you how to order computer player to cast not ladder spells (like chanel, etc.).
 
Level 6
Joined
May 9, 2011
Messages
228
the only spell is casted is the "kaboom-sapper"
and also the heal spell
the silence , hex , divine shield etc. didnt work
 
Status
Not open for further replies.
Top