• 🏆 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] Can I order a unit to cast spell by ID?

Status
Not open for further replies.
Level 11
Joined
Dec 19, 2012
Messages
411
native IssueTargetOrderById takes unit whichUnit, integer order, widget targetWidget returns boolean

native IssuePointOrderById takes unit whichUnit, integer order, real x, real y returns boolean

native IssueImmediateOrderById takes unit whichUnit, integer order returns boolean

If I remember right it should be these functions.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
The Ids you use for the above are the Ability Ids. You are thinking of the spell order ids which are strings.

attack / stop / smart / hold and the others are based off of integers.

No, those functions use order ids. And every type of order possesses a numeric id, the string variant is optional.

Units are controlled via orders and if they have two abilities using the same one, they collide. But the command fields are rather limited, you should not have too many abilities on a unit at once.
 
Hmm, I tried it, but it's not working, then I remembered that Silence,which i want to cast via the dummy, is targeting points, not unit. In that case how do you make this line in custom script? and the positions x, y I want to point the position of the targetofabilityBeingCast( GetSpellTargetUnit() )
JASS:
native IssuePointOrderById takes unit whichUnit, integer order, real x, real y returns boolean
 
Level 11
Joined
Dec 19, 2012
Messages
411
  • Actions
    • Set Temp_Unit = Dummy Unit
    • Set Temp_Point = (Target point of ability being cast)
    • Set x = (X of Temp_Point)
    • Set y = (Y of Temp_Point)
    • Custom script: call IssuePointOrderById(udg_Temp_Unit, 'ACsi', udg_x, udg_y)
    • Custom script: call RemoveLocation(udg_Temp_Point)
I think it should be like this.
 
@stan: Well, you can't issue 'ACsi'. The 'Id' is just a number equivalent to the order string (in your case, "Silence" corresponds to the order ID of 852592. You can view a list of them here: Order Ids)

So you can replace 'ACsi' in DD_legionTN's trigger with 852592 if you want. Otherwise, you can use:
call IssuePointOrder(udg_Temp_Unit, "silence", udg_x, udg_y)
(you would put that in place of the line in DD_legionTN's trigger above).
 
in the editor there are more than one silence, how do I know what spell is this ID? and btw the dummy is nto casting the silence on the target, see, I checked if the dummy is there, if the dummy is correctly set, if it has the spell, if the custom script is correct, i turned off collision for dummy, checked if the cast range of spell is 99999, not casting.

how do you write this in script? i wrote it just like
  • Custom script: call IssuePointOrderById(udg_Dummy1, 852592, udg_x, udg_y)
 
Status
Not open for further replies.
Top