| 05-31-2006, 01:43 PM | #1 |
Is there any way of getting the ability linked to an item? Not during attack or anything, just the ability that is linked. |
| 05-31-2006, 01:51 PM | #2 |
Could you be a bit more specific? You are able to insert abilities on items, and use them like a healing potion or whatever. - Soultaker |
| 05-31-2006, 02:14 PM | #3 |
what im trying to do is this: -unit clicks on an ability and targets an item in inventory -the trageted item has an ability when used, and i want to be able to retrieve that ability the item uses via a trigger and store it. -the item is removed. -the ability the item used is added permantely to the unit |
| 05-31-2006, 02:33 PM | #4 |
You can use gamecache to set up some kind of database for it at map initialization, and then load from it, but there is no simple way of doing it. |
| 05-31-2006, 02:46 PM | #5 |
so that means that im going to have to initials every item and its used ability into my trigger code?? I have 129 items! |
| 05-31-2006, 03:35 PM | #6 |
Yes. Be happy that you don't have 5000. CnP'ing a line of code and changing something 129 times is not a big problem, it is annoying, yes, but it shouldn't take extremely long. |
| 05-31-2006, 04:08 PM | #7 |
Slightly Offtopic: It is time consuming, but something that would be even more time consuming is rearranging every thread on a board into alphabetical order without using a system, doing it by hand |
| 05-31-2006, 06:24 PM | #8 |
What I would do is make a function with all abilities hardwired into the map. That way you might be able to do this... JASS:function GetItemAbility takes item i returns integer if GetItemTypeId(i) = someId then //Replace someId with whatever your first item's ID is. return someAbilityRaw //Replace someAbilityRaw with the raw code for the ability attached to it. elseif ... //Continue as necessary. endfunction |
| 05-31-2006, 06:27 PM | #9 |
Storing in gamecache would be much more efficient. |
| 05-31-2006, 08:47 PM | #10 |
Slightly offtopic: The real troubles comes when you want to save your character. for what you are planning I would recommend not instituting a save load code, or institute it with only the hero level saving. |
| 06-01-2006, 02:52 PM | #12 |
If you have removed an item, the item no longer exists, so how could the game possibly get the name of it? Either show the message before you remove the item, or store the name in a variable. |
| 06-01-2006, 02:57 PM | #13 |
well, then my system wont work because i store the item in an array of items, so that when they de-assimilate, it can look at this array and restore the items. Could i set the item array[x] to the targeted item, and then remove item of type from unit? |
| 06-01-2006, 04:24 PM | #14 |
Here's what you can do. 1. When a unit picks up an item, create a dummy unit somewhere in the distant world. 2. Give a duplicate item to the dummy unit. 3. Make that dummy unit use the item on a dummy enemy unit. 4. If dummy unit casts an ability, set IAbility[0] = ability being cast (Use Ix function as the array) 5. When you need to get the ability of an item, refer to IAbility[]. |
