Page 1 of 1

Let bots sit down on a chair?

Posted: Mon Feb 14, 2005 2:49 pm
by |NSC|-Steelie-NS*LR*
Yo guys,

How do you let bots sit on a chair? :shock:
But they have to stand up when there's an enemy around.
is that possible? I think so, but dunno how to do it. :roll:

Greetz Steelie :!:

Posted: Mon Feb 14, 2005 6:51 pm
by lizardkid
you could make a cardgame.

Posted: Tue Feb 15, 2005 7:45 am
by |NSC|-Steelie-NS*LR*
Is there realy nothing easier? :?

Posted: Tue Feb 15, 2005 9:01 am
by bdbodger
Small sumo's busy_tutorial.pk3 is good to learn from maybe he will send it to you .

Posted: Wed Feb 16, 2005 3:46 pm
by |NSC|-Steelie-NS*LR*
k, I checked the map out, and I looked at the script, but I don't get it. :cry:
Can' t anyone just tell me the script? :idea:
It musn't be so hard, I think...

Posted: Wed Feb 16, 2005 10:59 pm
by Master-Of-Fungus-Foo-D
well there is an anim for a sitting prisoner from the second SP map wit major grillo (did you nkow JackGrillo was a sound manager for the game? look in the credits!)

Posted: Thu Feb 17, 2005 5:27 pm
by |NSC|-Steelie-NS*LR*
You guys here do evereything extremely well: mapping , scripting, modding!

But you can't tell me the script of a 'SITTING' bot? :evil: Man, someone must have done it one time! :cry:

Posted: Thu Feb 17, 2005 7:31 pm
by lizardkid
But you can't tell me the script of a 'SITTING' bot? Man, someone must have done it one time!
it takes an animation and probably a state. it's not stock and animations are few and far between, as far as i know i'm the only one here who animates and i loathe MilkShape with a passion. and nobody's ever had a use for a sitting AI. it'd make the game better of course, but generally SP levels dont assume that the player is undetected and MP levels certainly a guy is not going to sit down in hte middle of a huge firefight.

Posted: Sat Feb 19, 2005 2:03 pm
by Master-Of-Fungus-Foo-D
Hey steelie! IF you havent listened to me, listen NOW! If you can open up m1l2a youll find that the prisoner 'bot' is siting down and got up when you entered the room and killed the interrogators... now you just need to find what anim/state/script made him do that...

Posted: Sat Feb 19, 2005 7:53 pm
by lizardkid
Fungus, if you'd listened to him, you would have known he wanted a regular sitting animation, not hanging his head twitching ever so often.

Posted: Sun Feb 20, 2005 12:25 pm
by bdbodger
You should try reading some scripts to see how things are done . Like the stock mohaa scripts . You might find the answers to some of your questions . Like in this part of the global/cardgame.scr

sitthink:

self.originalhealth = self.health
self.health = 1
self holster
self.origin = self.chair.origin
self.angles = self.chair.angles
self anim chair_radio_listenidle

if (randomint (100) > 50)
self.chairdeath = "chair_death_forwards"
else
self.chairdeath = "chair_death_backwards"

self.fighting = 0
self thread chairdeath

self exec global/setdeathanim.scr self.chairdeath

while (self.thinkstate == "idle")
waitframe

Posted: Sun Feb 20, 2005 12:29 pm
by Master-Of-Fungus-Foo-D
so lizard kid, maybe he wants a drunk :P

Posted: Mon May 30, 2005 7:31 pm
by Axion
After looking at Small Sumo's buy tutorial, I took the global/eat.scr in there and modified it for sitting only:

Code: Select all

sitting:

		local.oldhealth = self.health
		self.health = 1
		local.chair = spawn script_model
		local.chair model "furniture/cardchair.tik"
		local.chair.origin = self.origin
		local.chair.angles = self.angles + ( 0 -90 0)

	if (randomint (100) > 50)
		self.chairdeath = "chair_death_forwards"
	else
		self.chairdeath = "chair_death_backwards"

	self.fighting = 0
	self thread sittingdeath local.chair

	self exec global/setdeathanim.scr self.chairdeath

	
	self holster

	while (self.thinkstate == "idle")
		{
		self anim chair_radio_listenidle 
		wait 3
		

}
if (isalive self)
	{
		self lookat $player
		self exec global/disable_ai.scr

		self anim dinner_relaxed_leap
		local.chair anim chair_alert_stand
		self unholster
		wait 0.5
//		self waittill animdone
		if (isalive self)
		{
			self.fighting = 1
			self exec global/enable_ai.scr
			self.health = local.oldhealth
			self exec global/setdeathanim.scr NIL
			self runto $player

			wait 1
			local.chair anim chair_alert_stand_end
		}
	}

end

sittingdeath local.chair:

self waittill death

	if (self.fighting == 0)
	{
		
		if (self.chairdeath == "chair_death_forwards")
			local.chair solid
		else
			local.chair notsolid

		waitframe
		println ("Chair is playing animation " + self.chairdeath)
		local.chair anim self.chairdeath
		wait 3
		local.chair anim (self.chairdeath + "_end")
		println ("Chair is playing animation " + (self.chairdeath + "_end"))
		waitframe
	}
end
To use it, just give your AI a targetname and in your script you can call up the global script to make them to sit:

Code: Select all

$sit_guy thread global/sit.scr::sitting

end

Posted: Tue May 31, 2005 11:29 am
by bdbodger
Is that the whole script? if so then you don't need to use

$sit_guy thread global/sit.scr::sitting

because when you execute a script it automatically starts at the top of the scirpt unitil it finds the word end so

$sit_guy exec global/sit.scr

would work too . This would be a usefull script nice job .

Posted: Tue May 31, 2005 3:33 pm
by Axion
Here's the final .scr:

Code: Select all

/////  Global Sitting Script by Axion
/////  **HOW TO USE**
/////  -Place a German AI guy and give him a targetname (Example, ai_guy1)
/////  To call up a sitting animation in your main script, use this method-
/////
/////  $ai_guy1 thread global/sit.scr::listening (Sitting down and listening)
/////  $ai_guy1 thread global/sit.scr::sitting   (Sitting down and relaxing) 
/////  $ai_guy1 thread global/sit.scr::writing   (Sitting down and writing)
/////
/////-----------------------------------------------------------------------------

listening:

		local.oldhealth = self.health
		self.health = 1
		local.chair = spawn script_model
		local.chair model "furniture/cardchair.tik"
		local.chair.origin = self.origin
		local.chair.angles = self.angles + ( 0 -90 0)

	if (randomint (100) > 50)
		self.chairdeath = "chair_death_forwards"
	else
		self.chairdeath = "chair_death_backwards"

	self.fighting = 0
	self thread listeningdeath local.chair

	self exec global/setdeathanim.scr self.chairdeath

	
	self holster

	while (self.thinkstate == "idle")
		{
		self anim chair_radio_listenidle 
		wait 3
		

}
if (isalive self)
	{
		self lookat $player
		self exec global/disable_ai.scr

		self anim dinner_relaxed_leap
		local.chair anim chair_alert_stand
		self unholster
		wait 0.5
//		self waittill animdone
		if (isalive self)
		{
			self.fighting = 1
			self exec global/enable_ai.scr
			self.health = local.oldhealth
			self exec global/setdeathanim.scr NIL
			self runto $player

			wait 1
			local.chair anim chair_alert_stand_end
		}
	}

end

listeningdeath local.chair:

self waittill death

	if (self.fighting == 0)
	{
		
		if (self.chairdeath == "chair_death_forwards")
			local.chair solid
		else
			local.chair notsolid

		waitframe
		println ("Chair is playing animation " + self.chairdeath)
		local.chair anim self.chairdeath
		wait 3
		local.chair anim (self.chairdeath + "_end")
		println ("Chair is playing animation " + (self.chairdeath + "_end"))
		waitframe
	}
end

/////-----------------------------------------------------------------------------

sitting:

		local.oldhealth = self.health
		self.health = 1
		local.chair = spawn script_model
		local.chair model "furniture/cardchair.tik"
		local.chair.origin = self.origin
		local.chair.angles = self.angles + ( 0 -90 0)

	if (randomint (100) > 50)
		self.chairdeath = "chair_death_forwards"
	else
		self.chairdeath = "chair_death_backwards"

	self.fighting = 0
	self thread sittingdeath local.chair

	self exec global/setdeathanim.scr self.chairdeath

	
	self holster

	while (self.thinkstate == "idle")
		{
		self anim dinner_relaxed_resting	
		wait 3

}
if (isalive self)
	{
		self lookat $player
		self exec global/disable_ai.scr

		self anim dinner_relaxed_leap
		local.chair anim chair_alert_stand
		self unholster
		wait 0.5
//		self waittill animdone
		if (isalive self)
		{
			self.fighting = 1
			self exec global/enable_ai.scr
			self.health = local.oldhealth
			self exec global/setdeathanim.scr NIL
			self runto $player

			wait 1
			local.chair anim chair_alert_stand_end
		}
	}

end

sittingdeath local.chair:

self waittill death

	if (self.fighting == 0)
	{
		
		if (self.chairdeath == "chair_death_forwards")
			local.chair solid
		else
			local.chair notsolid

		waitframe
		println ("Chair is playing animation " + self.chairdeath)
		local.chair anim self.chairdeath
		wait 3
		local.chair anim (self.chairdeath + "_end")
		println ("Chair is playing animation " + (self.chairdeath + "_end"))
		waitframe
	}
end

/////-----------------------------------------------------------------------------

writing:

		local.oldhealth = self.health
		self.health = 1
		local.chair = spawn script_model
		local.chair model "furniture/cardchair.tik"
		local.chair.origin = self.origin
		local.chair.angles = self.angles

	if (randomint (100) > 50)
		self.chairdeath = "chair_death_forwards"
	else
		self.chairdeath = "chair_death_backwards"

	self.fighting = 0
	self thread writingdeath local.chair

	self exec global/setdeathanim.scr self.chairdeath

	
	self holster

	while (self.thinkstate == "idle")
		{
		self anim chair_write	
		//self waittill animdone
		wait 2

}
if (isalive self)
	{
		self lookat $player
		self exec global/disable_ai.scr

		self anim chair_alert_stand
		local.chair anim chair_alert_stand
		self unholster
		wait 0.5
//		self waittill animdone
		if (isalive self)
		{
			self.fighting = 1
			self exec global/enable_ai.scr
			self.health = local.oldhealth
			self exec global/setdeathanim.scr NIL
			self runto $player

			wait 1
			local.chair anim chair_alert_stand_end
		}
	}

end

writingdeath local.chair:

self waittill death

	if (self.fighting == 0)
	{
		
		if (self.chairdeath == "chair_death_forwards")
			local.chair solid
		else
			local.chair notsolid

		waitframe
		println ("Chair is playing animation " + self.chairdeath)
		local.chair anim self.chairdeath
		wait 3
		local.chair anim (self.chairdeath + "_end")
		println ("Chair is playing animation " + (self.chairdeath + "_end"))
		waitframe
	}
end