Sniper-Breathing Help ***Fixed***
by Donnie Hutson Jr · in Torque Game Engine · 09/26/2009 (10:52 pm) · 8 replies
Ok, I add the Drunk or Sniper Breathing resource,
www.garagegames.com/community/resources/view/4993
Works great and I even worked out how to use it without knowing my ID#, like this in my zoom funtion;
However, what I want is to be able to zoom for 5 seconds with the tranquilized set to 0.0001, then after 5 seconds, it sets to something like 0.001, and of course on no zoom its set to 0.0
***FIXED***
Here's how it should look...............
If you notice, I just used the schedule command to do what I wanted, now when I zoom I have just alittle movement, then after 5 seconds it moves alittle more, then I added the thought of after a 10 second breath hold while zooming make the movement goes nuts.....better unzoom and refocus. Hope some else may get a little help from it.....thanks again to F.W. Hardijzer for his resource on Drunk or Sniper-Breathing movement.....Donnie
www.garagegames.com/community/resources/view/4993
Works great and I even worked out how to use it without knowing my ID#, like this in my zoom funtion;
if($Pref::player::CurrentFOV $= "")
$Pref::player::CurrentFOV = 45;
function clientCmdZoomIn( %val, %curWeapon )
{
if ( %val && %curWeapon $= "m4a1" )
{
$Pref::player::CurrentFOV = 11.25; //Set for 8X Zoom
$ZoomOn = true;
setFov( $Pref::player::CurrentFOV );
ScopeGuiGroup1.Visible = 1; // Show m4a1 Scope HUD
Reticle.Visible = 0; // Hide Crosshair
LocalClientConnection.player.setTranquilized(0.0001); //Breathing while Zoomed
}
else if ( %val && %curWeapon $= "Rocket" )
{
$Pref::player::CurrentFOV = 15; //Set for 6X Zoom
$ZoomOn = true;
setFov( $Pref::player::CurrentFOV );
ScopeGuiGroup2.Visible = 1; // Show Rocket Scope HUD
Reticle.Visible = 0; // Hide Crosshair
LocalClientConnection.player.setTranquilized(0.0001); //Breathing while Zoomed
}
else if ( %val && %curWeapon $= "Sig551" )
{
$Pref::player::CurrentFOV = 11.25; //Set for 8X Zoom
$ZoomOn = true;
setFov( $Pref::player::CurrentFOV );
ScopeGuiGroup1.Visible = 1; // Show Sig551 Scope HUD
Reticle.Visible = 0; // Hide Crosshair
LocalClientConnection.player.setTranquilized(0.0001); //Breathing while Zoomed
}
else
{
$ZoomOn = false;
setFov( $Pref::player::DefaultFov );
ScopeGuiGroup1.Visible = 0; // Make m4a1 Scope HUD Invisible
ScopeGuiGroup2.Visible = 0; //Make Rocket Scope HUD Invisible
Reticle.Visible = 1; // Show crosshair
LocalClientConnection.player.setTranquilized(0.0); //NO Breathing while unZoomed
}
}However, what I want is to be able to zoom for 5 seconds with the tranquilized set to 0.0001, then after 5 seconds, it sets to something like 0.001, and of course on no zoom its set to 0.0
***FIXED***
Here's how it should look...............
if($Pref::player::CurrentFOV $= "")
$Pref::player::CurrentFOV = 45;
function clientCmdZoomIn( %val, %curWeapon )
{
if ( %val && %curWeapon $= "m4a1" )
{
$Pref::player::CurrentFOV = 11.25; //Set for 8X Zoom
$ZoomOn = true;
setFov( $Pref::player::CurrentFOV );
ScopeGuiGroup1.Visible = 1; // Show m4a1 Scope HUD
Reticle.Visible = 0; // Hide Crosshair
LocalClientConnection.player.setTranquilized(0.0001); //Breathing while Zoomed
$HoldingBreath = schedule(5000,0,"Breathing"); //Increase Breathing effect after 5 seconds
$StillHoldingBreath = schedule(10000,0,"AreYouKidding"); //Increase Breathing effect after 10 seconds
}
else if ( %val && %curWeapon $= "Rocket" )
{
$Pref::player::CurrentFOV = 15; //Set for 6X Zoom
$ZoomOn = true;
setFov( $Pref::player::CurrentFOV );
ScopeGuiGroup2.Visible = 1; // Show Rocket Scope HUD
Reticle.Visible = 0; // Hide Crosshair
LocalClientConnection.player.setTranquilized(0.0001); //Breathing while Zoomed
$HoldingBreath = schedule(5000,0,"Breathing"); //Increase Breathing effect after 5 seconds
$StillHoldingBreath = schedule(10000,0,"AreYouKidding"); //Increase Breathing effect after 10 seconds
}
else if ( %val && %curWeapon $= "Sig551" )
{
$Pref::player::CurrentFOV = 11.25; //Set for 8X Zoom
$ZoomOn = true;
setFov( $Pref::player::CurrentFOV );
ScopeGuiGroup1.Visible = 1; // Show Sig551 Scope HUD
Reticle.Visible = 0; // Hide Crosshair
LocalClientConnection.player.setTranquilized(0.0001); //Breathing while Zoomed
$HoldingBreath = schedule(5000,0,"Breathing"); //Increase Breathing effect after 5 seconds
$StillHoldingBreath = schedule(10000,0,"AreYouKidding"); //Increase Breathing effect after 10 seconds
}
else
{
$ZoomOn = false;
setFov( $Pref::player::DefaultFov );
ScopeGuiGroup1.Visible = 0; // Make m4a1/Sig551 Scope HUD Invisible
ScopeGuiGroup2.Visible = 0; //Make Rocket Scope HUD Invisible
Reticle.Visible = 1; // Show crosshair
LocalClientConnection.player.setTranquilized(0.0001); //Just alittle Breathing while unZoomed
cancel($HoldingBreath);
cancel($StillHoldingBreath);
}
}
function toggleZoom(%val)
{
if ($firstPerson == 1) // No Zoom When in 3rd Person View
{
commandToServer( 'CallZoomFunction', %val );
}
}
function Breathing()
{
if ($firstPerson == 1)
{
LocalClientConnection.player.setTranquilized(0.001);
}
}
function AreYouKidding()
{
if ($firstPerson == 1)
{
LocalClientConnection.player.setTranquilized(0.01);
}
}
moveMap.bind(mouse, mouse2, toggleZoom);If you notice, I just used the schedule command to do what I wanted, now when I zoom I have just alittle movement, then after 5 seconds it moves alittle more, then I added the thought of after a 10 second breath hold while zooming make the movement goes nuts.....better unzoom and refocus. Hope some else may get a little help from it.....thanks again to F.W. Hardijzer for his resource on Drunk or Sniper-Breathing movement.....Donnie
About the author
Electrical Engineer by trade, Computer geek by night. Still learning and loving every minute.
#2
10/01/2009 (6:18 am)
Glad you're not *totally* turned off by the community ;). It's not a reliable solution to anything, I've found, and it does pay to figure things out yourself. That said, it's great when people show interest and can help you out.
#3
10/01/2009 (5:08 pm)
Never was Daniel!!! Reliable??? All it does is make my zoom use the Drunk Sniper resource, I thought maybe someone else might like to know how I did it, prob.. not the best way but no one help me do it and I thought I'd try to give back to a community who has help me so much, didn't know I'd get comments like this though, sorry if I made your tea to hot, only trying to help.......Donnie
#4
Btw: I've never seen a global variable schedule and cancel function used like that!
10/01/2009 (5:32 pm)
Looks awesome, I think I'll have to check this out.Btw: I've never seen a global variable schedule and cancel function used like that!
#5
10/01/2009 (9:41 pm)
No, no, I meant the community wasn't a reliable solution to anything! Most of the time it's a huge help, but you never know when you just won't get a response ;P. I think it's great that you posted up the fix you found - too often people don't, and that just means more of the same questions get asked because the answer isn't there.
#6
10/01/2009 (9:48 pm)
Then By all means I do apologize Daniel, I thought I upset you somehow, and thank you for responding......Donnie
#7
10/02/2009 (12:18 am)
Heh, no worries... on my part, I'm sorry for being a bit ambiguous ;P.
#8
and change the two functions to this...
everything else remains the same!!
02/11/2014 (6:04 pm)
For T3d 3.5, use the following on togglezoom;LocalClientConnection.player.setTranquilized(0.0001); //Breathing while Zoomed
%time1 = 5000;
%time2 = 10000;
$holdingbreath = schedule(%time1,0,"Breathing"); //Increase Breathing effect after 5 seconds
$StillHoldingBreath = schedule(%time2,0,"AreYouKidding"); //Increase Breathing effect after 10 secondsand change the two functions to this...
function Breathing()
{
LocalClientConnection.player.setTranquilized(0.001);
}
function AreYouKidding()
{
LocalClientConnection.player.setTranquilized(0.01);
}everything else remains the same!!
Torque Owner Donnie Hutson Jr