• 🏆 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] ordering unit to cast a custom ability

Status
Not open for further replies.
Level 4
Joined
Oct 18, 2010
Messages
55
still cant figure this out. how to make unit order to cast custom ability (on a point). when i browse the orders there are like "move to" and then only default abilities like "tinker - cluster rockets" but no option for variables or something.

thanks for answer & will rep :)
 
Level 14
Joined
Aug 30, 2004
Messages
909
still cant figure this out. how to make unit order to cast custom ability (on a point). when i browse the orders there are like "move to" and then only default abilities like "tinker - cluster rockets" but no option for variables or something.

thanks for answer & will rep :)

Custom abilities are still based off of regular ones. You should look at the custom ability in the object editor for: "Text - Order String - Use/Turn On" and use that one. For example, I have a custom ability called "Reprogram" that was based off of aerial shackles. The order is "magicleash" in the world editor. So if you order my unit to cast aerial shackles, he will actually cast Reprogram. The only thing to be worried about is if the unit had both Aerial Shackles and Reprogram...in which case weird stuff would happen.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
I'll paste one of my answers for question like this:
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 locction

Find the one you need in Unit section 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 like: "thunderbolt" you can write the Ids of orders.
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.
 
Status
Not open for further replies.
Top