Page 1 of 1
Looking to something
Posted: Sat Nov 11, 2006 12:23 pm
by Wertmanzzz
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
Posted: Sat Nov 11, 2006 1:01 pm
by Ophisâ„¢
What? You mean how do you turn?! in game? you might want to explain abit more.
Posted: Sat Nov 11, 2006 7:45 pm
by Wertmanzzz
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

Posted: Sat Nov 11, 2006 9:41 pm
by neillomax
Hope it works. You can call it the head-bangers ball..........
Posted: Sat Nov 11, 2006 11:44 pm
by Rookie One.pl
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):
Code: 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
}
Off the top of my head, but should work.

Posted: Sun Nov 12, 2006 2:34 am
by lizardkid
neillomax wrote:Hope it works. You can call it the head-bangers ball..........
or you could just call it the Mudvayne Mosh Pit.
that'd be funny just to have on the server, someone shooting a tommy looks like a spasmatic.
Posted: Sun Nov 12, 2006 11:54 am
by Wertmanzzz
Thanks Rookie one

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
Easy, but thanks for the idea of viewangles[0]

Posted: Sun Nov 12, 2006 12:36 pm
by Wertmanzzz
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
