You could use three "main" variables. one for the shortest distance, one for the number of the vertices with the shortest distance annd one for the maximum of vertics which you can get by "ent_vertices(entity)".
The following code is just an idea:
Code:
var dist_pos[3];
function vertex_closest(dist_pos)
{
var i;
var shortest;
var ver_pos[3];
var ver_number; //number of the closest vertex
var max_vertex;
i = 1;
shortest = 500; //start distance
max_vertex = ent_vertices(my);
while(i <= max_vertex)
{
vec_for_vertex(ver_pos,my,i);
if(vec_dist(ver_pos,dist_pos) < shortest)
{
shortest = vec_dist(ver_pos,dist_pos);
ver_number = i;
}
wait(1);
}
return(ver_number); //return the number of the closest vertex
}
//Function calling:
function getshot_event()
{
if(event_type == event_shoot)
{
my.hitvertex = vertex_closest(target);
}
}
action example_act
{
my.enable_shoot = on;
my.event = getshot_event;
}