How does chair fall over?

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Vic Marrow
Colour Sergeant
Posts: 95
Joined: Wed Aug 20, 2003 2:31 pm

How does chair fall over?

Post 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?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

I think it's an animation, like:

$chair anim fall

8-)
Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post 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
Vic Marrow
Colour Sergeant
Posts: 95
Joined: Wed Aug 20, 2003 2:31 pm

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