Page 2 of 2

Posted: Sun Oct 26, 2003 2:05 am
by BiG_HeaD
any

Posted: Mon Oct 27, 2003 6:12 pm
by vonderbakluft
Example of an AI healing the player (or another AI). You can allmost rip it from the friendly.scr script, with some adustments as done here.
self = the healing one, local.ent = the one to heal

Code: Select all

heal local.ent:
	if (isalive local.ent)
	{

					self.no_idle = 0

			self.movedoneradius = 100
			self runto local.ent
			self waittill movedone

			self exec global/stand.scr

			if (isalive local.ent)
			{
				local.vec = vector_length (self.origin - local.ent.origin)
				if (local.vec < 140)
				{
					self nodamage
					self.avoidplayer = 0
//					self.no_idle = 1
					self upperanim pass_canteen_start
					self waittill upperanimdone

					local.ent heal 0.5
					self playsound med_kit

					self upperanim pass_canteen_end
					self waittill upperanimdone

					self.avoidplayer = 1

					if (getcvar(alive) != "1")
						self takedamage
//					self.no_idle = 0


				}
			}
	}
end

Next some one that heals himself.
self = AI that heals himself

Code: Select all


healself:
	
if !(isAlive self)
		end
local.w = randomfloat (5.0)

wait local.w



// Thinkstate killed must here applied to - Von
	while ( !(self.thinkstate == "idle") && !(self.thinkstate == "killed")  )
		waitframe

	println "canteen"

	self exec global/disable_ai.scr
	
	if !(isAlive self)
		end

	local.friendtype = self.friendtype
	self.friendtype = -1
	self holster
	wait 1

	if !(isAlive self)
		end

	self lookat NULL
	self upperanim pass_canteen_drink
	self waittill upperanimdone

	if !(isAlive self)
		end

	self.health = self.maxhealth
	self.friendtype = 1
	self unholster
	
	self exec global/enable_ai.scr
end
Simply call one of the scripts from at the moment you want

Von

Posted: Tue Oct 28, 2003 11:02 am
by silversound
Is it possible to have healing ai in multiplayer?

Posted: Tue Oct 28, 2003 1:22 pm
by smartaiguy
silversound wrote:Is it possible to have healing ai in multiplayer?
You should ask jv_map that, I don't think he's scripted that for bots though, maybe not...