EdgeOfChaos
E
EdgeOfChaos
Me and another coder have a disagreement about how to use variables, and want your opinion on the hive.
The other coder thinks it's not safe to use the same variable in more than one trigger (like temp variables) and you should make new variables for everything. For example, if you're going to make two locations and then nullify them in two triggers:
Set MyLoc1 = Position of Casting Unit
....Actions
call RemoveLocation(udg_MyLoc1)
Set MyLoc2 = Position of Triggering Unit
....Actions
call RemoveLocation(udg_MyLoc2)
I think it's better to use the same variable if you will set and then remove it immediately.
Set TempPoint = Position of Casting Unit
....Actions
call RemoveLocation(udg_TempPoint)
Set TempPoint = Position of Triggering Unit
....Actions
call RemoveLocation(udg_TempPoint)
Which is a better method, and which is safer to do? And why?
The other coder thinks it's not safe to use the same variable in more than one trigger (like temp variables) and you should make new variables for everything. For example, if you're going to make two locations and then nullify them in two triggers:
Set MyLoc1 = Position of Casting Unit
....Actions
call RemoveLocation(udg_MyLoc1)
Set MyLoc2 = Position of Triggering Unit
....Actions
call RemoveLocation(udg_MyLoc2)
I think it's better to use the same variable if you will set and then remove it immediately.
Set TempPoint = Position of Casting Unit
....Actions
call RemoveLocation(udg_TempPoint)
Set TempPoint = Position of Triggering Unit
....Actions
call RemoveLocation(udg_TempPoint)
Which is a better method, and which is safer to do? And why?