| 12-07-2007, 05:52 AM | #1 |
well im trying to do something like this JASS:function GetUnitIconPath takes unit u returns string .... endfunction well all i want is to get a unit's display icon path from the unit for displaying in multiboard. Is this possible? or is there any native for this? |
| 12-07-2007, 05:58 AM | #2 |
No native. The only way would to be use a global array with pre-stored values or just a big if/then/else block. |
| 12-07-2007, 06:04 AM | #3 |
Oh crap, guess I need to do the hard way out... thanks anyway >_< |
| 12-07-2007, 06:05 AM | #4 |
Or game-cache. This is the thing GC is perfect for. stored info that doesn't have to be retrieved every 0.01 seconds. |
| 12-07-2007, 08:19 AM | #5 |
JASS:Storing.. set somestringarray[someinteger] = "youricon" call SetUnitUserData(yourunit,someinteger) Retrieving.. function GetUnitIcon takes unit u returns string return somestringarray[GetUnitUserData(u)] endfunction You could also use a UserData-extending system, like PUI or mine. Here's mine:library Tags struct Tag integer array Slot[16] //Array size can be changed. static method Create takes unit from returns Tag local Tag t = Tag.allocate() call SetUnitUserData(from,t) return t endmethod static method Get takes unit from returns Tag local Tag t = Tag(GetUnitUserData(from)) if integer(t) == 0 then set t = Tag.Create(from) endif return t endmethod endstruct endlibrary Usage function Wtf takes nothing returns nothing local unit u = GetTriggerUnit() -- Either this-- local Tag t = Tag.Create(u) -- Or this one-- local Tag t = Tag.Get(u) Do something with the slots, like: set t.Slot[5] = 0 endfunction It was meant for storing multiple structs, and I happen to do so with alot of systems in my map. |
| 12-07-2007, 02:53 PM | #6 |
yes i understand, (due to the fact im lazy) i was searching for some method that don't need to pre-store the stuff and retrive it, and it seems the answer is a no lol, thanks for all who helped :) |
