HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Clearing Gamecache of Unneeded Values

11-12-2007, 08:04 AM#1
Pyrogasm
I have a gamecache that will be storing each unit's current sight range. There is no function to get this, so I have made a few sight-range modifying functions that also enable the user to get the unit's current sight range.

Obviously, this information will need to be reset for each unit so that the game doesn't think units have a different sight range than they actually do. The problem is that I want to clean the values stored in the gamecache when they won't be needed anymore and I've no idea how to do it.

I thought of just detecting the "A unit dies" event and then just flushing the needed stuff then, but the problem of units being revived (through triggers or otherwise) arises. If the unit were to revive, the system wouldn't be able to determine the correct base value for the unit.

What's the best way to devise a cleanup method? And by this I mean to ask when should I clean these values? Upon unit death? With a timer after unit death?


Below is the code I have so far, the init is at the bottom.
Expand JASS:
Edit: To clarify, the Item Sight Range Bonus ability is bugged the same way that the Life/Mana bonus ones are, making a SetUnitMaxState-esque function a viable option.
11-12-2007, 08:56 AM#2
Toadcop
ok.
clean ONLY in the first NEW storing.
don't clean anything on death etc.
you will create a new unit. and you will set a custom sight range. AND before you do this clean it up. hmmm but in this case you don't need to clean up.
well it's your decision.
// this allows you to resurrect unit etc. and not to lose data. and the ~10-30 mbs of memory no one cares. blizz default need more memory. (i mean try to play a melee and see how many memory is used ^^)
11-12-2007, 08:59 AM#3
grim001
There is a "unit decays" event.
11-12-2007, 09:05 AM#4
Toadcop
grim001 it does suck due if unit doesnt have a decay animation it will be skipped (and trigger will be not triggered). + corpses may be revived ^^ (decay event launches on decay begin)
11-12-2007, 10:23 AM#5
Pyrogasm
Ah, I hadn't thought of what Toadcop suggested, and I'll just do that.
11-12-2007, 04:03 PM#6
Silvenon
Will you share this with others as well (when you finish it of course), because I love bug-based systems.
11-13-2007, 04:34 AM#7
Pyrogasm
Yes, I'm planning on releasing my so-called "Sight Range Utilities".
11-13-2007, 04:48 AM#8
Silvenon
Kewl, thanks.