// Redesinged script copied from AlienKiller by Yenz // This code almost entirely copied from the AlienKiller script // made by Yenz. I wanted to make a simple cyborg script where // a bot is manually piloted, but has precision aiming. Just run // this script instead of hitting the fire button and the bot // will aim and fire once at the closest alien in front of it. // // Now rewritten to include both pitch and roll correction // Reports warnings for temperature, shield and energy levels // in percentages. extern void object::RoboAim2() { object alien; float angle; int alienList[], nr; nr = 0; alienList[nr++] = AlienWasp; alienList[nr++] = AlienAnt; alienList[nr++] = AlienSpider; alienList[nr++] = AlienWorm; alienList[nr++] = AlienEgg; alien = radar(alienList,0,90,0,45); if(alien != null) //if there still is a alien left { if(distance(position, alien.position) < 45) { turn(direction(alien.position)); //coarse turn adjustment; angle = atan(((topo(alien.position)+alien.altitude)-(topo(position)+altitude))/distance2d(position, alien.position)); //determine absolute aiming angle // calulate and turn to adjust for roll angle if(roll < 0) turn((angle-pitch)*cos(roll)*cos(90-roll)); else turn(-((angle-pitch)*cos(roll)*cos(90-roll))); aim(angle-pitch); //aim at the target fire(0.1); //kill it } } else message("No target"); if(temperature > 0.8) message("Engines at " + (temperature * 100) + "%"); if(shieldLevel < 0.2) message("Warning-Shield at " + (shieldLevel * 100) + "%"); if(energyCell.energyLevel < 0.2) message("Warning-Energy at " + (energyCell.energyLevel * 100) + "%"); }