title: Using the agent's methods on events
body: <p>Im using anylogic in order to build a model of randomly moving cars.
  In that model i want to gather some information on the agents (Cars) using a varivable and an event block. </p>
  
  <p>On the model i want the <em>event</em> to set the variable <em>carsLane</em> with the lane of the car that is currently on the road and to do so every 2 seconds. </p>
  
  <p>The thing is that every time the event is suppose to take place i get "<strong>NullpointerException</strong>" error and it happen so on every method of <em>Car</em> that im trying to use using the Event.</p>
  
  <p>The event is on the Main tab and the code im using on the action box:
  <code>carsLane=Car.getLaneIndex();</code></p>
  
  <p><a href="https://i.stack.imgur.com/y1t71.jpg" rel="nofollow noreferrer">On the image you can see the formation of the blocks and the code on the event's action box</a></p>
  
  <p>Am i using the <em>event</em> wrong or is it something else?</p>
  
  <p>Thank you for any kind of help.</p>