Hey there folks,
Very simple question, but I can't solve it...
How can I let a player look towards something with his whole body?
Thanks,
Wertmanzzz
Looking to something
Moderator: Moderators
-
Wertmanzzz
- Lance Corporal
- Posts: 21
- Joined: Sun Feb 12, 2006 2:09 pm
- Location: The Netherlands
-
Wertmanzzz
- Lance Corporal
- Posts: 21
- Joined: Sun Feb 12, 2006 2:09 pm
- Location: The Netherlands
Ok, i'll explain 
I'm working on a small mod, i'll bring it out as soon as possible
I call it the headbangmod, in which case you have to headbang each other to death
, the only problem is I can't get the player to bend it's entire torso 90 degrees (or a bit less) downward (like with the mouse), by pressing use or fire. That's all 
I'm working on a small mod, i'll bring it out as soon as possible
I call it the headbangmod, in which case you have to headbang each other to death
-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:
You can modify the player's viewangles pitch:
-90 is straight up, 90 is straight down. If you want it to go smoothly, you'll need something like this (it's idiot proof - it ignores the player's own movement,
and it returns to looking straight forward afterwards):
Off the top of my head, but should work. 
Code: Select all
local.player.viewangles[0] == 90Code: Select all
local.pos = local.player.viewangles[0]
local.bangtime = 0.8 // how long do you want the bang move to last in seconds
local.step = local.bangtime / abs(local.pos + 90)
// bang!
while (local.player.viewangles[0] != 90) {
local.pos += local.step
if (local.pos > 90)
local.pos = 90
local.player.viewangles[0] = local.pos
}
// and back up
local.step = local.bangtime / 90.0
while (local.player.viewangles[0] != 0) {
local.pos -= local.step
if (local.pos < 0)
local.pos = 0
local.player.viewangles[0] = local.pos
}-
Wertmanzzz
- Lance Corporal
- Posts: 21
- Joined: Sun Feb 12, 2006 2:09 pm
- Location: The Netherlands
Thanks Rookie one 
But there was a much simpler solution
Easy, but thanks for the idea of viewangles[0] 
But there was a much simpler solution
Code: Select all
// bang!
local.player.state = HEADBANG
local.player.viewangles = local.player.viewangles - ( 0 0 0 )
waitframe
local.player.viewangles = local.player.viewangles - ( -21.5 0 0 )
waitframe
local.player.viewangles = local.player.viewangles - ( -43 0 0 )
waitframe
local.player.viewangles = local.player.viewangles - ( -64.5 0 0 )
waitframe
local.player.viewangles = local.player.viewangles - ( -86 0 0 )
waitframe
if(local.player.viewangles[0] >= 64.5)
{
local.player.viewangles = local.player.viewangles - ( 64.5 0 0 )
waitframe
}
if(local.player.viewangles[0] >= 43)
{
local.player.viewangles = local.player.viewangles - ( 43 0 0 )
waitframe
}
if(local.player.viewangles[0] >= 21.5)
{
local.player.viewangles = local.player.viewangles - ( 21.5 0 0 )
waitframe
}
if(local.player.viewangles[0] >= 0)
local.player.viewangles = local.player.viewangles - ( 0 0 0 )
local.player.state = STAND
wait 2
-
Wertmanzzz
- Lance Corporal
- Posts: 21
- Joined: Sun Feb 12, 2006 2:09 pm
- Location: The Netherlands
A bit off topic but I made a state headbang and I want to recall that in mike_torso (or mike_legs of mike) so only if in that state you can actually hurt people.
I found
This
But It doesn't says how to 'implant it as a script'.
How can you do that
, thanks already 
I found
This
But It doesn't says how to 'implant it as a script'.
How can you do that

