• 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.

Casting ability with IssueImmediateOrder not working

Status
Not open for further replies.
Level 1
Joined
Feb 17, 2020
Messages
2
So I have a passive ability that I want to basically have a certain percent chance to cast a no target ability. It's a custom ability, so I have to use a custom script to call it by its id. I've attached a screenshot of my trigger function, and as you can see I basically create a dummy unit, teach it the ability, set its level, and then use IssueImmediateOrderById(GetLastCreatedUnit(), 'A024') to tell it to cast, but the spell is not cast despite everything else working.

I tried using PauseUnit and commanding it to stop before casting as well incase something was getting interrupted but it didn't change anything. The unit does learn the ability however, and it's always set to the correct level, and when I tell it to remove the ability after it's issued that works as well, so I know that accessing the ability this way is working for me, just not the command itself. I can also select the unit and use the ability if i don't remove the unit or ability in the script.
 

Attachments

  • trigger.png
    trigger.png
    67.7 KB · Views: 33
Level 45
Joined
Feb 27, 2007
Messages
5,578
You don’t use object ids in spell cast orders. (Object ids are only used for train/upgrade orders.) This means you can order it to cast in GUI just fine; you simply tell it to use the spell that your spell is based on (its base order). This means the order will fail if the unit has multiple spells it can cast all with the same base order. Spells cannot have their base order changed, except for Channel, Charge Gold & Lumber, and Spellbook.

So if you based your ability on War Stomp, then you order the unit to Tauren Chieftain - War Stomp.
 
Level 1
Joined
Feb 17, 2020
Messages
2
You don’t use object ids in spell cast orders. (Object ids are only used for train/upgrade orders.) This means you can order it to cast in GUI just fine; you simply tell it to use the spell that your spell is based on (its base order). This means the order will fail if the unit has multiple spells it can cast all with the same base order. Spells cannot have their base order changed, except for Channel, Charge Gold & Lumber, and Spellbook.

So if you based your ability on War Stomp, then you order the unit to Tauren Chieftain - War Stomp.

Awesome, it works now! Thank you :)
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
You just mistakenly put the object id instead of the order id. They are different although both of them are accepted as argument to the parameter as they're integers. This may force you to search for that ability order id. For more simpler method, you can use the ByString counterpart of the function or stick to GUI action stated above.
 
Status
Not open for further replies.
Top