To store an events ID, have it run the code:
CODE
$game_variables[2] = @event_id
And to get the terrain of a particular position, have a event run the code:
CODE
$game_variables[3] =
$game_map.terrain_tag(0, 0)
where (0, 0) is the x & y coordinate of the point of interest.