HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Storing unit values in gamecache

10-03-2004, 08:12 PM#1
-={tWiStÄr}=-
Im just starting to understand game caches with return bug etc, stroring values under units. so i saw a use for it. so i got to work. i was using it to get the "Player" as it was stored in the gamecahse, of a dying unit. its not the dying units owner, tho, its the player controlling it. its sort of confusing, ill just show u triggers
call SetHandleInt(udg_PlayerHero[GetConvertedPlayerId(GetTriggerPlayer())], "Player", GetPlayerId(GetTriggerPlayer()))
local integer i = GetHandleInt(GetDyingUnit(), "Player")
u see, the owner of udg_PlayerHero[...] was changed, then the actual unit was changed, but i wanted to remember what the original units owner was later on (YES! i realize i could use a var and i will if this cant be solved, but 1 less var sounds good right about now) so i stored the PlayerId of triggering player (its the right player) under the unit that will later die, under the catagory "Player" or original owner. then when i recovered it, i looked under GetDyingUnit() which in the new trigger is equivalent to udg_PlayerHero[...]. im assuming that since their equivalent thier integer values will be the same after H2I. I'm also assuming that it will work since the unit is dead..

edit: i got it too work, everything i did was right, the prob was as stupid as it gets.. i forgot an = sign in the return value. but vars wouldnt work because i store units in arrays under thier owner, but that wouldnt work because no unit would have the right owner cause it was switched.
*gives self pat on back* I USED THE RETURN BUG FOR THE FIRST TIME!
+