Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple things.
#4
    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
}
Reply
Thanks given by: Gad


Messages In This Thread
Simple things. - by Gad - 08-13-2013, 11:17 PM
RE: Simple things. - by YinYin - 08-14-2013, 06:36 AM
RE: Simple things. - by Gad - 08-14-2013, 08:02 PM
RE: Simple things. - by YinYin - 08-14-2013, 08:19 PM
RE: Simple things. - by Gad - 08-14-2013, 08:37 PM
RE: Simple things. - by YinYin - 08-15-2013, 04:38 AM
RE: Simple things. - by Gad - 08-15-2013, 09:49 AM
RE: Simple things. - by YinYin - 08-15-2013, 04:10 PM
RE: Simple things. - by Silverthorn - 08-15-2013, 01:31 PM
RE: Simple things. - by Gad - 08-16-2013, 12:58 PM
RE: Simple things. - by Azriel - 08-16-2013, 01:11 PM
RE: Simple things. - by Silverthorn - 08-16-2013, 01:22 PM
RE: Simple things. - by Gad - 08-16-2013, 02:37 PM



Users browsing this thread: 1 Guest(s)