| 02-11-2008, 02:48 AM | #1 |
Hey, im trying to store an integer in a unit but i can't use UnitPointValue because im already using it for something else, so i found this function SetUnitUserData() which takes an integer, the question is, can it be used to store an array index? a number betwen 1 and 1000 Thanks |
| 02-11-2008, 03:00 AM | #2 |
yes |
| 02-11-2008, 07:25 AM | #3 |
| 02-11-2008, 12:08 PM | #4 |
It is? |
| 02-11-2008, 12:16 PM | #5 |
Regarding PUI and set unit user data: You can use SetUnitUserData and GetUnitUserData for any positive integer. This means that it can also be used to store order's, ability rawcodes, and unit-type id's. The benefit of UnitUserData is that it is a very fast way to add a number to a unit. Therefore, many systems are based on UnitUserData (such as damage system, pathing systems, creep respawn systems, etc). Since you can only have 1 UnitUserData per unit, these systems will conflict with each other if implemented in the same map. PUI is an extension of UnitUserData, which gives all units a unique id number. Using PUI, systems which would normally require UnitUserData can stack together. IF they are rewritten to use PUI. |
| 02-11-2008, 03:33 PM | #6 |
Or you can just use systems which are well made so they don't conflict. UnitUserData is more useful when left to be used in individual maps for what the mapper wishes, IMO. |
| 02-11-2008, 04:52 PM | #7 | |
Quote:
![]() |
| 02-11-2008, 09:58 PM | #8 | |
In practice that would mean attaching with the use of ABC/HSAS/Handle Vars/CSCache/Direct Game Cache/etc. I'd wager pretty much on that this "GetUnitUserData-wrapper" + Array Lookup is faster than that. Quote:
IMO, only noobs (GUI people and such) benefit from having UserData untouched, since a good jasser just have to do myOwnUnitData[GetUnitIndex(myOwnUnit)]. |
| 02-12-2008, 12:33 AM | #9 |
UserData is perfect for your map's core system, any other system should be fine with H2I + array. If you were to use a wrapper you would just lose any speed benefit from GetUnitUserData. |
| 02-12-2008, 01:48 AM | #10 | |
Quote:
Bullshit and you know it. (that goes for you as well Griffen) EDIT: Actually you don't know it because you never used PUI. (doesn't make it any less bullshit) We already had this argument with same actors in "Little school of ABC" and if I remember correctly you people lost. Ok I get it you don't want to use PUI because you are in love with gamecache, guess what: I don't give a fuck. But don't go around telling people stuff that are misleading or just ain't true. Here is some for you: PUI fucks gamecache both in speed and in safety, deal with it. |
| 02-12-2008, 02:00 AM | #11 | |
Quote:
Case 1 - Map's core, let's say, maybe a physics engine which is probably the only system that actually needs you to attach stuff to units, it uses GetUnitUserData directly, no wrappers and that's as fast as possible. - Other systems: They use function + H2I + array lookup, that's not the fastest but all the cases in which they actually need to extract information from units does not really require great performance. (Seriously, even gamecache is fine for most of them) Case 2 - Map's core: Uses wrapper + array + array, slower. - Other systems: Use wrapper + array + array. -- So, least important systems get a boost consisting of the time difference between a function call and an array lookup, in exchange of it, the important system, that needs performance wins an extra function call... |
| 02-12-2008, 07:12 AM | #12 |
Arguing with Vex? Ouch......don't expect to win this one. |
| 02-12-2008, 10:34 AM | #13 | |
Quote:
|
| 02-12-2008, 11:51 AM | #14 | |
Quote:
That is under the assumption that you have a physics system that uses groups to store units. Guess what, I have a physics engine that uses arrays for that. And gamecache is fine for nothing except storing data between campaigns. You know I don't get you, you were all about how how attaching to timers is bad and how using arrays is better, and here you criticize the system that uses arrays instead of unit attaching. Besides my map pyramidal defence is the ultimate proof of my claims. It has physics engine, custom orb effect engine, extended inventory engine and a bunch of little smaller engines that all use PUI and all work without lag. There are also other maps out there that also use PUI, some of them very popular like Elemental TD. So in practice I have shown that it works. Your theories are well... just theories. Your preference of gamecache is your personal stuff. So keep your personal preferences to yourself, it is not your job to tell people what to use or how to use it, not even when it comes to jasshelper. |
| 02-12-2008, 07:20 PM | #15 |
Wth....??? Will you shut the hell up cohadar?? He knows everything there is to know about WE, he obviously knows what he's talking about!! You're not even one tenth of him! All he's done for us and now you're flaming (well, you can hardly hold yourself from flaming him). I've seen many of your posts and non of them were nice, really NONE OF THEM!! You're always calling people noobs, idiots, morons and always criticizing everything! What?? Is that cohadar giving somebody a compliment?? NOT IN THIS UNIVERSE!! It seems like proving that you're right is more important to you than living. I bet that you would kill yourself if you were wrong (when you lose an argument, you mostly deal with it like: "Oh, I didn't read the post carefully" or "I thought you meant something else". That's getting kinda old you know. P.S. You should really stop swearing, believe it or not, it doesn't make you sound smarter |
