| 03-09-2007, 12:38 PM | #1 |
well, i tried to search for this problem, but i didnt get any pleasant results. So i just opened another thread going to bore you ^^ So, i have a problem, you can store integers, reals and so on in gamecache, but why cant i store units? i cant refer to "GetStoredUnit", this isnt marked as a function, so what shall i type instead? or is there a trick? i would like to thank everybody helping me, anX |
| 03-09-2007, 12:53 PM | #2 |
You can use H2I and then u save this integer in the gamecache. JASS:function H2I takes handle h returns integer return h return 0 endfunction JASS:function I2Unit takes integer i returns unit return i return null endfunction e: Hey anx^^ |
| 03-09-2007, 12:57 PM | #3 |
Code:
function I2Unit takes integer i returns unit
return i
return null
endfunctionWhy I2Unit and not I2U? |
| 03-09-2007, 12:59 PM | #4 |
Hmm i dont know. You can name your function also to "bla" or what ever you want. |
| 03-09-2007, 01:00 PM | #5 |
because names are unimportant^^ no but as i told u, use handle vars! they do the same what you want, but take the work of you.. |
| 03-09-2007, 01:01 PM | #6 |
Yeah or any other "ReturnCache". |
| 03-09-2007, 01:06 PM | #7 |
You must use the "Return Bug". There are a LOT of articles about this "bug" (look at this and this). Basically you don't need to store a unit, but an integer which is a sort of "pointer" to that unit: JASS:function H2I takes handle h returns integer return h return 0 endfunction Units (just like locations, groups, points etc...) are "handles" and, using the function above, you can obtain an integer which is a sort of a pointer to that handle. To get your stored unit again you will need a function like I2Unit, converting your integer in your unit again. It is better that you read the articles. I hope it helped. Cheers. |
| 03-10-2007, 07:38 AM | #8 |
Also however i dont recomend using the game cache if at all possible because it can cause problems with memory leaks... |
