• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Get ability id

Status
Not open for further replies.

EdgeOfChaos

E

EdgeOfChaos

This is probably really simple, but I can't find it anywhere.

What is the jass function to get he ability Id of an ability? Like GetUnitTypeId for abilities?
 
GetSpellAbilityId() refers to ability being cast if thats what you need.

stan0033, your question was about orders and abilities, which are different things. You can have more abilities with the same order id and trigger will notice the difference if comparing abilities, but not if comparing orders as result of different abilities and same order string. For that you would have to create some array or hashtable to get correct mapping.
 

EdgeOfChaos

E

EdgeOfChaos

Not necessarily a cast ability, I just want something that takes some ability argument and returns its rawcode. Or, optionally, a way to make a hero cast a skill without an order string or rawcode, just like: call UnitCastAbility(udg_Source, udg_Ability, udg_Target)
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
This will return the rawcode if you have an event like EVENT_PLAYER_UNIT_SPELL_CAST

JASS:
local integer spellId = GetSpellAbilityId()

In what context would you need the rawcode of ability if it's already in an event?
 

EdgeOfChaos

E

EdgeOfChaos

I am trying to make some general functions for a map I am making, that can be reused multiple times. First I'm trying to make a dummy handler. When it is passed a source, a target, and an ability, it will create a dummy unit, cast the ability, and remove the unit. It's a pretty simple function (or so it seemed), but it would save me a bit of time and a lot of annoyance, having to copy the actions every time.

This is what I have:
  • Apply Effect Code
    • Events
    • Conditions
    • Actions
      • Custom script: endfunction
      • Custom script: function ApplyEffect takes player caster, unit u, ability a returns nothing
      • Custom script: set udg_GENERAL_Caster = caster
      • Custom script: set udg_GENERAL_TempUnit = u
      • Custom script: set udg_GENERAL_TempSkill = a
      • Set GENERAL_TempPoint = (Position of GENERAL_TempUnit)
      • Unit - Create 1 DUMMY - general for GENERAL_Caster at GENERAL_TempPoint facing Default building facing degrees
      • Custom script: call UnitAddAbility(GetLastCreatedUnit(),udg_GENERAL_TempSkill)
      • Custom script: call IssueTargetOrderById(GetLastCreatedUnit(),udg_GENERAL_TempSkill,udg_GENERAL_TempUnit)
Error is something like, cannot convert ability to integer.
 
Well, the 'ability' type actually isn't used for anything. It can be returned with GetSpellAbility(), but there really isn't a whole lot you can do with it.

For UnitAddAbility(), it takes a unit and integer rawcode (which can be viewed in the object editor. It is also returned from GetSpellAbilityId()). As for IssueTargetOrderById(), it takes an integer ID, which can be generated from OrderId, e.g.:
JASS:
OrderId("stormbolt")

Anyway, for your function, you'll need two things: (1) the rawcode (2) the order id (or order string). There isn't a way getting around it. Alternatively, you can also store the order ID/strings of every ability you use in the map under the ability's rawcode--that way you just need to know the rawcode, and then you can load the order string through a hashtable.
 
Status
Not open for further replies.
Top