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

A little help

Status
Not open for further replies.
Level 9
Joined
Jun 7, 2008
Messages
440
Maker said:
You would have to first manually configure the type of each spell. There are three types of spells, point targeted, unit targeted and instant cast. Each requires a different function to be called.

You could store the spell type or function to call into a hashtable and then load it when needed. Use the ability id as parent key.

I had asked a question a while back (Is there a way to get a dummy unit to cast a spell that a random enemy unit casts at it?),to which Maker responded with the quote above. My question is; How do you call the ability id (or the string order for that matter) after it is stored inside the hashtable? There are over 300 possible abilties able to be cast. Thanks again.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
You can check the "Target unit of ability being cast" (Target)
You can check the "Ability Being Cast" (Ability)

You can save 'Ability Being Cast' as 0 if 'GetHandleId(Target)'

That's the easy part. The hard part is what maker said: There are different function callings for different types of abilities cast.

native IssueImmediateOrder takes unit whichUnit, string order returns boolean = Order with no target.

You would have to to order the unit to cast the ability code saved in Slot 0 of Unit handle in some Hash
JASS:
call IssueImmediateOrderById(Target, LoadInteger(udg_Hash, GetHandleId(Target), 0))

So... basically, you would have to check in a list the type of ability casted and order your unit the same thing. Lets say 'A002' is a No Target order. You save "1" in 'A002'. If 'A28g' is a Target order, then save 2. If it's channeling, save 3, if.. etc. Then call the correct order function based on the number you saved.
 
Level 9
Joined
Jun 7, 2008
Messages
440
Yea,saving it into the hashtable isnt the problem. I guess the real problem would be the string usage afterwards. There are too many to sit here and name, even if I used target only spells! I guess my question really is this:

How do I get the target to cast the spell saved in the hashtable? It is a semi-simultaneous spell, so I'm not really worried about anything other than trying to cast the same spell. Lets localise it to Target only spells, since were on the topic.

Any ideas? Ill try to help anywhere I can.:vw_sad:
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
When the unit is targeted by an ability save the CasterID 0 of 0 in Hash and the TargetID as 1 of 0 in Hash, and the Ability Being Cast as 2 of 0 in Hash.

Then Order the target:

call IssueTargetOrderById(LoadUnitHandle(Hash, 0, 0), LoadInteger(udg_Hash, 3, 0), LoadUnitHandle(Hash, 2, 0)

As you can see, Ability being cast is an integer, not an string order. You can give orders by Id (Integer)
 
Status
Not open for further replies.
Top