| 06-05-2006, 07:37 AM | #1 |
JASS:function H2I takes handle h returns integer return h return 0 endfunction function I2Unit takes integer i returns unit return i return null endfunction function GameCache takes nothing returns gamecache if (udg_gamecache==null) then call FlushGameCache(InitGameCache("gc.dat")) set udg_gamecache=InitGameCache("gc.dat") endif return udg_gamecache endfunction function Trig_Selected_Actions takes nothing returns nothing call StoreInteger(GameCache(),"Selected",GetHeroProperName(GetEnteringUnit()), H2I(GetEnteringUnit())) function InitTrig_Selected takes nothing returns nothing set gg_trg_Selected = CreateTrigger( ) call TriggerRegisterEnterRectSimple( gg_trg_Selected, GetPlayableMapRect() ) call TriggerAddAction( gg_trg_Selected, function Trig_Selected_Actions ) endfunction And getting a "selected" hero which is called John would be: JASS:local unit john = I2Unit(GetStoredInteger(GameCache(),"Selected","John") Or not? ...>> Does not work for me... |
| 06-05-2006, 10:52 AM | #2 |
Make sure that the proper name actually returns the correct string. And not like it matters, but the correct extension for gamecache is .w3v and not .dat. |
| 06-05-2006, 12:03 PM | #3 |
I'm 100% sure the returned string is correct...are you sure my code is not wrong and all? >_<, to be more exact, I tried to retrieve the stored unit in a trigger event: JASS:call TriggerRegisterUnitInRangeSimple (trigger, 200.00, I2Unit(GetStoredInteger(GameCache(),"Selected","John") |
| 06-05-2006, 12:36 PM | #4 |
Sometimes you have to save a value typecasted with return bug in a variable before using it, else it sometimes does not work. So try saving it in a variable and then use it with the trigger event. |
| 06-05-2006, 12:46 PM | #5 |
JASS:local unit john = I2Unit(GetStoredInteger(game_cache(),"Selected","John")) set gg_trg_john = CreateTrigger( ) call TriggerRegisterUnitInRangeSimple( gg_trg_john, 600.00, john) Hmm, this wouldn't work, or did I missunderstand you? |
| 06-05-2006, 01:38 PM | #6 |
Make sure you actualy store the integer to gamecache before attempting to retrieve it. |
| 06-05-2006, 02:53 PM | #7 |
Through some tests i came to the conclusion that it does have something to do with "retrieving before actually storing"... Now the question is: How could I handle this problem? I tried creating a timer at initialization, enabling the "trigger retrieving the stored unit" 10 secs after the map started...no use... BTW: I am actually still very green to how "enabling" or "executing" triggers works, what do I have to pay attention on? Do I have to "enable" a trigger in the trigger editor or make it "initially off"? |
| 06-05-2006, 10:26 PM | #8 |
BumP*...>< |
