HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Make Unit Cast

04-01-2006, 02:12 AM#1
MysticGeneral
How do I force a unit to cast an ability in JASS? Quick and easy question, I hope.
04-01-2006, 06:47 AM#2
vile
force? you mean order it to cast.
You need the order id of each ability.
Go to the ability and you will see it somewhere in the object editor.
For example, war stomp is "stomp", fan of knives is "fanofknives", etc. Just find it in the object editor and then use:

For immediate orders like war stomp, fan of knives, etc use:
Collapse JASS:
call IssueImmediateOrder(unit, "stomp")
For target orders:
Collapse JASS:
call IssueTargetOrder(unit, "thunderbolt", target)
For location orders I suggest using X/Y's:
Collapse JASS:
call IssuePointOrder(unit, "breathoffrost", GetUnitX(target), GetUnitY(target))

Or GetLocationX(loc) for that matter.
If you want locs anyways:
Collapse JASS:
call IssuePointOrderLoc(unit, "order", loc)

Please advise to the common.j to know more about natives.

By the way there are a few apps out there that converts these orders into integers, which
is faster to use. Vexorian's map optimizer already does this but if you dont use his optimizer,
I suggest using the integers. If you want to get an integer of an order with wc,
make a trigger that a unit is issued an order with no target, with target, or whatever that suits your ability, then type on the actions: call BJDebugMsg(I2S(GetIssuedOrderId()))

Then you can use
call IssueImmediateOrderById(....
Just add ById at the end.

Edited by Blade.dk. Reason: Use JASS tags!
04-03-2006, 11:42 AM#3
BertTheJasser
There is an easier way to get the order ids. Just dl Natunko_Husks string oredr id convertor.(I think it's available at wc3sear and on this site too, but I am not shure)
04-03-2006, 09:26 PM#4
PipeDream
Pffah. Can anyone point to an experiment that conclusively demonstrates order integers are faster than strings?
04-03-2006, 09:45 PM#5
Captain Griffen
No but do you think the game uses order strings or order integers (ok, I know its neither, but which one is easier to convert)?
04-04-2006, 07:40 AM#6
Anitarf
Order Ids are simply more powerful since you can use them to cast abilities without orderstrings.
04-04-2006, 03:03 PM#7
shadow1500
Since strings leak its abit better to use ints.
04-04-2006, 07:12 PM#8
PipeDream
Integers still have to be atoi()'ed
Strings, probably a hash table look up-basically atoi() with a different base.

Is there a string leak for literals? In any case, if you stuff it into a variable each time, it will reuse the memory, not "leak".

I'll buy Anitarf's reason for consistency's sake though.