Tutorial Request

If you're looking for mapping help or you reckon you're a mapping guru, post your questions / solutions here

Moderator: Moderators

BiG_HeaD
Brigadier General
Posts: 531
Joined: Thu Jul 03, 2003 7:28 pm

Post by BiG_HeaD »

any
Ive played more than u.
vonderbakluft
Corporal
Posts: 46
Joined: Fri Aug 01, 2003 11:15 am
Location: NL
Contact:

Post 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
Real mappers map in wordpad ;-)
User avatar
silversound
Second Lieutenant
Posts: 167
Joined: Wed Jun 18, 2003 6:33 am
Location: West Seattle, WA, USA, Earth, Milky Way

Post by silversound »

Is it possible to have healing ai in multiplayer?
PM me your tips of the day.

Image
smartaiguy
Brigadier General
Posts: 512
Joined: Tue Jul 08, 2003 2:52 pm

Post 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...
Post Reply