The buildings in my map have a lot, important custom values that tie into player income (not really affecting the unit itself). I wished there was a better way of displaying these custom values. Soon after, I looked into using attributes as a substitute.
These attributes would be changed very constantly and would range from negatives to positives in the millions (but less than 5 million)
My question is: Are attributes less laggy that custom unit values when used for this purpose?
Could you be more precise as to what you mean by custom unit values? Sure you cannot remove some decimal places? In order to have the attributes you would need buff stacks and those becomes laggy at over 40k. Using triggers to do all the calculations as variables and use text tags is probably the easiest solution. Alternatively you could use Text actors and use actor messages to change what they say.
You could use an 'Attribute' behavior and no more than 24 'Buff' behaviors if you do some decimal->binary conversion. The problem with attribute behaviors is that you can't easily get their value. In triggers you can only read the value when it changes (using the 'Unit Attribute Change' event and 'Triggering Attribute Points' function).
The buildings in my map have a lot, important custom values that tie into player income (not really affecting the unit itself). I wished there was a better way of displaying these custom values. Soon after, I looked into using attributes as a substitute.
These attributes would be changed very constantly and would range from negatives to positives in the millions (but less than 5 million)
My question is: Are attributes less laggy that custom unit values when used for this purpose?
Could you be more precise as to what you mean by custom unit values? Sure you cannot remove some decimal places? In order to have the attributes you would need buff stacks and those becomes laggy at over 40k. Using triggers to do all the calculations as variables and use text tags is probably the easiest solution. Alternatively you could use Text actors and use actor messages to change what they say.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
You could use an 'Attribute' behavior and no more than 24 'Buff' behaviors if you do some decimal->binary conversion. The problem with attribute behaviors is that you can't easily get their value. In triggers you can only read the value when it changes (using the 'Unit Attribute Change' event and 'Triggering Attribute Points' function).
Thanks guys, I think I'll stick with custom values and text tags then
You could also unit charges (trigger action AddChargeForUnit). They're like custom values except they use a string key instead of an integer index.
Pros
* You can have more than 32 kinds
Cons
* Only positive values can be used, so you'd have to store SomeAttributePositive and SomeAttributeNegative and sum them
@PirateArcade | I make games | Ask me things on Discord