View Single Post
Aaron
Senior Member
 
Join Date: Oct 2011
Posts: 6,793

Old December 6th, 2017, 12:49 PM
Quote:
Originally Posted by Minous View Post
It looks right, but I haven't tested it. I also wouldn't use abValue for basic variable usage.

I would do something like:
Code:
var int_bonus as number
int_bonus = hero.child[aINT].field[aBonus].value
foreach pick in hero where wCategory.Firearm
       eachpick.field[dmrBonus].value += int_bonus 
nexteach
I will also note that the fields you are using may or may not be correct, I dont have HL handy to confirm.
In my opinion, its always much better to store a value used in a field than in a variable. Fields can be manipulated from the outside, while variables can't. For the same reason it's also best practices to split your eval scripts so that the first sets values, and the second uses those values, with some time in between in case something needs to intervene.
Aaron is offline   #6 Reply With Quote