Page 1 of 1

How does chair fall over?

Posted: Sat Oct 25, 2003 4:51 pm
by Vic Marrow
I have a ai sitting in a chair and when I shoot him, he falls out of the chair. How do you make the chair fall or tip over when the ai is shot?

Posted: Sat Oct 25, 2003 6:03 pm
by jv_map
I think it's an animation, like:

$chair anim fall

8-)

Posted: Sun Oct 26, 2003 12:07 pm
by bdbodger
You should read the global/cardgame.scr here is part of it
chairdeath:
// local.chair = self.chair
// local.rand = randomint (10)

self waittill death

if (self.fighting == 0)
{
self.chair delete
local.chair = spawn script_model
local.chair model "furniture/cardchair.tik"
local.chair.origin = self.origin
local.chair.angles = self.angles
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
}

// wait 2
end

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

self.fighting = 0
self thread chairdeath

Posted: Mon Oct 27, 2003 2:55 pm
by Vic Marrow
Yes bdbodger this worked. I put this outside of "main"

Code: Select all

chairdeath: 
// local.chair = self.chair 
// local.rand = randomint (10) 

self waittill death 

if (self.fighting == 0) 
{ 
self.chair delete 
local.chair = spawn script_model 
local.chair model "furniture/cardchair.tik" 
local.chair.origin = self.origin 
local.chair.angles = self.angles 
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 
} 

// wait 2 
end
Then I put this in my "main"

Code: Select all

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

$Perin.fighting = 0 
$Perin thread chairdeath
while(isAlive $Perin) 
{ 
$chair show 
waitframe 
}
$chair delete
I tried this with a wood chair but it would not work. It would spawn a cardchair. So I changed the line that spawns the chair to wood chair and it worked but the chair was not knocked over. I checked the animations for the animate_wood_chair in radiant and there were none. (just idle) So in radiant I made two script_models one of the wood chair standing, and one of the wood chair knocked over.(I moved the wood chair around with the radiant enity buttons "D") and then in my script I did this

Code: Select all

while(isAlive $Perin) 
{ 
$chaira hide 
waitframe 
}
$chaira show

while(isAlive $Perin) 
{ 
$chair show 
waitframe 
}
$chair delete
and this worked!!!! The only problem was when you look through the bottom of the wood chair you can see right through it like its not there. but if you look at the top of the wood chair you see the seat, not right through it. (weird) So I guess I stick with the card chair. (It has a lot of animations) Thanks again for your help bdbodger!!!!!!!!