How do you let bots sit on a chair?
But they have to stand up when there's an enemy around.
is that possible? I think so, but dunno how to do it.
Greetz Steelie
Moderator: Moderators
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.But you can't tell me the script of a 'SITTING' bot? Man, someone must have done it one time!
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
}
endCode: Select all
$sit_guy thread global/sit.scr::sitting
end

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
