I needed to edit quickly zones (or regions) in WED. The idea is to trigger events when an entity get in a specific zone.
With the path editor, it's easy to draw polygons:


And here is a lite-c code that returns 1 if the entity is under the polygon, (0 if it's outside)
Code:
action testPoly()
{
	var aResult;
	
	aResult = inPoly(me, "path_000");
	
	printf("Result : %1d", (int) aResult);
	sys_exit("bye bye...");
}

//////////////////////////////////////////////////////////////////////////////////////																
//                                                                                  
//	  Function to detect if an Entity is under a polygon delimited by a closed path  
//                                                                                  
//	  Param 1 : ENTITY* aEntity	                                                   
//	  Param 2 : char* aPath                                                          
//                                                                                  
//	  Example : inPoly(me, "path_000");                                              
//                                                                                  
//////////////////////////////////////////////////////////////////////////////////////
var inPoly(ENTITY* aEntity, char* aPath)
{
	var 		i = 2, err = 0;
	var 		locCumulAngle = 0;
	ANGLE 	locAngle;

	var 		locVarAngle = 0, locDirectionFirstNode ;

	VECTOR 	locVecNode;
	
	err = path_set(aEntity, aPath);	// if err == 0  : something is wrong (aEntity or aPath)
	if (err < 3) return 0;	        // 3 nodes is the minimum for a polygon
	
	err = path_getnode(aEntity, 1, locVecNode.x, NULL);	// if err == 0  : error getting node info
	vec_sub(locVecNode.x,aEntity.x);	     // this is the vector from aEntity to node 1
	
	vec_to_angle(locAngle.pan,locVecNode.x);     // the first node direction
	locVarAngle = locAngle.pan;											
	locDirectionFirstNode = locVarAngle;	     // first node direction is stored for end use
	
	err = path_getnode(aEntity, i, locVecNode.x, NULL);
	while ( err > 0 )
	{
		vec_sub(locVecNode.x,aEntity.x);
		
		vec_to_angle(locAngle.pan,locVecNode.x);
		
		locCumulAngle += ang(locVarAngle - locAngle.pan);
		
		locVarAngle = locAngle.pan;
		
		i++;
		err = path_getnode(aEntity, i, locVecNode.x, NULL);		
		
	}
	
	locCumulAngle += ang(locVarAngle - locDirectionFirstNode);
	
	return ( abs(locCumulAngle) > 1 );
}


I hope this code will give ideas... smile


Commercial A7.25b
RUGod