All the example data is from hovering over the code in chooseAction()
array[
{
id: Ogre Peasant M,
pos: [object Object],
targetPos: [object Object],
team: ogres,
type: peon
}
]
I am grabbing array[0].targetPos and storing it into a var targetpos.
targetpos: Object {
x: 7.622114134719595,
y: 28.490717974491417,
magnitude: <function>,
heading: <function>,
distance: <function>,
dot: <function>,
equals: <function>,
copy: <function>,
distanceSquared: <function>
}
If I add any line after:
var targetpos = array[0].targetPos;
such as:
base.say(targetpos.x);
it gives an error:
cannot read property 'x' of null
This also occurs if I use the original array[0].targetPos.x as well