Adding to Frikbot

Discuss Artificial Intelligence and Bot programming.
Post Reply
Ghost_Fang
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Adding to Frikbot

Post by Ghost_Fang »

Hello everyone, its been a long time. I have a few questions about adding a few things to Frikbot. Now AI is not my thing, for some reason i STILL cant grasp it, not even quake's simple AI. So imagine my face whilst trying to add a few small things onto frikbot (hint: that was my face => :shock: ) I would like someone to tell me how I would add:

•If the player has become incapacitated other player have the option of helping the player up as seen in Left 4 Dead and CoD: Nazi Zombies. I do this by using a universal "use" command, and if the trace_ent.classname == "player" and trace_ent.capenabled == 1 is true, help the player up. I would like to know how add that into the bots AI as a semi-important priority maybe "thisp" 70ish.

•Second, as seen in left 4 dead, i have pills as well as medkits, i would like to know where i would put "if my health is this low, and i have pills use them" or if my health is even lower and i have a medkit, use it. (medkits and pills are simply "weapons")

•Thirdly, almost combining 1 and 2, i also have it so you can give the pilsl to other players and heal other players, as seen in left 4 dead, using the same use command, if your current weapon = pills or medkit give the player pills or heal them. I'm sure 1 and/or 2 would be preliminaries for adding this feature, but i would like the bot to know when the player or other frikbots are low on health and they would donate their pills or medkit to the others in need.

EDIT: •Fourthly as seen in left 4 dead, the player doesnt die right away the first 2 times, they get incapacitated. Here is the code (player's th_die = PlayerIncap(); btw):


Code: Select all

void() PlayerIncapped =
{
if (self.captimer == 2)
	{
	PlayerDie();
	return;
	}

if (self.capenabled == 1)
	{
	PlayerDie();
	return;
	}
	
	centerprint(self, "You are incapacitated!");
	self.health = 200;
	self.view_ofs = '0 0 -8';
	self.punchangle_x = 0;
	self.punchangle_y = 0;
	self.punchangle_z = 0;
	self.weapon = IT_SHOTGUN; 				//switch to pistol when you fall down
	W_SetCurrentAmmo ();
	self.takedamage = DAMAGE_AIM;
	self.deadflag = DEAD_NO;
	self.solid = SOLID_SLIDEBOX;
	self.movetype = MOVETYPE_TOSS;
	self.capenabled = 1;
	stuffcmd (self, "incapped ");
	stuffcmd (self, ftos(self.capenabled));
	stuffcmd (self, " \n");
	self.captimer = self.captimer + 1;
	self.getuptime = time + 10;
	self.hurtme = time + 1;
	self.bleeding = 1;
	return;


};

void() IncapAnims =
{
	if (self.frame >= 272)
	{
		self.frame = 292;
		PlayerIncapped();
		player_run();
		return;
	}
	self.frame = self.frame + 1;
	self.think = IncapAnims;
	self.nextthink = time + 0.03;
};

void() PlayerIncap =
{
	if (self.captimer == 2)
		{
		PlayerDie();
		return;
		}
	else
	{	
		if (self.flags & FL_ONGROUND)
			self.movetype = MOVETYPE_NONE;
		bprint (self.netname);
		bprint (" is Incapacitated!\n");
		self.walkframe = 0;
		self.frame = 259;
		self.attack_finished = time + 0.49;
		IncapAnims();
		return;
	}
};


You can still shoot while incapped, but for some reason frikbots, think they can't what would i have to change in my code or frikbots so they know its still OK to shoot enemies?


I hope i could get some help on at least one of these.
And its good to be back :D
And thanks in advance - Ghost Fang
Post Reply