HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Ability Checking

11-06-2003, 02:50 AM#1
Norbo
I am developing another part of my map, and I've encountered a problem storing information. I've used up most of my fields that store values that can be changed without altering gameplay (custom value, mana..).

Of course, I have a third parameter that must be stored on a unit and changed later on via triggers.

I hoped to do this with abilities. I can add and remove them easily, however, I cannot figure out a way to check if a unit currently has an ability.

I thought of using an array for each unique unit, but the excessive work involved to get it working simultaneously with another unit involved has kept me from finishing it.

So, my question is twofold:
Can you check if a unit currently has an ability?

If this is too difficult, can anyone think of another changeable field of a unit to store a value in?

---

(Ahem)
After posting this, I remembered Flying Height can be used to store values in ground units without affecting gameplay. Although this still does not solve the abilities problem ( I would prefer using abilities) this does allow me to continue work on it. Any further comments leading to solving of ability-mystery-of-death will be greatly apprieciated.
11-06-2003, 03:46 AM#2
Taelrie
well I have thought about it a bit and by the sounds of it variables are your best bet. BtW I can't see any logical reason for asking if you have that ability. If you are basing it on hero level just say for the condition "hero is X level".

Frankly just say "unit learns a skill" as the event (it is in generic events). Condition is X spell (ability comparison). Actions is set "X unit to [X variable]). Then just make a condition saying unit is = to X variable and your set.

Of course that will only work if only 1 person has that ability. If you have more then 1 person with the same ability it will unset the first person, so if thats the case I don't know what to tell ya (Except why would you have more then one person with the same spell in a map. NONE of my maps do that. NONE).
11-06-2003, 05:49 PM#3
Norbo
It isn't that type of map. This is a part of Genesis of Empires, far different from any AoS or hero versus hero battle.

Thus, these abilities are given to TRADERS instead of heroes and the like. All of the 12 players can have traders and can build new ones.. etc..

I need to check if the unit has the ability as a sort of storage device. "Is looking for gold" or "Is carrying lumber" and other states could be recorded using abilities if I can check if the unit currently has the ability. I cannot do 'learns' because that would lead me into excessive work in storing the unit; as said in my original post.


I thank you for your help, but this problem seems to be a tad difficult to fix. Right now I've got the flying height working great, but it still doesn't quite have the same effect as abilities to the player. (I could -add- the ability and have it mean nothing, although I'd rather it not be entirely superfluous.)
11-06-2003, 05:57 PM#4
35263526
Why not assign custom values to the unit instead?

For instance, if the unit 'is looking for gold' then assign it the custom value 'MINER'. Then check if a unit has the custom value 'MINER' to find out if it is mining.
11-06-2003, 06:02 PM#5
Norbo
I already used it. In the first post I said used mana and custom value, and now flying height. It is functional, but the base question still remains.. Is it possible to check if a unit currently has an ability?
11-06-2003, 06:18 PM#6
35263526
Sorry, I didn't catch that. You can do it in JASS, the problem being that I'd have to see your finished map to make a trigger that would work.
11-06-2003, 06:48 PM#7
weaaddar
there is no condition in jass which checks if a unit has an ability.

Unless this is something new in 1.12...
11-06-2003, 06:53 PM#8
ObsidianTitan
I realized how you could do it, simpily use unit groups. If you give the unit the ability put it in a unit group, then you can check that.
11-06-2003, 08:11 PM#9
Norbo
That's true titan, but a problem arises. This is applied in more than one location, and to get that working to a good level, it would require a lot of work.

The preferable way is just to figure out if a unit has an ability, but it appears that no one knows of a straight function or command to do it with. In lieu of that, I'll just go on with Flying Height.
11-06-2003, 11:13 PM#10
35263526
Oh yeah. I thought you could check for an ability in JASS, but I was wrong. Oh well...
11-06-2003, 11:44 PM#11
Ligature
You can cram a lot of information into a custom value by using Modulo math and Div operators... I don't know if that would help you but if what you're using the custom values for now is storing integers that won't go over, say, 999, you could pack in another variable at least...
11-07-2003, 12:06 AM#12
dataangel
Don't keep looking for more and more editable numbers on units. That's the wrong way to go. Give a unique custom value to every unit that enters the map, and use that custom value as an index in arrays storing the info you want to keep track of. Much simpler =)
11-08-2003, 01:37 AM#13
Norbo
Again, I've already used custom value.

But beyond that, about using a mathematical expression.. I could, but the need for that has been eliminated by me storing it in flying height instead.

Right now, all that matters is checking for abilities, and from what I see it doesn't seem directly possible.
02-01-2004, 05:52 PM#14
alastor_ac
to do this all u do is...
Code:
function UnitHasAbility takes unit u , integer abilcode returns boolean
    if (GetUnitAbilityLevel(u, abilcode)==0) then
         return false
    endif
    return true
endfunction
hope this helps!
good luck on ur map!
btw u better get ur download server working before my addiction to GoE and not being able to have the new version drives me crazy :P
02-01-2004, 07:34 PM#15
Hunter0000
just use an 0-effect aura, and do a check on buffs.