Useheld

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
fuhrer
Captain
Posts: 253
Joined: Sun Mar 14, 2004 3:36 am

Useheld

Post by fuhrer »

hey does anyone have an example of an OBJ script where u have to hold use to set a bomb, im helpin someone work on a football mod and i need useheld to set the power u kick the ball.. so far i have this...

Code: Select all

while($ball_trigger_2 useheld)
	{
	level.balldist = (level.balldist * 5)
	if(level.balldist >= 300)
	{
	break
	}
	wait .1
	}
however the script isnt working, i may have made a mistake somewher else but i cant find it :? also!!!

can i do this???

Code: Select all

$ball moveForward (level.balldist / 1.6)
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

the ball trigger can't hold down the use key only the player can .

local.player = parm.other

while(local.player.useheld == 1)
{
level.balldist = (level.balldist * 5)
if(level.balldist >= 300)
{
break
}
wait .1
}
Image
fuhrer
Captain
Posts: 253
Joined: Sun Mar 14, 2004 3:36 am

Post by fuhrer »

thanx bodger ill try that
fuhrer
Captain
Posts: 253
Joined: Sun Mar 14, 2004 3:36 am

Post by fuhrer »

:( not working

Code: Select all

main:
	waitthread prep
	thread ball_kick

	level waittill spawn
	
end

prep:
	$ball_trigger glue $ball
	$ball_trigger_2 glue $ball
end


ball_kick:

	$ball_trigger_2 waittill trigger
	level.kickpower = 10
	
	local.player = parm.other
	while(local.player useheld)
{
	level.kickpower = (level.kickpower * 2.4)
	wait .5
}

	local.ballheight = level.kickpower 
	local.balldist = (level.kickpower * 4)

	iprintln_noloc "kick"
	$ball time .4
	local.angles = (vector_toangles ($player.origin - $ball.origin))
	$ball.angles = (0 (local.angles[1] - 90) 0)

	$ball rotateZup 720
	$ball moveUp local.ballheight
	$ball moveRight local.balldist
	$ball waitmove
	$ball rotateZup 720
	$ball moveDown local.ballheight
	$ball moveRight local.balldist
	$ball waitmove

	goto ball_kick

end
fuhrer
Captain
Posts: 253
Joined: Sun Mar 14, 2004 3:36 am

Post by fuhrer »

nm i missed out the . before useheld :oops:
Post Reply