How does chair fall over?
Moderator: Moderators
-
Vic Marrow
- Colour Sergeant
- Posts: 95
- Joined: Wed Aug 20, 2003 2:31 pm
How does chair fall over?
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?
You should read the global/cardgame.scr here is part of it
and
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
Yes bdbodger this worked. I put this outside of "main"
Then I put this in my "main"
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
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!!!!!!!!
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
endCode: 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 deleteCode: Select all
while(isAlive $Perin)
{
$chaira hide
waitframe
}
$chaira show
while(isAlive $Perin)
{
$chair show
waitframe
}
$chair delete