Moderator
M
Moderator
12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.
00:51, 25th Oct 2012
Magtheridon96:
Note: I have updated the review.
IcemanBo: Too long as NeedsFix. Rejected.
00:51, 25th Oct 2012
Magtheridon96:
- The modification of custom values is totally bad. Custom values are global data for a unit, meaning that if a user implements this system into his map, he can never use custom values for anything, or use any other resource that uses custom values. This is why people use UnitIndexers. UnitIndexers assign unique indexes for units and store them as the custom value so you can use that index for data storage in arrays. Check out Bribe's GUI UnitIndexer. It will set the custom values of units to unique ids so that you can attach data to a unit. Unit Indexers are the ONLY resources allowed to modify the custom value of a unit.
- Simply increasing an index by 1 in order to assign a unique id isn't good because of the array index limit. In order to pull of good indexing, you should probably take a look at Hanky's Dynamic Indexing Template.
-
You can get rid of this:
Custom script: set udg_KB_Picked_Unit = FirstOfGroup(udg_HM_KBPick)
And just use (Picked unit). Apparently, you were initially getting a random unit from a group that you were iterating over. If you're iterating over a group, you're going to run code for every single unit in this group. If you want to do this for only one unit in the group, you shouldn't be picking, you should just be setting the unit variable using the line of code I gave you and then using it as a random unit from the group.
Actually, I see your mistake now. Get rid of the "Pick every unit in ()" line, and just set the KB_Picked_Unit variable to FirstOfGroup(udg_HM_KBPick), then do the actions you were doing inside the group loop to this unit. Currently, it appears that your code is looping over the group and doing actions for the same unit depending on how many units are in the HM_KBPick group.
Note: I have updated the review.