Please give this a try...
#target photoshop
main();
function main(){
if(!documents.length) return;
var Name = app.activeDocument.name.replace(/\.[^\.]+$/, '');
Name = Name.replace(/\d+$/,'');
Name = Name.replace(/_$/,'');
try{
var savePath = activeDocument.path;
}catch(e){
alert("You must save this document first!");
}
var fileList= savePath.getFiles(Name +"*.tga").sort().reverse();
var Suffix = 0;
if(fileList.length){
Suffix = Number(fileList[0].name.replace(/\.[^\.]+$/, '').match(/\d+$/));
}
Suffix= zeroPad(Suffix + 1, 3);
var saveFile = File(savePath + "/" + Name + "_" + Suffix + ".tga");
saveTarga32(saveFile);
}
function zeroPad(n, s) {
n = n.toString();
while (n.length < s) n = '0' + n;
return n;
};
function saveTarga32(saveFile){
targaSaveOptions = new TargaSaveOptions();
targaSaveOptions.alphaChannels = true;
targaSaveOptions.resolution = TargaBitsPerPixels.THIRTYTWO;
activeDocument.saveAs(File(saveFile), targaSaveOptions, true, Extension.LOWERCASE);
};