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

Catching ability event on targets?

Status
Not open for further replies.
Level 14
Joined
Apr 20, 2009
Messages
1,543
Okay so what I want to do is the following:

I've got a talent tree where skillpoints are put inside a hashtable that shows for example 1-3 skillpoints spent on a specific talent.

The problem is I need to link this information to the RAW codes of these talents (abilites).

Now what I was thinking: what if I made a dummy unit cast the ability in which someone increased a point in, then catch the event of the ability being cast and simply save that inside the hashtable.

The thing is, I need to be sure that the ability can be cast even though it doesn't have a target.
Some abilities have a specific target like mechanical units only.
How would I go around this so that I'm abled to catch only the casting of the ability? (Not starts the effect).

Is there a way of doing this?
Is there a way of checking wether an ability has a specific type of target allowed through some native perhaps?
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
I dont follow you at all...

Theres an event - Unit begins casting an ability

We're going to need more information on this so-called "talent tree". Is it fullscreen? is it like the default hero ability select where u select an ability and it levels up that ability?

Theres also constant native GetSpellAbilityId takes nothing returns integer

which returns the integer code of the ability being cast, ability whose effect has started, etc.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
First off the information you gave me are absolute basics, and I think I know how to use them correctly. Thanks anyways though...


Arhowk said:
Is it fullscreen?
Yes it is, and it's created in vJass.

It's simple: I have a talent tree which contains icons.
You can click those icons to put points in those talents.

Now I want to know:
Is it possible to make a dummy unit cast the ability of the talent you've increased even if it has no target. (An ability uses a target right? Tree, Ground, Mechanical etc....)
And if it is then possible to catch the RAW code of the ability being cast with the event unit begins casting an ability? (I suppose it is as long as the unit is abled to cast the spell without a target)

I'm not sure if the dummy will be able to cast the spell without a target.
I could test this out myself later on but I just wanted to know if anyone knew of a solution to this already if it's the case?

This way I can put the ability RAW code of that ability with GetSpellAbilityId inside a hashtable so that it's easier for me to refference the RAW code instead of a number that is now currently being used to indicate which talent was clicked. I could also ofcourse save the RAW code inside the parent or child keys, but that's not a viable solution in my case.

I hope this was more clear then my previous post.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
I don't see why you need to cast the ability in order to get the raw id of the ability.
It may not be a viable solution to store the raw id directly into the talent tree, but you can at least link talent tree-icons (trackables I'm going to assume) with the raw id of the abilities they represent.

If, say, the 5th trackable represents the ability Storm Bolt, you could just store the id of Storm Bolt with the trackable as key, no?
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
I don't understand why you have to do this in-game.

Why can't you just determine all the raw codes during testing and put them all in a hashtable?

Because I don't want to manually type in 120 different RAW codes. Plus the fact that I'm lazy and want things automated (like lots of programmer do :p).


I don't see why you need to cast the ability in order to get the raw id of the ability.

Just to simplify things, I need to index them.
I want to be abled to loop through them later on without having to set them manually one by one.
There are quite a lot. I could also use textmacro's but I'm too lazy and this seemed the fastest way to do it.

It may not be a viable solution to store the raw id directly into the talent tree, but you can at least link talent tree-icons (trackables I'm going to assume) with the raw id of the abilities they represent.

If, say, the 5th trackable represents the ability Storm Bolt, you could just store the id of Storm Bolt with the trackable as key, no?

That is indeed a good solution, thanks and +rep.
I'm probably going to do it this way.
The thing is: and sorry to waste your time and that of the others in this thread, I already solved my problem yesterday by going through it in a different approach.

EDIT: My mind is so confused right now I'm using 4 different programming languages every day and I think things got messed up in my head.
It's stupid to use a catch ability event because I would need to cast the ability (which needs the RAW code) so at that point I can save the RAW code in the hashtable anyways.
I have no idea how I came up with this idea xD
 
Last edited:
Level 14
Joined
Apr 20, 2009
Messages
1,543
Adiktuz said:
The only automation I can see is that if your spells + icons have a constant/formula based rawcodes, you can use a loop to auto-link the spells and icons...

I know what you mean, I was just confusing myself.

If anyone could close this topic I'd really appreciate it.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Okay so what I want to do is the following:

I've got a talent tree where skillpoints are put inside a hashtable that shows for example 1-3 skillpoints spent on a specific talent.

The problem is I need to link this information to the RAW codes of these talents (abilites).

Now what I was thinking: what if I made a dummy unit cast the ability in which someone increased a point in, then catch the event of the ability being cast and simply save that inside the hashtable.

The thing is, I need to be sure that the ability can be cast even though it doesn't have a target.
Some abilities have a specific target like mechanical units only.
How would I go around this so that I'm abled to catch only the casting of the ability? (Not starts the effect).

Is there a way of doing this?
Is there a way of checking wether an ability has a specific type of target allowed through some native perhaps?

u assigned the order string to raw code and tryed categorize them?
like:
hash: key1 (=raw), key2:0, value: mana cost
hash: key1 (=raw), key2:1, value: order string
hash: key1 (=raw), key2:2, value: integer(0 - no target, 1 - target unit, 2 - target unit)
....
etc

then order it and use timer(save unit in timer hash, unit mp before cast), like with 1 sec and check dummy unit mp

i guess its kinda similiar like full screen inventory where every crap u must save (included icon).

whatever the raw code could be attached to trackable in trackable hash and u can attach everything there

Because I don't want to manually type in 120 different RAW codes. Plus the fact that I'm lazy and want things automated (like lots of programmer do :p).
u can load abilities into variable and use the array index instead the raw code so u can use in loop if u want

whatever i do similiar like u just i use trackable for inventory but i also check if a potion is useable or no :p
 

Attachments

  • CustomWindow11.w3x
    738.7 KB · Views: 51
Last edited:
Status
Not open for further replies.
Top