
Originally Posted by
Loveboy
trace is undefined

The function Kung posted is from maps\mp\_utility.gsc. It is used as part of the getPlant() function. If you do what serthy suggested, you can use the getPlant() function to find the normals of a map and spawn your turret base at the origin returned by getPlant():
Code:
plant = self maps\mp\_utility::getPlant();
turret = spawn( "script_model", plant.origin );
turret.angles = plant.angles;
Your problem then is getting the turret head/barrel to align with the turret base. In COD4, you can do that by finding the origin of the base by a tag name - for example "j_pivot":
Code:
plant = self maps\mp\_utility::getPlant();
self.turret_base = spawn( "script_model", plant.origin );
self.turret_base.angles = plant.angles;
self.turret_barrel = spawn( "script_model", self.turret_base getTagOrigin( "j_pivot" ) );
self.turret_barrel.angles = self.turret_base.angles;
But COD2 does not support getTagOrigin(). So, your problem then is to match the orign and angles of your turret barrel with that of the turret base.
WARNIG: getPlant() often spawns models below the map surface texture (the "noramal") and often at funny angles.