08-14-2013, 08:19 PM
C-Code:
//assuming this will be an ego function to have 'normal' acting - otherwise you have to control all actions int ego(){ int xdistance = (self.x-target.x)*(2*(self.facing?1:0)-1); if(self.mp < 100) { //target = get_closest_enemy(); //this one won't work as target isn't defined on it's own in any way //you need to use the loadTarget(object.num as integer) function: loadTarget(get_closest_enemy()); //your get_closest_enemy() function will need to cycle through all 400 objects, check their distance to self //and return the object number of the closest one if(xdistance > 100) { if(self.x-target.x > 0) { run_left(); } else run_right(); } //left(1,0) and right(1,0) will do to make the character run - the script will need to run past this twice of course return 1; //this will make the games id() function return control to your ego() function unless it's got an item to pick or a downed opponent to run away from etc } //else act_normally(); return 0; //this will return control to the games id() function to do as it pleases } |
favorite dcing techniques: wpoint | double key inputs | holding back | alternate basic moves