Looking to something

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Wertmanzzz
Lance Corporal
Posts: 21
Joined: Sun Feb 12, 2006 2:09 pm
Location: The Netherlands

Looking to something

Post 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
Ophisâ„¢
Colonel
Posts: 461
Joined: Sun Mar 12, 2006 2:30 pm
Location: England, Manchester
Contact:

Post by Ophisâ„¢ »

What? You mean how do you turn?! in game? you might want to explain abit more.
Wertmanzzz
Lance Corporal
Posts: 21
Joined: Sun Feb 12, 2006 2:09 pm
Location: The Netherlands

Post 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 :twisted: 8-) , 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 :)
neillomax
Lieutenant General
Posts: 880
Joined: Thu Jun 23, 2005 6:57 am

Post by neillomax »

Hope it works. You can call it the head-bangers ball..........
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

You can modify the player's viewangles pitch:

Code: Select all

local.player.viewangles[0] == 90
-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, :P 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. ;)
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post 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.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Wertmanzzz
Lance Corporal
Posts: 21
Joined: Sun Feb 12, 2006 2:09 pm
Location: The Netherlands

Post 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] :D
Wertmanzzz
Lance Corporal
Posts: 21
Joined: Sun Feb 12, 2006 2:09 pm
Location: The Netherlands

Post 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 :)
Post Reply