Ok it seems as if when I go to post a question on how to do something or how some function is ment to be used I end up figuring out to some degree how to Solve my problem. This post was orginally a Question on "How to get the Icon data for an abilitys button". But as I was asking it I started to realize what I was doing wrong. So I edited the post to explain what im doing now to grab this data.
<sub>Sorry to any who have seen some of my other post where I ask a question then end up posting an answer to it a few mins later</sub>
Ok this post will show you how to find any ability Icon from any given unit type. Also I will provide the code from the triggers I have made as well.
I will be using Catalog Field Value Count and Catalog Field Value Get
Geting the number of Abilitys a Unit Type has and any given Ability of a Unit Type
So first we need to find out how many abilitys a unit type has and then get each one. So I created a Funtion that returns the number of abilitys a Unit Type has, then I created a Funtion that returns a single ability from a given index. You dont have to if you dont want but I did since this is code that will be repeated alot for the map im messing around with.
Using these two functions you can make a simple for each/while loop to get each ability.
The Unit Ability Count is pretty much as is. It will tell you the number of abilitys a given unit type has. So Marine will return 4
The Unit Ability function has more going on. If you look at the line with the Catalog Field Value Get, you will see Im combining strings to make a full string that points the the Ability Link we want.
("AbilArray["+((String(AbilityIndex))+"].Link"))
What that is really sending is "AbilArray[AbilityIndex].Link"
Example: Protoss Carrier Raw data View
Note that the AbilityIndex is not 6 its 5, the AbilArray (and as far as I know all arrays in galaxy are 0 based. Meaning they start at an index of 0)
This also brings up the point that after u get the Count for Abilitys you have to remember that it will return an amount that is 1 more then the highest index value.
Ability Icons
Now you might have see one of the abilitys for the Carrier was "##id##Hangar" anytime you see ##id## that is a refence to that objects id (Unit, Abiltiy, Actor, etc). Which can be seen in the data editor when you view is set to show Raw data
The reason I point that out is some abiltiys are different then others. The difference Im going to talk about has to do with where you fine there Button Icons. Abilitys have a Default Button Icon or Face for them. Most have this data located in an entry named CmdButtonArray, other abilitys have this Default Button Face located in InfoArray.
Ok this is where I have to admit I only know how to find the icon for the CmdButtonArray (I am still trying to get the Icon for abiltiys which use the InfoArray)
Heres how you find the Default Button Face for MOST abilitys. First I will show you the code for the funtion I created that returns an Image variable for the Ability Icon using the CmdButtonArray.
So you can see we first find this DefaultButtonFace Value for the given Abiltiy, then we use that value to grab the value of the Icon for the abiltys DefaultButtonFace. I am sure you can use these functions to also grab other states for the buttons. I dont know how to do this and the map im working on does not (as far I know really need to do this)
A temp fix for Abilitys with InfoArrays
I have not found a way to get to the defualtbuttonface with the infoarray BUT you can link to the unit and it should return a string that is usable within the buttons catalog (I have seen some dont have the icons. I think the Broodling Icon is missing not sure thou)
Now to check if an ability has the InfoArry, as far as I can tell you have to just know for that ability type. I am just using an If Then Else action.
Ok I am still learning this so if anyone has any added info or commits feel free to post a reply. I will be trying to edit this to show how I am going to get the Icons for abilitys that store there DefaultButtonFace data in the InfoArray (and any other ones I find)
Ok it seems as if when I go to post a question on how to do something or how some function is ment to be used I end up figuring out to some degree how to Solve my problem. This post was orginally a Question on "How to get the Icon data for an abilitys button". But as I was asking it I started to realize what I was doing wrong. So I edited the post to explain what im doing now to grab this data. <sub>Sorry to any who have seen some of my other post where I ask a question then end up posting an answer to it a few mins later</sub>
Ok this post will show you how to find any ability Icon from any given unit type. Also I will provide the code from the triggers I have made as well.
I will be using Catalog Field Value Count and Catalog Field Value Get
Geting the number of Abilitys a Unit Type has and any given Ability of a Unit Type
So first we need to find out how many abilitys a unit type has and then get each one. So I created a Funtion that returns the number of abilitys a Unit Type has, then I created a Funtion that returns a single ability from a given index. You dont have to if you dont want but I did since this is code that will be repeated alot for the map im messing around with.
Heres the to Funtions
Using these two functions you can make a simple for each/while loop to get each ability.
The Unit Ability Count is pretty much as is. It will tell you the number of abilitys a given unit type has. So Marine will return 4
The Unit Ability function has more going on. If you look at the line with the Catalog Field Value Get, you will see Im combining strings to make a full string that points the the Ability Link we want.
What that is really sending is "AbilArray[AbilityIndex].Link" Example: Protoss Carrier Raw data View
So if we wanted the 6th ability icon "Warpable" we would do this...
Note that the AbilityIndex is not 6 its 5, the AbilArray (and as far as I know all arrays in galaxy are 0 based. Meaning they start at an index of 0) This also brings up the point that after u get the Count for Abilitys you have to remember that it will return an amount that is 1 more then the highest index value.
Ability Icons
Now you might have see one of the abilitys for the Carrier was
"##id##Hangar" anytime you see ##id##
that is a refence to that objects id (Unit, Abiltiy, Actor, etc). Which can be seen in the data editor when you view is set to show Raw dataThe reason I point that out is some abiltiys are different then others. The difference Im going to talk about has to do with where you fine there Button Icons. Abilitys have a Default Button Icon or Face for them. Most have this data located in an entry named CmdButtonArray, other abilitys have this Default Button Face located in InfoArray.
Ok this is where I have to admit I only know how to find the icon for the CmdButtonArray (I am still trying to get the Icon for abiltiys which use the InfoArray)Heres how you find the Default Button Face for MOST abilitys. First I will show you the code for the funtion I created that returns an Image variable for the Ability Icon using the CmdButtonArray.
So you can see we first find this DefaultButtonFace Value for the given Abiltiy, then we use that value to grab the value of the Icon for the abiltys DefaultButtonFace. I am sure you can use these functions to also grab other states for the buttons. I dont know how to do this and the map im working on does not (as far I know really need to do this)
A temp fix for Abilitys with InfoArrays
I have not found a way to get to the defualtbuttonface with the infoarray BUT you can link to the unit and it should return a string that is usable within the buttons catalog (I have seen some dont have the icons. I think the Broodling Icon is missing not sure thou)
Now to check if an ability has the InfoArry, as far as I can tell you have to just know for that ability type. I am just using an If Then Else action.
Ok I am still learning this so if anyone has any added info or commits feel free to post a reply. I will be trying to edit this to show how I am going to get the Icons for abilitys that store there DefaultButtonFace data in the InfoArray (and any other ones I find)