• 🏆 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!

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