| 11-04-2007, 10:01 PM | #1 |
i wanna link unit to trigger with game cache, so i did. but then there are no GetStoredUnit ... Only restore unit, but wont this restore native create a new unit? if so then tats lame... |
| 11-04-2007, 10:05 PM | #2 |
StoreUnit stores... the unit. Not a pointer to the unit. |
| 11-04-2007, 10:06 PM | #3 |
When will you people learn that gamecache sux balls. The ONLY place you should be using gamecache is to make save/load code. |
| 11-04-2007, 10:11 PM | #4 |
I still can't think of a better string hashing alternative. |
| 11-04-2007, 10:16 PM | #5 |
What is string hashing? Or to express myself better: why would anyone need that? |
| 11-04-2007, 10:57 PM | #6 | |
Quote:
You'll have to make the GetStoredUnit function yourself... Here is the one i use: JASS:function I2U takes integer i returns unit return i return 0 endfunction Just remember when storing the unit... store it as an integer using H2I (<unit>). This function should go in the map header. --- Here is a simple example: JASS://=========================================================================== Goes in map header function H2I takes handle h returns integer return h return 0 endfunction function I2U takes integer i returns unit return i return null endfunction function gc takes nothing returns gamecache return InitGameCache( "whatever.w3v") endfunction //=========================================================================== End of header function whatever takes nothing returns nothing local integer i = GetStoredInteger( gc(), "whatever", "whatever") local unit u = I2U( i) call DisplayTextToForce( GetPlayersAll(), GetUnitName( u)) endfunction function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing local unit u = CreateUnit( Player(0), 'uaco', 0, 0, 0) call StoreInteger( gc(), "whatever", "whatever", H2I( u)) call whatever() endfunction function InitTrig_Untitled_Trigger_001 takes nothing returns nothing .... endfunction Not a very good example to display the powerful capabilities of the gamecache. The gamecache capabilities becomes apparent, if not valuable, for ForGroup, ForForce, boolexpr, code, and countless other instances - since those function has to take nothing. I like the gamecache since i can assign a name for a handle. I can also store multiple different handle into the a single cache i.e. a unit, a timer, a unitstate. |
| 11-05-2007, 12:36 AM | #7 |
well game cache sux then :P cus i dont wanna use I2H, tat is just not safe. So i will use array to check instead. i blame Anitarf for telling me to use GC, cus he said i dont need I2H for this kind of linking... but seems like i do. Damn time wasted :P Vex u got msn? i need u to be the law book of jass when i have question. I promise i wont disturb u alot |
| 11-05-2007, 06:30 AM | #8 | |
Quote:
be scared Vex, be scared.... |
| 11-05-2007, 03:42 PM | #9 |
You don't need I2H. Ever. If you do, find another way. EDIT: Even using GC. GC ain't too bad for attaching structs to stuff. |
| 11-05-2007, 05:30 PM | #10 |
ye attaching struct solved it. How dumb i must be to not think of that :P All problems solved then :) rep to anitarf :P |
| 11-06-2007, 02:50 AM | #11 | |
Quote:
|
| 11-06-2007, 07:42 AM | #12 | |
Quote:
...and if you used ABC you would not have to be dumb because you would be attaching structs by default :P |
| 11-06-2007, 08:19 AM | #13 |
Your hate for gamecache is ridiculous. I'm starting to think you just say those things to make yourself look like a pro. Sure being slow is kind of bad, but why the hell would anyone need things to be done faster than the speed of light. If it lags, then get an effing new pc. If you're worried about there only being up to 30 bouncing balls for a good pc, then that's because the game itself wasn't made for those shit. This is an RTS not an FPS. It's like trying to make a house with clay. |
| 11-06-2007, 08:45 AM | #14 |
LoooL being faster is the least important on the list of reasons ABC is better than gamecache. Try and read the ABC thread mmkaaay. And if ABC is making a house with clay, gamecache is making a house with horseshit. |
| 11-06-2007, 08:48 PM | #15 | |
There is no faster alternative to gamecache when it comes to mapping strings to values. Quote:
What are the other advantages? It seems to me speed is the only reason someone would go for ABC instead of gamecache. |
