Page 1 of 1

Hostage Rescue

Posted: Tue Feb 17, 2004 11:02 am
by Wilson
Hey guys tried a search and didnt find much,

Could anyone tell me how i would have say 4 hostages behind enemy lines and the allies must rescue them and take them back to a truck where the mission will end as the hostages will be safe?

Cheers in advance
Wilson

Posted: Tue Feb 17, 2004 11:35 am
by m4rine
hmmm you could try sort of binding the hostage AI to the player, with a triggger where u press use to bind (i.e. follow). I suppose the trigger could do both the objective and the bind trigger - just a suggestion i dunno if it will work.

Posted: Tue Feb 17, 2004 2:32 pm
by bdbodger
I did something like that in my map The_rescue . There is a link to it here at .map you can do a search for it . Here is the part that makes the guy follow

Code: Select all

ai_follow local.guy:

	self.distance = 64
	self.waittime=1
	self.friendrange = 128

	local.dmteam = local.guy.dmteam

	while (( isalive local.guy )&&(local.guy.hasguy==1)&&( local.guy.dmteam == local.dmteam))
	{
	self waitthread follow_player local.guy
	}

	self thread deactivate_prisoner local.guy

end

////////////////////////////////////////////////////////////

follow_player local.followed:

		self.destination = local.followed

		local.movethread = -1

		self.movedoneradius = self.distance 
			
		if (vector_length (self.destination.origin - self.origin) > self.distance + self.friendrange) 
		{

			self runto self.destination.origin 
			
			local.stand = 0
			self waittill movedone

			if !(self.destination)
			self.destination = null

			if (vector_length (self.destination.origin - self.origin) < self.distance + self.friendrange) 
			{
				self exec global/stand.scr
			}

		}
		else
		{
			if (local.stand == 0)
			{
				self exec global/stand.scr
				local.stand = 1
			}
		wait 1
		}

		if (vector_length (self.destination.origin - self.origin) > self.distance + self.friendrange) 
		{
			
			self runto self.destination.origin 
			local.stand = 0
			thread movedone
			local.movethread = parm.previousthread
		}


		if ((local.movethread != -1) && (local.movethread != NIL))
		local.movethread delete

		local.dest = self.destination.origin
		local.runnertime = level.time + 2

		while (((self.movedone == 0) && (vector_length (local.dest - self.origin) > (self.distance + self.friendrange))) && (local.runnertime > level.time))
		{
			if (self.waittime == -1)
			waitframe
		else
			wait self.waittime
		}

end
I just hacked apart of the global/friendly.scr as I remember

Posted: Tue Feb 17, 2004 2:49 pm
by Wilson
How would i make a trigger that will end the map when the hostage gets there? what would its values be?

Cheers for that bit of help m8

Posted: Tue Feb 17, 2004 10:22 pm
by bdbodger
You could just do a distance check

while(vector_length ( $myai.origin - $myendspot.origin) > 256)
waitframe

iprintln " my guy arrived at the end spot "

Posted: Wed Feb 18, 2004 10:39 am
by Wilson
Right i'll try that cheers for ya help m8