So, When a unit picks up an item, the items name is stored in a string and saved for later, with this I can pull tooltips, images, the item name ect. with a library. But I cannot figure out how to pull ability information, there's a get unit from string function but it doesn't play well with show/hide abilities. My last resort would be to create an invisible unit that stores these items for use but I don't want to use it if I don't have to, any ideas?
I had some issues with this myself trying to get a weapon equip system working, I ended up figuring something out using the library and some custom scripts. I think UnitGetType(itemName) might be what you are looking for.
Edit: To be more specific, I had the item and behavior names exactly the same, so I could call the item's string name using UnitGetType(itemName), then call that behavior to give unit the weapon I wanted. Imagine you can do the exact same thing with an ability.
The problem is that I don't have that function, I have all except that... quick question, maybe im missing the obvious, but where is "all units" or "all units in region" for pick each unit?
I saw a pick each unit in Units in Region Matching Condition function under pick each unit, might be a better starting point if you only wanting to do this in a specific region, I'm thinking that more details may be needed though. What exactly are you trying to make happen?
Edit: Was looking over the Unit: Abilities section of the library, it could see what abilities they have, but not sure you will be happy with how it works. It can count number of abilities, and check what abilities they have returning booleans true/false, but you would have to go through a list of abilities that specific unit might have in order to see if they have them or not, same for enabled, that sort of thing.
I just want to pick all units, thats it, problem is, the constant disappears for the pick each unit function
Hrmmmm, I'm not seeing a good way to go about that, it might work better to make a global unit group and then add the units as they are created to said group, as it is pretty easy to pick each unit in a unit group.
Edit: There is a Units in Region Matching Condition unit group, that might be a better option.
Edit 2: Yea that might be just the thing, try:
Pick each unit in (Any units in (RegionName) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
You can't get an ability with a string. I spent a lot of time trying to do this earlier, and the function just isn't there. I have never used items in the editor, but the way I eventually got around my problem was to create a long If Then Else-If function that checks for something (in my case it was an Ability for Triggering Command), then recalls a specific ability that the item is related to.
So, what exactly do you need? I did read the posts, the first one a couple of times, but I am still not really sure, what you are asking.
From the title, I would assume, that you want a function, which transforms a variable from type Game Link: Ability to string (or maybe from Ability Command)? Or do you want to get all abilities of some unit? Or check, if a unit has a specific ability? Or additional information of the ability, when you have the string? I am confused.
If it is Game Link to String, I recommend using Custom Script. Internally, most Game Link variables are strings already, so you can just create a function, which takes the game link and returns it as string in one line of custom script.
You must login to post a comment. Don't have an account? Register to get one!