HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Get Spell ID

12-03-2004, 08:27 PM#1
Sicknesslife
Hi,

How can I make a trigger that will get the Id of a spell that my hero casts?


event - unit casts a spell

action

id of spell cast = ?????



something to that effect, i need the id not the name, thnx
12-03-2004, 08:36 PM#2
Guest
create an integer variable: e.g abilid
then call this function

custom script: set udg_abilid = GetSpellAbilityId()

the id for the spell is the integer, abilid.
12-04-2004, 04:47 AM#3
Sicknesslife
where do I put that? I have all my functions and triggers in JASS. do I put it in amidst the triggered effects of my spell? if so I tried that and it initialized as 0 or null
12-04-2004, 03:12 PM#4
Sicknesslife
I tried that it does not work

unit - learns a skill

action

customScript: set udg_ab = GetSpellId()



it set 0 or null
12-04-2004, 03:14 PM#5
curi
too lazy to check right now, but hope this helps: what you should do is make a GUI trigger, and find the event response thing in the GUI, that gets the spell ID (err, i think/hope there is one. or if not, maybe you can find one to get the spell type and convert, or something like that). then convert to custom text and see what code it used. and if it uses a BJ function, you could look it up and see what it does, and possibly replace it with a common.j function.
12-04-2004, 06:56 PM#6
Sicknesslife
Quote:
Originally Posted by curi
too lazy to check right now, but hope this helps: what you should do is make a GUI trigger, and find the event response thing in the GUI, that gets the spell ID (err, i think/hope there is one. or if not, maybe you can find one to get the spell type and convert, or something like that). then convert to custom text and see what code it used. and if it uses a BJ function, you could look it up and see what it does, and possibly replace it with a common.j function.


There is not one in the GUI, that would have been too easy. all I can find is how to get the spell name... not helpful GetSpellId() should work I just have no idea how to use it, it takes NOTHING and returns integer, i want the int but i have no idea of its syntax... hopefully Vex stops by.
12-04-2004, 07:43 PM#7
Ryude
Get Spell ID
Events
Unit - A unit Starts the effect of an ability
Conditions
Actions
Set spell_id = (Ability being cast)

The variable spell_id is an ability variable.
12-04-2004, 08:02 PM#8
Guest
an ability id is a 4 letter code, like 'A000', it is a formatted integer.

an ability variable refers to the ability itself, not the id of the ability.

Quote:
I tried that it does not work

unit - learns a skill

action

customScript: set udg_ab = GetSpellId()



it set 0 or null

Wrong event. The GetSpellAbilityId() function is associated with the ability cast functions, not the ability learn.

replace with this: custom script: set udg_abil = GetLearnedSkill()
12-04-2004, 08:44 PM#9
AIAndy
There is no object for the ability itself. The ability variable in GUI is only an alias for an integer, containing the ability id.
12-04-2004, 10:48 PM#10
Guest
That's what an ability is ;), an ID that identifies it as an ability and which ability it is.